fixing performance plot
This commit is contained in:
@@ -1870,6 +1870,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
plot = figure(tools=TOOLS, x_axis_type='datetime',
|
||||
width=900, height=300,
|
||||
toolbar_location="above",
|
||||
@@ -1898,16 +1899,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
y_range_name="watermark",
|
||||
)
|
||||
|
||||
if modelchoice == 'banister': # pragma: no cover
|
||||
fitlabel = 'PTE (fitness)'
|
||||
fatiguelabel = 'NTE (fatigue)'
|
||||
formlabel = 'Performance'
|
||||
rightaxlabel = 'Performance'
|
||||
if dofatigue:
|
||||
yaxlabel = 'PTE/NTE'
|
||||
else:
|
||||
yaxlabel = 'PTE'
|
||||
else:
|
||||
fitlabel = 'Fitness'
|
||||
fatiguelabel = 'Fatigue'
|
||||
formlabel = 'Freshness'
|
||||
@@ -1917,21 +1908,23 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
else:
|
||||
yaxlabel = 'Fitness'
|
||||
|
||||
# if showtests:
|
||||
# plot.circle('date','testpower',source=source,fill_color='green',size=10,
|
||||
# legend_label='Your best workouts')
|
||||
if modelchoice == 'banister': # pragma: no cover
|
||||
fitlabel = 'PTE (fitness)'
|
||||
fatiguelabel = 'NTE (fatigue)'
|
||||
formlabel = 'Performance'
|
||||
rightaxlabel = 'Performance'
|
||||
if dofatigue:
|
||||
yaxlabel = 'PTE/NTE'
|
||||
else:
|
||||
yaxlabel = 'PTE'
|
||||
|
||||
|
||||
plot.xaxis.axis_label = None
|
||||
plot.yaxis.axis_label = yaxlabel
|
||||
|
||||
y2rangemin = df.loc[:, ['form']].min().min()
|
||||
y2rangemax = df.loc[:, ['form']].max().max()
|
||||
# if dofatigue and showtests:
|
||||
# y1rangemin = df.loc[:,['testpower','fitness','fatigue']].min().min()
|
||||
# y1rangemax = df.loc[:,['testpower','fitness','fatigue']].max().max()*1.02
|
||||
# elif showtests:
|
||||
# y1rangemin = df.loc[:,['testpower','fitness']].min().min()
|
||||
# y1rangemax = df.loc[:,['testpower','fitness']].max().max()*1.02
|
||||
|
||||
if dofatigue: # pragma: no cover
|
||||
y1rangemax = df.loc[:, ['fitness', 'fatigue']].max().max()*1.02
|
||||
else:
|
||||
@@ -1957,7 +1950,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
|
||||
plot.legend.location = "top_left"
|
||||
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
startdate = datetime.datetime.combine(
|
||||
startdate, datetime.datetime.min.time())
|
||||
@@ -1977,7 +1970,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
linked_crosshair = CrosshairTool(dimensions='height')
|
||||
|
||||
hover.tooltips = OrderedDict([
|
||||
# (legend_label,'@testpower'),
|
||||
('Date', '@fdate'),
|
||||
(fitlabel, '@fitness{int}'),
|
||||
(fatiguelabel, '@fatigue{int}'),
|
||||
@@ -1987,7 +1979,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
|
||||
if showtests:
|
||||
hover.tooltips = OrderedDict([
|
||||
# (legend_label,'@testpower'),
|
||||
('Date', '@fdate'),
|
||||
(fitlabel, '@fitness{int}'),
|
||||
(fatiguelabel, '@fatigue{int}'),
|
||||
@@ -2008,7 +1999,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
plot2.vbar(x=df['date'], top=df['impulse'], color='gray')
|
||||
plot2.vbar(x=df['date'], top=0*df['testpower']+df['impulse'], color='red')
|
||||
|
||||
plot2.sizing_mode = 'scale_both'
|
||||
#plot2.sizing_mode = 'scale_both'
|
||||
plot2.yaxis.axis_label = 'Impulse'
|
||||
plot2.xaxis.axis_label = 'Date'
|
||||
|
||||
@@ -2016,7 +2007,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
plot2.add_tools(linked_crosshair)
|
||||
|
||||
mylayout = layoutcolumn([plot, plot2])
|
||||
#mylayout.sizing_mode = 'stretch_both'
|
||||
|
||||
try:
|
||||
script, div = components(mylayout)
|
||||
@@ -3566,7 +3556,7 @@ def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None,
|
||||
watermarkh = 35
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], 1.8*max(thesecs), watermarky,
|
||||
watermarkw, watermarkh,
|
||||
@@ -3895,7 +3885,7 @@ def interactive_cpchart(rower, thedistances, thesecs, theavpower,
|
||||
watermarkh = 35
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], 1.8*max(thesecs), watermarky,
|
||||
watermarkw, watermarkh,
|
||||
@@ -6838,7 +6828,7 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], watermarkx, watermarky,
|
||||
watermarkw, watermarkh,
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
dataType: 'json',
|
||||
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
console.log(data.div);
|
||||
|
||||
// var parsedJSON = $.parseJSON(data); //
|
||||
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
|
||||
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
|
||||
@@ -35,7 +36,7 @@
|
||||
console.log('done');
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
@@ -56,7 +57,7 @@
|
||||
$("#performanceform").on('change', function(evt) {
|
||||
submit_form();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user