Private
Public Access
1
0

fixing sizing mode

This commit is contained in:
Sander Roosendaal
2020-11-09 14:39:26 +01:00
parent 4b1599fcdf
commit 57c793c90a

View File

@@ -351,7 +351,7 @@ def interactive_boxchart(datadf,fieldname,extratitle='',
yrange1 = Range1d(start=yaxminima[fieldname],end=yaxmaxima[fieldname])
plot.y_range = yrange1
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.xaxis.axis_label = 'Date'
plot.yaxis.axis_label = axlabels[fieldname]
@@ -419,7 +419,7 @@ def interactive_planchart(data,startdate,enddate):
p.plot_height=350
p.y_range = yrange1
p.toolbar_location = 'above'
p.sizing_mode = 'scale_width'
p.sizing_mode = 'stretch_both'
script,div = components(p)
@@ -586,7 +586,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type',toolbar_lo
p.plot_height=350
p.toolbar_location = toolbar_location
p.y_range.start = 0
p.sizing_mode = 'scale_width'
p.sizing_mode = 'stretch_both'
url = "http://rowsandall.com/rowers/workout/@duration/"
taptool = p.select(type=TapTool)
@@ -764,7 +764,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
p.plot_width=550
p.plot_height=350
p.toolbar_location = toolbar_location
p.sizing_mode = 'scale_width'
p.sizing_mode = 'stretch_both'
p.y_range.start = 0
url = "http://rowsandall.com/rowers/workout/@duration/"
taptool = p.select(type=TapTool)
@@ -1116,6 +1116,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
plot = Figure(tools=TOOLS,
toolbar_sticky=False,toolbar_location="above",plot_width=800,plot_height=600)
plot.sizing_mode = 'stretch_both'
# add watermark
watermarkurl = "/static/img/logo7.png"
@@ -1131,7 +1132,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.image_url([watermarkurl],watermarkx,watermarky,
watermarkw,watermarkh,
@@ -1451,57 +1452,68 @@ def interactive_forcecurve(theworkouts,workstrokesonly=True,plottype='scatter'):
sourcemultiline.change.emit();
""")
annotation = TextInput(width=200, title="Type your plot notes here", value="")
annotation = TextInput(width=140, title="Type your plot notes here", value="")
annotation.js_on_change('value',callback)
callback.args["annotation"] = annotation
slider_spm_min = Slider(width=200, start=15.0, end=55,value=15.0, step=.1,
slider_spm_min = Slider(width=140, start=15.0, end=55,value=15.0, step=.1,
title="Min SPM")
slider_spm_min.js_on_change('value',callback)
callback.args["minspm"] = slider_spm_min
slider_spm_max = Slider(width=200, start=15.0, end=55,value=55.0, step=.1,
slider_spm_max = Slider(width=140, start=15.0, end=55,value=55.0, step=.1,
title="Max SPM")
slider_spm_max.js_on_change('value',callback)
callback.args["maxspm"] = slider_spm_max
slider_work_min = Slider(width=200, start=0, end=1500,value=0, step=10,
slider_work_min = Slider(width=140, start=0, end=1500,value=0, step=10,
title="Min Work per Stroke")
slider_work_min.js_on_change('value',callback)
callback.args["minwork"] = slider_work_min
slider_work_max = Slider(width=200, start=0, end=1500,value=1500, step=10,
slider_work_max = Slider(width=140, start=0, end=1500,value=1500, step=10,
title="Max Work per Stroke")
slider_work_max.js_on_change('value',callback)
callback.args["maxwork"] = slider_work_max
distmax = 100+100*int(rowdata['distance'].max()/100.)
slider_dist_min = Slider(width=200, start=0,end=distmax,value=0,step=50,
slider_dist_min = Slider(width=140, start=0,end=distmax,value=0,step=50,
title="Min Distance")
slider_dist_min.js_on_change('value',callback)
callback.args["mindist"] = slider_dist_min
slider_dist_max = Slider(width=200, start=0,end=distmax,value=distmax,
slider_dist_max = Slider(width=140, start=0,end=distmax,value=distmax,
step=50,
title="Max Distance")
slider_dist_max.js_on_change('value',callback)
callback.args["maxdist"] = slider_dist_max
layout = layoutrow([layoutcolumn([annotation,
annotation.sizing_mode = 'fixed'
slider_spm_min.sizing_mode = 'fixed'
slider_spm_max.sizing_mode = 'fixed'
slider_work_min.sizing_mode = 'fixed'
slider_work_max.sizing_mode = 'fixed'
slider_dist_min.sizing_mode = 'fixed'
slider_dist_max.sizing_mode = 'fixed'
thesliders = layoutcolumn([annotation,
slider_spm_min,
slider_spm_max,
slider_dist_min,
slider_dist_max,
slider_work_min,
slider_work_max,
],
),
]
)
thesliders.sizing_mode = 'fixed'
layout = layoutrow([thesliders,
plot])
layout.sizing_mode = 'scale_width'
layout.sizing_mode = 'stretch_both'
script, div = components(layout)
js_resources = INLINE.render_js()
@@ -1648,7 +1660,7 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower',startdate=None,
)
plot.xaxis.major_label_orientation = pi/4
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.y_range = Range1d(0,1.5*max(power4min))
if not startdate:
@@ -1780,7 +1792,7 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes,
plot.add_layout(LinearAxis(y_range_name="fraction",
axis_label="Cumulative % of strokes"),'right')
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
annolabel = Label(x=50,y=450,x_units='screen',y_units='screen',
text='',
@@ -1798,7 +1810,7 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes,
annolabel.text = annotation
""")
annotation = TextInput(width=200, title="Type your plot notes here", value="")
annotation = TextInput(width=140, title="Type your plot notes here", value="")
annotation.js_on_change('value',callback)
callback.args["annotation"] = annotation
@@ -2852,7 +2864,7 @@ def interactive_agegroupcpchart(age,normalized=False):
plot = Figure(plot_width=900,x_axis_type=x_axis_type,
tools=TOOLS)
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.line('duration','fitpowerfh',source=source,
legend_label='Female HW',color='blue')
@@ -2971,7 +2983,7 @@ def interactive_otwcpchart(powerdf,promember=0,rowername="",r=None,cpfit='data',
watermarkh = 35
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
@@ -3071,7 +3083,7 @@ def interactive_agegroup_plot(df,distance=2000,duration=None,
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(tools=TOOLS,plot_width=900)
plot.sizing_mode='scale_width'
plot.sizing_mode='stretch_both'
plot.circle('age','power',source=source,fill_color='red',size=15,
legend_label='World Record')
@@ -3280,7 +3292,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
watermarkh = 35
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],1.8*max(thesecs),watermarky,
watermarkw,watermarkh,
@@ -3467,7 +3479,7 @@ def interactive_windchart(id=0,promember=0):
plot.xaxis.axis_label = "Distance (m)"
plot.yaxis.axis_label = "Wind Speed (m/s)"
plot.y_range = Range1d(-7,7)
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.extra_y_ranges = {"winddirection": Range1d(start=0,end=360)}
@@ -3538,7 +3550,7 @@ def interactive_streamchart(id=0,promember=0):
plot.xaxis.axis_label = "Distance (m)"
plot.yaxis.axis_label = "River Current (m/s)"
plot.y_range = Range1d(-2,2)
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
script, div = components(plot)
@@ -3616,7 +3628,7 @@ def interactive_chart(id=0,promember=0,intervaldata = {}):
plot.line('time','pace',source=source,legend_label="Pace",name="pace")
plot.title.text = row.name
plot.title.text_font_size=value("1.0em")
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.xaxis.axis_label = "Time"
plot.yaxis.axis_label = "Pace (/500m)"
plot.xaxis[0].formatter = DatetimeTickFormatter(
@@ -3921,7 +3933,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
plot.title.text = title
plot.title.text_font_size=value("1.0em")
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],watermarkx,watermarky,
watermarkw,watermarkh,
@@ -4170,7 +4182,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],watermarkx,watermarky,
watermarkw,watermarkh,
@@ -4366,24 +4378,24 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
source2.change.emit();
""")
slider_spm_min = Slider(width=200, start=15.0, end=55,value=15.0, step=.1,
slider_spm_min = Slider(width=140, start=15.0, end=55,value=15.0, step=.1,
title="Min SPM")
slider_spm_min.js_on_change('value',callback)
callback.args["minspm"] = slider_spm_min
slider_spm_max = Slider(width=200, start=15.0, end=55,value=55.0, step=.1,
slider_spm_max = Slider(width=140, start=15.0, end=55,value=55.0, step=.1,
title="Max SPM")
slider_spm_max.js_on_change('value',callback)
callback.args["maxspm"] = slider_spm_max
slider_work_min = Slider(width=200, start=0.0, end=1500,value=0.0, step=10,
slider_work_min = Slider(width=140, start=0.0, end=1500,value=0.0, step=10,
title="Min Work per Stroke")
slider_work_min.js_on_change('value',callback)
callback.args["minwork"] = slider_work_min
slider_work_max = Slider(width=200, start=0.0, end=1500,value=1500.0, step=10,
slider_work_max = Slider(width=140, start=0.0, end=1500,value=1500.0, step=10,
title="Max Work per Stroke")
slider_work_max.js_on_change('value',callback)
callback.args["maxwork"] = slider_work_max
@@ -4393,28 +4405,39 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
except KeyError:
distmax = 1000.
slider_dist_min = Slider(width=200, start=0,end=distmax,value=0,step=50,
slider_dist_min = Slider(width=140, start=0,end=distmax,value=0,step=50,
title="Min Distance")
slider_dist_min.js_on_change('value',callback)
callback.args["mindist"] = slider_dist_min
slider_dist_max = Slider(width=200, start=0,end=distmax,value=distmax,
slider_dist_max = Slider(width=140, start=0,end=distmax,value=distmax,
step=50,
title="Max Distance")
slider_dist_max.js_on_change('value',callback)
callback.args["maxdist"] = slider_dist_max
layout = layoutrow([layoutcolumn([slider_spm_min,
slider_spm_min.sizing_mode = 'fixed'
slider_spm_max.sizing_mode = 'fixed'
slider_work_min.sizing_mode = 'fixed'
slider_work_max.sizing_mode = 'fixed'
slider_dist_min.sizing_mode = 'fixed'
slider_dist_max.sizing_mode = 'fixed'
thesliders = layoutcolumn([slider_spm_min,
slider_spm_max,
slider_dist_min,
slider_dist_max,
slider_work_min,
slider_work_max,
],
),
)
thesliders.sizing_mode = 'fixed'
layout = layoutrow([thesliders,
plot])
layout.sizing_mode = 'scale_width'
layout.sizing_mode = 'stretch_both'
script, div = components(layout)
js_resources = INLINE.render_js()
@@ -4583,6 +4606,11 @@ def interactive_flexchart_stacked(id,r,xparam='time',
plot2.xaxis.visible=False
plot3.xaxis.visible=False
plot1.sizing_mode = 'stretch_both'
plot2.sizing_mode = 'stretch_both'
plot3.sizing_mode = 'stretch_both'
plot4.sizing_mode = 'stretch_both'
linked_crosshair = CrosshairTool(dimensions="height")
plot1.add_tools(linked_crosshair)
plot2.add_tools(linked_crosshair)
@@ -4814,7 +4842,7 @@ def interactive_flexchart_stacked(id,r,xparam='time',
plot4,
])
layout.sizing_mode = 'scale_width'
layout.sizing_mode = 'stretch_both'
script, div = components(layout)
@@ -5040,7 +5068,7 @@ def interactive_flex_chart2(id,r,promember=0,
tools=TOOLS,toolbar_location='above',
toolbar_sticky=False,plot_width=800,plot_height=600,
)
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
#plot.width_policy = 'max'
@@ -5058,7 +5086,7 @@ def interactive_flex_chart2(id,r,promember=0,
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],watermarkx,watermarky,
watermarkw,watermarkh,
@@ -5150,7 +5178,7 @@ def interactive_flex_chart2(id,r,promember=0,
plot.title.text = row.name
plot.title.text_font_size=value("1.0em")
plot.sizing_mode = 'stretch_height'
plot.sizing_mode = 'stretch_both'
plot.xaxis.axis_label = xaxlabel
plot.yaxis.axis_label = yaxlabel
@@ -5375,28 +5403,28 @@ def interactive_flex_chart2(id,r,promember=0,
source2.change.emit();
""")
annotation = TextInput(width=200, title="Type your plot notes here", value="")
annotation = TextInput(width=140, title="Type your plot notes here", value="")
annotation.js_on_change('value',callback)
callback.args["annotation"] = annotation
slider_spm_min = Slider(width=200, start=15.0, end=55,value=15.0, step=.1,
slider_spm_min = Slider(width=140, start=15.0, end=55,value=15.0, step=.1,
title="Min SPM")
slider_spm_min.js_on_change('value',callback)
callback.args["minspm"] = slider_spm_min
slider_spm_max = Slider(width=200, start=15.0, end=55,value=55.0, step=.1,
slider_spm_max = Slider(width=140, start=15.0, end=55,value=55.0, step=.1,
title="Max SPM")
slider_spm_max.js_on_change('value',callback)
callback.args["maxspm"] = slider_spm_max
slider_work_min = Slider(width=200, start=0.0, end=1500,value=0.0, step=10,
slider_work_min = Slider(width=140, start=0.0, end=1500,value=0.0, step=10,
title="Min Work per Stroke")
slider_work_min.js_on_change('value',callback)
callback.args["minwork"] = slider_work_min
slider_work_max = Slider(width=200, start=0.0, end=1500,value=1500.0, step=10,
slider_work_max = Slider(width=140, start=0.0, end=1500,value=1500.0, step=10,
title="Max Work per Stroke")
slider_work_max.js_on_change('value',callback)
callback.args["maxwork"] = slider_work_max
@@ -5406,17 +5434,25 @@ def interactive_flex_chart2(id,r,promember=0,
except (KeyError,ValueError):
distmax = 100
slider_dist_min = Slider(width=200, start=0,end=distmax,value=0,step=50,
slider_dist_min = Slider(width=140, start=0,end=distmax,value=0,step=50,
title="Min Distance")
slider_dist_min.js_on_change('value',callback)
callback.args["mindist"] = slider_dist_min
slider_dist_max = Slider(width=200, start=0,end=distmax,value=distmax,
slider_dist_max = Slider(width=140, start=0,end=distmax,value=distmax,
step=50,
title="Max Distance")
slider_dist_max.js_on_change('value',callback)
callback.args["maxdist"] = slider_dist_max
annotation.sizing_mode = 'fixed'
slider_spm_min.sizing_mode = 'fixed'
slider_spm_max.sizing_mode = 'fixed'
slider_work_min.sizing_mode = 'fixed'
slider_work_max.sizing_mode = 'fixed'
slider_dist_min.sizing_mode = 'fixed'
slider_dist_max.sizing_mode = 'fixed'
thesliders = layoutcolumn([
annotation,
slider_spm_min,
@@ -5427,13 +5463,13 @@ def interactive_flex_chart2(id,r,promember=0,
slider_work_max,
])
thesliders.sizing_mode = 'scale_width'
thesliders.sizing_mode = 'fixed'
layout = layoutrow([thesliders,
plot])
# layout.sizing_mode = 'scale_width'
layout.sizing_mode = 'scale_width'
# layout.sizing_mode = 'stretch_both'
layout.sizing_mode = 'stretch_both'
script, div = components(layout)
js_resources = INLINE.render_js()
@@ -5588,14 +5624,14 @@ def thumbnail_flex_chart(rowdata,id=0,promember=0,
)
sizing_mode = 'fixed' # 'scale_width' also looks nice with this example
sizing_mode = 'fixed' # 'stretch_both' also looks nice with this example
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
plot_width=200,plot_height=150,
)
# plot.sizing_mode = 'scale_width'
# plot.sizing_mode = 'stretch_both'
plot.sizing_mode = 'fixed'
plot.toolbar.logo = None
plot.toolbar_location = None
@@ -5717,7 +5753,7 @@ def interactive_bar_chart(id=0,promember=0):
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],0.01,0.99,
watermarkw,watermarkh,
@@ -5912,7 +5948,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],0.05,0.9,
@@ -6210,7 +6246,7 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
watermarkanchor = 'bottom_right'
plot.extra_y_ranges = {"watermark": watermarkrange}
plot.extra_x_ranges = {"watermark": watermarkrange}
plot.sizing_mode = 'scale_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],0.05,watermarky,
watermarkw,watermarkh,
@@ -6355,7 +6391,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_width'
plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl],watermarkx,watermarky,
watermarkw,watermarkh,