From 393dc6bbf8bfe45bdd2f4c26d5239c6a2fad7a17 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 23 Feb 2017 15:16:41 +0100 Subject: [PATCH] compare fixed --- rowers/interactiveplots.py | 68 ++++++++++++++------------------------ 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 02a2e6d0..27a56367 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1837,8 +1837,29 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', plot_width=920, toolbar_sticky=False) + TIPS = OrderedDict([ + ('time','@ftime1'), + ('pace','@fpace1'), + ('hr','@hr1'), + ('spm','@spm1{1.1}'), + ('distance','@distance1{5}'), + ]) + TIPS2 = OrderedDict([ + ('time','@ftime2'), + ('pace','@fpace2'), + ('hr','@hr2'), + ('spm','@spm2{1.1}'), + ('distance','@distance2{5}'), + ]) + + hover1 = plot.select(type=HoverTool) + hover1.tooltips = TIPS + hover2 = plot.select(type=HoverTool) + hover2.tooltips = TIPS2 + + if plottype=='line': l1 = plot.line('x1','y1',source=source1, color="blue",legend=row1.name, @@ -1854,6 +1875,8 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', fill_alpha=0.4, line_color=None,color="red") + plot.add_tools(HoverTool(renderers=[l1],tooltips=TIPS)) + plot.add_tools(HoverTool(renderers=[l2],tooltips=TIPS2)) plot.legend.location = "bottom_right" plot.title.text = row1.name+' vs '+row2.name @@ -1880,50 +1903,7 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', plot.y_range = Range1d(ymin,ymax) - TIPS = OrderedDict([ - ('time1','@ftime1'), - ('pace1','@fpace1'), - ('hr1','@hr1'), - ('spm1','@spm1{1.1}'), - ('distance1','@distance1{5}'), - ]) - TIPS2 = OrderedDict([ - ('time2','@ftime2'), - ('pace2','@fpace2'), - ('hr2','@hr2'), - ('spm2','@spm2{1.1}'), - ('distance2','@distance2{5}'), - ]) - - - plot.add_tools(HoverTool(renderers=[l1],tooltips=TIPS)) - plot.add_tools(HoverTool(renderers=[l2],tooltips=TIPS2)) -# hover1 = plot.select(dict(type=HoverTool)) -# hover2 = plot.select(dict(type=HoverTool)) - -# hover1.renderers = [l1] -# hover2.renderers = [l2] - -# hover1.tooltips = OrderedDict([ -# ('time1','@ftime1'), -# ('pace1','@fpace1'), -# ('hr1','@hr1'), -# ('spm1','@spm1{1.1}'), -# ('distance1','@distance1{5}'), -# ]) - -# hover2.tooltips = OrderedDict([ -# ('time2','@ftime2'), -# ('pace2','@fpace2'), -# ('hr2','@hr2'), -# ('spm2','@spm2{1.1}'), -# ('distance2','@distance2{5}'), -# ]) - - -# hover1.mode = 'mouse' -# hover2.mode = 'mouse' - + script, div = components(plot) return [script,div]