adding first pie chart
This commit is contained in:
@@ -169,6 +169,80 @@ def tailwind(bearing,vwind,winddir):
|
||||
from rowers.dataprep import nicepaceformat,niceformat
|
||||
from rowers.dataprep import timedeltaconv
|
||||
|
||||
from math import pi
|
||||
|
||||
def interactive_hr_piechart(df,rower,title):
|
||||
|
||||
df.sort_values(by='hr',inplace=True)
|
||||
qry = 'hr < {ut2}'.format(ut2=rower.ut2)
|
||||
frac_lut2 = len(df.query(qry))/len(df)
|
||||
|
||||
qry = 'hr < {ut1}'.format(ut1=rower.ut1,ut2=rower.ut2)
|
||||
frac_ut2 = len(df.query(qry))/len(df)
|
||||
|
||||
qry = 'hr < {at}'.format(ut1=rower.ut1,at=rower.at)
|
||||
frac_ut1 = len(df.query(qry))/len(df)
|
||||
|
||||
qry = 'hr < {tr}'.format(at=rower.at,tr=rower.tr)
|
||||
frac_at = len(df.query(qry))/len(df)
|
||||
|
||||
qry = 'hr < {an}'.format(tr=rower.tr,an=rower.an)
|
||||
frac_tr = len(df.query(qry))/len(df)
|
||||
|
||||
frac_an = 1.
|
||||
|
||||
source_starts = 2*pi*pd.Series([
|
||||
0,
|
||||
frac_lut2,
|
||||
frac_ut2,
|
||||
frac_ut1,
|
||||
frac_at,
|
||||
frac_tr,
|
||||
])
|
||||
|
||||
source_ends = 2*pi*pd.Series([
|
||||
frac_lut2,
|
||||
frac_ut2,
|
||||
frac_ut1,
|
||||
frac_at,
|
||||
frac_tr,
|
||||
frac_an,
|
||||
])
|
||||
|
||||
source_legends = [
|
||||
'<ut2',
|
||||
'ut2',
|
||||
'ut1',
|
||||
'at',
|
||||
'tr',
|
||||
'an',
|
||||
]
|
||||
|
||||
colors = ['gray','yellow','lime','blue','purple','red']
|
||||
|
||||
|
||||
size=220
|
||||
TOOLS = 'save'
|
||||
|
||||
z = figure(title="HR "+title, x_range=(-1,1), y_range=(-1,1), width=size, height=size,
|
||||
tools=TOOLS,
|
||||
)
|
||||
|
||||
for start, end , legend, color in zip(source_starts, source_ends, source_legends, colors[0:len(source_starts)]):
|
||||
z.wedge(x=0, y=0, radius=1, start_angle=start, end_angle=end, color=color, legend=legend)
|
||||
|
||||
|
||||
|
||||
z.toolbar_location = 'right'
|
||||
z.legend.visible = False
|
||||
z.axis.visible = False
|
||||
z.xgrid.grid_line_color = None
|
||||
z.ygrid.grid_line_color = None
|
||||
z.outline_line_color = None
|
||||
|
||||
return components(z)
|
||||
|
||||
|
||||
def interactive_boxchart(datadf,fieldname,extratitle='',
|
||||
spmmin=0,spmmax=0,workmin=0,workmax=0):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user