chart fixes
This commit is contained in:
@@ -1624,12 +1624,14 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
|
||||
|
||||
df.sort_values(['date'],inplace=True)
|
||||
|
||||
|
||||
#df = df.fillna(0)
|
||||
df['testdup'] = df['testpower'].shift(1)
|
||||
df['testpower'] = df.apply(lambda x: np.nan if abs(x['testpower'] - x['testdup']) < 4 \
|
||||
else x['testpower'],axis=1)
|
||||
|
||||
#df = df.fillna(-100)
|
||||
|
||||
#print(df)
|
||||
|
||||
source = ColumnDataSource(
|
||||
data = dict(
|
||||
@@ -1644,6 +1646,7 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
|
||||
|
||||
|
||||
|
||||
|
||||
plot = Figure(tools=TOOLS,x_axis_type='datetime',
|
||||
plot_width=900,
|
||||
toolbar_location="above",
|
||||
@@ -1700,7 +1703,7 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
|
||||
plot.xaxis.major_label_orientation = pi/4
|
||||
plot.sizing_mode = 'stretch_both'
|
||||
|
||||
plot.y_range = Range1d(0,1.5*max(testpower))
|
||||
#plot.y_range = Range1d(0,1.5*max(df['testpower']))
|
||||
startdate = datetime.datetime.combine(startdate,datetime.datetime.min.time())
|
||||
enddate = datetime.datetime.combine(enddate,datetime.datetime.min.time())
|
||||
|
||||
@@ -1718,13 +1721,14 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
|
||||
|
||||
try:
|
||||
script,div = components(plot)
|
||||
except:
|
||||
except Exception as e:
|
||||
df.dropna(inplace=True,axis=0,how='any')
|
||||
return (
|
||||
'',
|
||||
'Something went wrong withthe chart ({nrworkouts} workouts, {nrdata} datapoints)'.format(
|
||||
'Something went wrong with the chart ({nrworkouts} workouts, {nrdata} datapoints, error {e})'.format(
|
||||
nrworkouts = workouts.count(),
|
||||
nrdata = len(df),
|
||||
e = e,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user