diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index d88c71f1..2d99154c 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -4424,6 +4424,8 @@ def interactive_flexchart_stacked(id,r,xparam='time', 'power','hr','spm','driveenergy', 'time','pace','workoutstate'] + comment = None + rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True, workstrokesonly=False) @@ -4633,7 +4635,7 @@ def interactive_flexchart_stacked(id,r,xparam='time', plot2.x_range = xrange1 plot3.x_range = xrange1 plot4.x_range = xrange1 - + if xparam == 'time': plot4.xaxis[0].formatter = DatetimeTickFormatter( hours = ["%H"], @@ -4651,88 +4653,95 @@ def interactive_flexchart_stacked(id,r,xparam='time', if yparam1 == 'pace': y1tooltip = '@fpace' - else: + elif yparam1 != 'None': y1tooltip = '@{yparam1}'.format(yparam1=yparam1) if metricsdicts[yparam1]['numtype'] == 'integer' or yparam1 == 'power': y1tooltip+='{int}' else: y1tooltip+='{0.00}' + else: + y1tooltip = '' + comment = 'The metric in the first chart is only accessible with a Pro plan or higher' if yparam2 == 'pace': y2tooltip = '@fpace' - else: + elif yparam2 != 'None': y2tooltip = '@{yparam2}'.format(yparam2=yparam2) if metricsdicts[yparam2]['numtype'] == 'integer' or yparam2 == 'power': y2tooltip+='{int}' else: y2tooltip+='{0.00}' + else: + y2tooltip = '' + comment = 'The metric in the second chart is only accessible with a Pro plan or higher' if yparam3 == 'pace': y3tooltip = '@fpace' - else: + elif yparam3 != 'None': y3tooltip = '@{yparam3}'.format(yparam3=yparam3) if metricsdicts[yparam3]['numtype'] == 'integer' or yparam3 == 'power': y3tooltip+='{int}' else: y3tooltip+='{0.00}' + else: + y3tooltip = '' + comment = 'The metric in the third chart is only accessible with a Pro plan or higher' if yparam4 == 'pace': y4tooltip = '@fpace' - else: + elif yparam4 != 'None': y4tooltip = '@{yparam4}'.format(yparam4=yparam4) if metricsdicts[yparam4]['numtype'] == 'integer' or yparam4 == 'power': y4tooltip+='{int}' else: y4tooltip+='{0.00}' + else: + y4tooltip = '' + comment = 'The metric in the fourth chart is only accessible with a Pro plan or higher' + if yparam1 != 'None': + hover1.tooltips = OrderedDict([ + ('Time','@ftime'), + ('Distance','@distance{int}'), + (axlabels[yparam1],y1tooltip), + (axlabels[yparam2],y2tooltip), + (axlabels[yparam3],y3tooltip), + (axlabels[yparam4],y4tooltip), + ]) + if yparam2 != 'None': + hover2.tooltips = OrderedDict([ + ('Time','@ftime'), + ('Distance','@distance{int}'), + (axlabels[yparam1],y1tooltip), + (axlabels[yparam2],y2tooltip), + (axlabels[yparam3],y3tooltip), + (axlabels[yparam4],y4tooltip), + ]) + if yparam3 != 'None': + hover3.tooltips = OrderedDict([ + ('Time','@ftime'), + ('Distance','@distance{int}'), + (axlabels[yparam1],y1tooltip), + (axlabels[yparam2],y2tooltip), + (axlabels[yparam3],y3tooltip), + (axlabels[yparam4],y4tooltip), + ]) + if yparam4 != 'None': + hover4.tooltips = OrderedDict([ + ('Time','@ftime'), + ('Distance','@distance{int}'), + (axlabels[yparam1],y1tooltip), + (axlabels[yparam2],y2tooltip), + (axlabels[yparam3],y3tooltip), + (axlabels[yparam4],y4tooltip), + ]) - - - - - - - hover1.tooltips = OrderedDict([ - ('Time','@ftime'), - ('Distance','@distance{int}'), - (axlabels[yparam1],y1tooltip), - (axlabels[yparam2],y2tooltip), - (axlabels[yparam3],y3tooltip), - (axlabels[yparam4],y4tooltip), - ]) - hover2.tooltips = OrderedDict([ - ('Time','@ftime'), - ('Distance','@distance{int}'), - (axlabels[yparam1],y1tooltip), - (axlabels[yparam2],y2tooltip), - (axlabels[yparam3],y3tooltip), - (axlabels[yparam4],y4tooltip), - ]) - - hover3.tooltips = OrderedDict([ - ('Time','@ftime'), - ('Distance','@distance{int}'), - (axlabels[yparam1],y1tooltip), - (axlabels[yparam2],y2tooltip), - (axlabels[yparam3],y3tooltip), - (axlabels[yparam4],y4tooltip), - ]) - - hover4.tooltips = OrderedDict([ - ('Time','@ftime'), - ('Distance','@distance{int}'), - (axlabels[yparam1],y1tooltip), - (axlabels[yparam2],y2tooltip), - (axlabels[yparam3],y3tooltip), - (axlabels[yparam4],y4tooltip), - ]) - - hover1.mode = 'mouse' - hover2.mode = 'mouse' - hover3.mode = 'mouse' - hover4.mode = 'mouse' + hover1.mode = 'vline' + hover2.mode = 'vline' + hover3.mode = 'vline' + hover4.mode = 'vline' y1min = get_yaxminima(r,yparam1,mode) y2min = get_yaxminima(r,yparam2,mode) @@ -4797,7 +4806,7 @@ def interactive_flexchart_stacked(id,r,xparam='time', js_resources = INLINE.render_js() css_resources = INLINE.render_css() - return script,div,js_resources,css_resources + return script,div,js_resources,css_resources,comment diff --git a/rowers/templates/flexchartstacked.html b/rowers/templates/flexchartstacked.html index d6468570..f162fc09 100644 --- a/rowers/templates/flexchartstacked.html +++ b/rowers/templates/flexchartstacked.html @@ -3,7 +3,7 @@ {% load rowerfilters %} {% load tz %} -{% block title %} Flexible Plot {% endblock %} +{% block title %}Chart Stack{% endblock %} {% localtime on %} {% block main %} @@ -31,7 +31,7 @@

-

Flexible Chart

+

Chart Stack

  • diff --git a/rowers/templates/menu_workout.html b/rowers/templates/menu_workout.html index 0de063d9..cf9e7c26 100644 --- a/rowers/templates/menu_workout.html +++ b/rowers/templates/menu_workout.html @@ -73,16 +73,16 @@
      -
    • - -  Flex Chart - -
    •  Chart Stack
    • +
    • + +  Flex Chart + +
    • {% if workout|water %}
    • diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index d63c85c6..00cada4c 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -3966,7 +3966,7 @@ def workout_flexchart_stacked_view(request,*args,**kwargs): yparam4 = cd['yaxis4'] ( - script, div, js_resources, css_resources + script, div, js_resources, css_resources, comment ) = interactive_flexchart_stacked( encoder.decode_hex(id),r,xparam=xparam, yparam1=yparam1, @@ -3976,6 +3976,9 @@ def workout_flexchart_stacked_view(request,*args,**kwargs): mode=workout.workouttype, ) + if comment is not None: + messages.error(request,comment) + initial = { 'xaxis':xparam, 'yaxis1':yparam1,