first version actual/executed chart for plan
This commit is contained in:
@@ -232,6 +232,37 @@ def interactive_boxchart(datadf,fieldname,extratitle='',
|
||||
|
||||
return script,div
|
||||
|
||||
|
||||
def interactive_planchart(data,startdate,enddate):
|
||||
source = ColumnDataSource(data)
|
||||
|
||||
hv.extension('bokeh')
|
||||
|
||||
|
||||
yaxmaximum = data['executed'].max()
|
||||
if data['planned'].max() > yaxmaximum:
|
||||
yaxmaximum = data['planned'].max()
|
||||
|
||||
yrange1 = Range1d(start=0,end=1.1*yaxmaximum)
|
||||
|
||||
|
||||
tidy_df = data.melt(id_vars=['startdate'],value_vars=['planned','executed'])
|
||||
bars = hv.Bars(tidy_df,['startdate','variable'],['value'])
|
||||
bars.opts(
|
||||
opts.Bars(show_legend=True,tools=['tap','hover'],legend_position='bottom',show_frame=True))
|
||||
|
||||
p = hv.render(bars)
|
||||
|
||||
p.plot_width=550
|
||||
p.plot_height=350
|
||||
p.y_range = yrange1
|
||||
p.toolbar_location = 'above'
|
||||
p.sizing_mode = 'scale_width'
|
||||
|
||||
script,div = components(p)
|
||||
|
||||
return script,div
|
||||
|
||||
def interactive_activitychart(workouts,startdate,enddate,stack='type'):
|
||||
|
||||
dates = []
|
||||
@@ -352,7 +383,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type'):
|
||||
|
||||
p.plot_width=550
|
||||
p.plot_height=350
|
||||
p.toolbar_location = None
|
||||
p.toolbar_location = 'above'
|
||||
p.sizing_mode = 'scale_width'
|
||||
url = "http://rowsandall.com/rowers/workout/@duration/"
|
||||
taptool = p.select(type=TapTool)
|
||||
|
||||
Reference in New Issue
Block a user