bug fix multi compare with invalid x axis
This commit is contained in:
@@ -2461,6 +2461,10 @@ def interactive_bar_chart(id=0,promember=0):
|
||||
def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
promember=0,
|
||||
labeldict=None):
|
||||
|
||||
message = ''
|
||||
errormessage = ''
|
||||
|
||||
columns = [xparam,yparam,
|
||||
'ftime','distance','fpace',
|
||||
'power','hr','spm',
|
||||
@@ -2483,7 +2487,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
|
||||
# check if dataframe not empty
|
||||
if datadf.empty:
|
||||
return ['','<p>No non-zero data in selection</p>','','']
|
||||
return ['','<p>No non-zero data in selection</p>','','No non-zero data in selection']
|
||||
|
||||
if xparam != 'distance' and xparam != 'time' and xparam != 'cumdist':
|
||||
xaxmax = yaxmaxima[xparam]
|
||||
@@ -2555,7 +2559,11 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
for id,color in itertools.izip(ids,colors):
|
||||
group = datadf[datadf['workoutid']==int(id)].copy()
|
||||
group.sort_values(by='time',ascending=True,inplace=True)
|
||||
group['x'] = group[xparam]
|
||||
try:
|
||||
group['x'] = group[xparam]
|
||||
except KeyError:
|
||||
group['x'] = group['time']
|
||||
errormessage = xparam+' has no values. Plot invalid'
|
||||
try:
|
||||
group['y'] = group[yparam]
|
||||
except KeyError:
|
||||
@@ -2635,7 +2643,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
|
||||
|
||||
|
||||
return [script,div]
|
||||
return [script,div,message,errormessage]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user