stack chart improvements
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
</p>
|
||||
|
||||
|
||||
<h1>Flexible Chart</h1>
|
||||
<h1>Chart Stack</h1>
|
||||
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
|
||||
@@ -73,16 +73,16 @@
|
||||
<input type="checkbox" name="group-flexchart" id="group-flexchart">
|
||||
<label for="group-flexchart">Interactive Charts</label>
|
||||
<ul>
|
||||
<li id="chart-flexchart">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/flexchart/">
|
||||
<i class="fas fa-chart-line fa-fw"></i> Flex Chart
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-stackedchart">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/flexchartstacked/">
|
||||
<i class="fas fa-align-justify fa-fw"></i> Chart Stack
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-flexchart">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/flexchart/">
|
||||
<i class="fas fa-chart-line fa-fw"></i> Flex Chart
|
||||
</a>
|
||||
</li>
|
||||
{% if workout|water %}
|
||||
<li id="chart-map">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/map/">
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user