Update of /cvsroot/jtoolkit/jToolkit/widgets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18082
Modified Files:
chart.py
Log Message:
Tweaked the chart separation. Created a legend chart from a bar chart
Index: chart.py
===================================================================
RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** chart.py 10 Feb 2004 08:24:56 -0000 1.6
--- chart.py 10 Feb 2004 08:25:21 -0000 1.7
***************
*** 15,26 ****
# This class is just a container for option values.
class Chart(widgets.PlainContents):
! def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None):
self.charttable = charttable
- self.chartType = gdchart.GDC_LINE
- self.xcolumn = xcolumn
- self.ycolumns = ycolumns
- self.xstorageformat = xstorageformat
- self.xdisplay = xdisplay
self.filter = filter
if not hasattr(self, 'chartSize'):
self.chartSize = (250,250)
--- 15,23 ----
# This class is just a container for option values.
class Chart(widgets.PlainContents):
! def __init__(self, charttable, filter=None):
self.charttable = charttable
self.filter = filter
+ if not hasattr(self, 'chartType'):
+ self.chartType = gdchart.GDC_LINE
if not hasattr(self, 'chartSize'):
self.chartSize = (250,250)
***************
*** 53,57 ****
class LineChart(Chart):
def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None):
! Chart.__init__(self, charttable, xcolumn, ycolumns, xstorageformat, xdisplay, filter)
def getdata(self):
--- 50,58 ----
class LineChart(Chart):
def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None):
! self.xcolumn = xcolumn
! self.ycolumns = ycolumns
! self.xstorageformat = xstorageformat
! self.xdisplay = xdisplay
! Chart.__init__(self, charttable, filter)
def getdata(self):
***************
*** 63,64 ****
--- 64,81 ----
self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns]
+ class CurrentValueLegendChart(Chart):
+ """This class creates a bar chart which acts as a legend and a current value reporter"""
+ def __init__(self, charttable, xcolumns, colours, filter=None):
+ self.xcolumns = xcolumns
+ self.chartType = gdchart.GDC_BAR
+ Chart.__init__(self, charttable, filter)
+ self.option(ext_color=colours)
+
+ def getdata(self):
+ self.xdata = [str(xcolumn) for xcolumn in self.xcolumns]
+ chartdata = self.charttable.gettablerows(self.filter)
+ finalrow = chartdata[len(chartdata)-1]
+ self.ydata = [[finalrow[xcolumn] for xcolumn in self.xcolumns]]
+
+
+
\ No newline at end of file
|