Private
Public Access
1
0

v2 new flex

This commit is contained in:
Sander Roosendaal
2020-11-05 21:59:50 +01:00
parent c418799e47
commit 17477fe43a

View File

@@ -4550,10 +4550,182 @@ def interactive_flexchart_stacked(id,r,xparam='time',
rowdata
)
plot1 = Figure(x_axis_type=x_axis_type,y_axis_type=y1_axis_type,plot_width=920,plot_height=150)
plot2 = Figure(x_axis_type=x_axis_type,y_axis_type=y2_axis_type,plot_width=920,plot_height=150)
plot3 = Figure(x_axis_type=x_axis_type,y_axis_type=y3_axis_type,plot_width=920,plot_height=150)
plot4 = Figure(x_axis_type=x_axis_type,y_axis_type=y4_axis_type,plot_width=920,plot_height=150)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover'
plot1 = Figure(x_axis_type=x_axis_type,y_axis_type=y1_axis_type,plot_width=920,plot_height=150,
tools=TOOLS,toolbar_location='above')
plot2 = Figure(x_axis_type=x_axis_type,y_axis_type=y2_axis_type,plot_width=920,plot_height=150,
tools=TOOLS,toolbar_location=None)
plot3 = Figure(x_axis_type=x_axis_type,y_axis_type=y3_axis_type,plot_width=920,plot_height=150,
tools=TOOLS,toolbar_location=None)
plot4 = Figure(x_axis_type=x_axis_type,y_axis_type=y4_axis_type,plot_width=920,plot_height=150,
tools=TOOLS,toolbar_location=None)
linked_crosshair = CrosshairTool(dimensions="height")
plot1.add_tools(linked_crosshair)
plot2.add_tools(linked_crosshair)
plot3.add_tools(linked_crosshair)
plot4.add_tools(linked_crosshair)
try:
xaxlabel = axlabels[xparam]
except KeyError:
xaxlabel = xparam
try:
yax1label = axlabels[yparam1]
except KeyError:
yax1label = yparam1
plot1.yaxis.axis_label = yax1label
try:
xaxlabel = axlabels[xparam]
except KeyError:
xaxlabel = xparam
try:
yax2label = axlabels[yparam2]
except KeyError:
yax2label = yparam2
plot2.yaxis.axis_label = yax2label
try:
xaxlabel = axlabels[xparam]
except KeyError:
xaxlabel = xparam
try:
yax3label = axlabels[yparam3]
except KeyError:
yax3label = yparam3
plot3.yaxis.axis_label = yax3label
try:
xaxlabel = axlabels[xparam]
except KeyError:
xaxlabel = xparam
try:
yax4label = axlabels[yparam4]
except KeyError:
yax4label = yparam4
try:
xaxlabel = axlabels[xparam]
except KeyError:
xaxlabel = xparam
plot4.yaxis.axis_label = yax4label
plot4.xaxis.axis_label = xaxlabel
if xparam == 'time':
xrange1 = Range1d(start=xaxmin,end=xaxmax)
plot1.x_range = xrange1
plot2.x_range = xrange1
plot3.x_range = xrange1
plot4.x_range = xrange1
plot4.xaxis[0].formatter = DatetimeTickFormatter(
hours = ["%H"],
minutes = ["%M"],
seconds = ["%S"],
days = ["0"],
months = [""],
years = [""]
)
hover1 = plot1.select(dict(type=HoverTool))
hover2 = plot2.select(dict(type=HoverTool))
hover3 = plot3.select(dict(type=HoverTool))
hover4 = plot4.select(dict(type=HoverTool))
if yparam1 == 'pace':
y1tooltip = '@fpace'
else:
y1tooltip = '@{yparam1}'.format(yparam1=yparam1)
if metricsdicts[yparam1]['numtype'] == 'integer' or yparam1 == 'power':
y1tooltip+='{int}'
else:
y1tooltip+='{0.00}'
if yparam2 == 'pace':
y2tooltip = '@fpace'
else:
y2tooltip = '@{yparam2}'.format(yparam2=yparam2)
if metricsdicts[yparam2]['numtype'] == 'integer' or yparam2 == 'power':
y2tooltip+='{int}'
else:
y2tooltip+='{0.00}'
if yparam3 == 'pace':
y3tooltip = '@fpace'
else:
y3tooltip = '@{yparam3}'.format(yparam3=yparam3)
if metricsdicts[yparam3]['numtype'] == 'integer' or yparam3 == 'power':
y3tooltip+='{int}'
else:
y3tooltip+='{0.00}'
if yparam4 == 'pace':
y4tooltip = '@fpace'
else:
y4tooltip = '@{yparam4}'.format(yparam4=yparam4)
if metricsdicts[yparam4]['numtype'] == 'integer' or yparam4 == 'power':
y4tooltip+='{int}'
else:
y4tooltip+='{0.00}'
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'
y1min = get_yaxminima(r,yparam1,mode)
y2min = get_yaxminima(r,yparam2,mode)