[jToolkit-cvs] jToolkit/widgets chart.py,1.26,1.27
Brought to you by:
davidfraser,
friedelwolff
From: <dav...@us...> - 2004-03-10 07:39:43
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20928 Modified Files: chart.py Log Message: Can now handle empty datasets in most cases (there seem to be cases where it fails) Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** chart.py 10 Mar 2004 07:13:30 -0000 1.26 --- chart.py 10 Mar 2004 07:14:02 -0000 1.27 *************** *** 154,159 **** self.figure.get_current_axis().set_xlim([self.startVal, self.endVal]) ! #Draw a legend ! self.figure.get_current_axis().legend(self.legendlabels,2) NUM_TIME_LABELS = 10 --- 154,160 ---- self.figure.get_current_axis().set_xlim([self.startVal, self.endVal]) ! #Draw a legend, but only if there are any plots to draw ! if self.legendlabels: ! self.figure.get_current_axis().legend(self.legendlabels,2) NUM_TIME_LABELS = 10 *************** *** 169,174 **** def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] ! self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] self.xvalues = [dates.mktime(dates.WinPyTimeToDate(row[self.xcolumn])) - self.startDateVal for row in chartdata] --- 170,179 ---- def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! if chartdata == []: #No data ! self.ydata = [] ! self.legendlabels = None ! else: ! self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] ! self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] self.xvalues = [dates.mktime(dates.WinPyTimeToDate(row[self.xcolumn])) - self.startDateVal for row in chartdata] |