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',
|
def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||||
promember=0,
|
promember=0,
|
||||||
labeldict=None):
|
labeldict=None):
|
||||||
|
|
||||||
|
message = ''
|
||||||
|
errormessage = ''
|
||||||
|
|
||||||
columns = [xparam,yparam,
|
columns = [xparam,yparam,
|
||||||
'ftime','distance','fpace',
|
'ftime','distance','fpace',
|
||||||
'power','hr','spm',
|
'power','hr','spm',
|
||||||
@@ -2483,7 +2487,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
|||||||
|
|
||||||
# check if dataframe not empty
|
# check if dataframe not empty
|
||||||
if datadf.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':
|
if xparam != 'distance' and xparam != 'time' and xparam != 'cumdist':
|
||||||
xaxmax = yaxmaxima[xparam]
|
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):
|
for id,color in itertools.izip(ids,colors):
|
||||||
group = datadf[datadf['workoutid']==int(id)].copy()
|
group = datadf[datadf['workoutid']==int(id)].copy()
|
||||||
group.sort_values(by='time',ascending=True,inplace=True)
|
group.sort_values(by='time',ascending=True,inplace=True)
|
||||||
|
try:
|
||||||
group['x'] = group[xparam]
|
group['x'] = group[xparam]
|
||||||
|
except KeyError:
|
||||||
|
group['x'] = group['time']
|
||||||
|
errormessage = xparam+' has no values. Plot invalid'
|
||||||
try:
|
try:
|
||||||
group['y'] = group[yparam]
|
group['y'] = group[yparam]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -2635,7 +2643,7 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return [script,div]
|
return [script,div,message,errormessage]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,8 @@ class StrokeData(models.Model):
|
|||||||
peakforce = models.FloatField(null=True,verbose_name='Peak Force')
|
peakforce = models.FloatField(null=True,verbose_name='Peak Force')
|
||||||
forceratio = models.FloatField(null=True,verbose_name='Average/Peak Force Ratio')
|
forceratio = models.FloatField(null=True,verbose_name='Average/Peak Force Ratio')
|
||||||
distance = models.FloatField(null=True,verbose_name='Distance')
|
distance = models.FloatField(null=True,verbose_name='Distance')
|
||||||
drivespeed = models.FloatField(null=True,verbose_name='Drive Speed')
|
drivespeed = models.FloatField(null=True,verbose_name='Drive Speed',
|
||||||
|
default=0)
|
||||||
hr_ut2 = models.IntegerField(null=True)
|
hr_ut2 = models.IntegerField(null=True)
|
||||||
hr_ut1 = models.IntegerField(null=True)
|
hr_ut1 = models.IntegerField(null=True)
|
||||||
hr_at = models.IntegerField(null=True)
|
hr_at = models.IntegerField(null=True)
|
||||||
|
|||||||
@@ -3464,6 +3464,9 @@ def multi_compare_view(request):
|
|||||||
labeldict=labeldict)
|
labeldict=labeldict)
|
||||||
script = res[0]
|
script = res[0]
|
||||||
div = res[1]
|
div = res[1]
|
||||||
|
errormessage = res[3]
|
||||||
|
if errormessage != '':
|
||||||
|
messages.error(request,errormessage)
|
||||||
|
|
||||||
return render(request,'multicompare.html',
|
return render(request,'multicompare.html',
|
||||||
{'interactiveplot':script,
|
{'interactiveplot':script,
|
||||||
|
|||||||
Reference in New Issue
Block a user