Private
Public Access
1
0

passing some tests

This commit is contained in:
Sander Roosendaal
2019-02-25 20:03:23 +01:00
parent 555b456da1
commit e543411dbc
26 changed files with 1332 additions and 1315 deletions

View File

@@ -20,19 +20,24 @@ from bokeh.palettes import Dark2_8 as palette
import itertools
from bokeh.plotting import figure, ColumnDataSource, Figure,curdoc
from bokeh.models import CustomJS,Slider, TextInput,BoxAnnotation
from bokeh.charts import Histogram,HeatMap,Area,BoxPlot,Bar
from bokeh.charts.attributes import CatAttr
try:
from bokeh.charts import Histogram,HeatMap,Area,BoxPlot,Bar
from bokeh.charts.attributes import CatAttr
except:
pass
from bokeh.resources import CDN,INLINE
from bokeh.embed import components
from bokeh.layouts import layout,widgetbox
from bokeh.layouts import row as layoutrow
from bokeh.layouts import column as layoutcolumn
from bokeh.models import LinearAxis,LogAxis,Range1d,DatetimeTickFormatter,HoverTool
from bokeh.io import output_file, show, vplot
#from bokeh.io import output_file, show, vplot
from bokeh.models import (
GMapPlot, GMapOptions, ColumnDataSource, Circle,
DataRange1d, PanTool, WheelZoomTool, BoxSelectTool,
SaveTool, ResizeTool, ResetTool, TapTool,CrosshairTool,BoxZoomTool,
SaveTool, # ResizeTool,
ResetTool, TapTool,CrosshairTool,BoxZoomTool,
Span, Label
)
from bokeh.models.glyphs import ImageURL
@@ -178,7 +183,7 @@ def interactive_boxchart(datadf,fieldname,extratitle=''):
if datadf.empty:
return '','It looks like there are no data matching your filter'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,resize,hover'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,hover'
plot = BoxPlot(datadf, values=fieldname, label='date',
legend=False,
@@ -353,7 +358,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type'):
return script,div
def interactive_forcecurve(theworkouts,workstrokesonly=False):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
ids = [int(w.id) for w in theworkouts]
@@ -746,7 +751,7 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower'):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(tools=TOOLS,toolbar_location="above",
toolbar_sticky=False,width=900,
@@ -810,7 +815,7 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower'):
return [script,div]
def interactive_histoall(theworkouts):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
ids = [int(w.id) for w in theworkouts]
@@ -1489,7 +1494,7 @@ def interactive_agegroupcpchart(age,normalized=False):
x_axis_type = 'log'
y_axis_type = 'linear'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(plot_width=900,x_axis_type=x_axis_type,
tools=TOOLS)
@@ -1536,7 +1541,7 @@ def interactive_otwcpchart(powerdf,promember=0,rowername=""):
powerdf = powerdf[~(powerdf == 0).any(axis=1)]
# plot tools
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -1672,7 +1677,7 @@ def interactive_agegroup_plot(df,distance=2000,duration=None,
)
)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(tools=TOOLS,plot_width=900)
plot.sizing_mode='scale_width'
@@ -1704,7 +1709,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
message = 0
# plot tools
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -2038,7 +2043,7 @@ def interactive_windchart(id=0,promember=0):
# plot tools
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
@@ -2108,7 +2113,7 @@ def interactive_streamchart(id=0,promember=0):
# plot tools
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
@@ -2135,7 +2140,7 @@ def interactive_streamchart(id=0,promember=0):
def interactive_chart(id=0,promember=0,intervaldata = {}):
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -2343,7 +2348,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
if groupby != 'date':
hover = HoverTool(names=['data'],
@@ -2363,7 +2368,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
hover.mode = 'mouse'
TOOLS = [SaveTool(),PanTool(),BoxZoomTool(),WheelZoomTool(),
ResetTool(),TapTool(),ResizeTool(),hover]
ResetTool(),TapTool(),hover]
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
@@ -2591,7 +2596,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
@@ -3006,7 +3011,7 @@ def interactive_flex_chart2(id=0,promember=0,
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -3617,7 +3622,7 @@ def interactive_bar_chart(id=0,promember=0):
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -3776,7 +3781,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
@@ -3820,8 +3825,13 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
cntr = 0
l1 = []
for id,color in itertools.izip(ids,colors):
try:
items = itertools.izip(ids,colors)
except AttributeError:
items = zip(ids,colors)
for id,color in items:
group = datadf[datadf['workoutid']==int(id)].copy()
@@ -3998,7 +4008,7 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
spm2 = rowdata2.loc[:,'spm']
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
@@ -4163,7 +4173,7 @@ def interactive_otw_advanced_pace_chart(id=0,promember=0):
# Add hover to this comma-separated string and see what changes
if (promember==1):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'