fix bug
This commit is contained in:
@@ -278,7 +278,12 @@ def interactive_workouttype_piechart(workouts):
|
|||||||
|
|
||||||
data = pd.Series(datadict).reset_index(name='value').rename(columns={'index':'type'})
|
data = pd.Series(datadict).reset_index(name='value').rename(columns={'index':'type'})
|
||||||
data['angle'] = data['value']/data['value'].sum() * 2*pi
|
data['angle'] = data['value']/data['value'].sum() * 2*pi
|
||||||
data['color'] = Category20c[len(datadict)]
|
if len(datadict)>2:
|
||||||
|
data['color'] = Category20c[len(datadict)]
|
||||||
|
elif len(datadict)==2:
|
||||||
|
data['color'] = ['orange','lightblue']
|
||||||
|
else:
|
||||||
|
data['color'] = ['lightblue']
|
||||||
data['totaltime'] = pd.Series([pretty_timedelta(v) for v in data['value']])
|
data['totaltime'] = pd.Series([pretty_timedelta(v) for v in data['value']])
|
||||||
|
|
||||||
p = figure(plot_height=350, title="Types", toolbar_location=None,
|
p = figure(plot_height=350, title="Types", toolbar_location=None,
|
||||||
|
|||||||
Reference in New Issue
Block a user