[reportlab-users] How to inherit LinePlot class and add attributes?

reportlab-users@reportlab.com reportlab-users@reportlab.com
Wed, 17 Sep 2003 13:40:10 -0400 (EDT)


I'm working on a time-series line plot.  I want to add an attribute to the
LinePlot class, so I tried to inherit the class and just add a few new

However, the whole thing didn't work, as you can tell here:

>>> LinePlot
<class reportlab.graphics.charts.lineplots.LinePlot at 0x00D5B1B0>
>>> class timeseriesLinePlot(LinePlot):
	def __init__(self):
		self.startdate = None
		self.enddate = None

>>> ts = timeseriesLinePlot()

Traceback (most recent call last):
  File "<pyshell#42>", line 1, in -toplevel-
    ts = timeseriesLinePlot()
  File "<pyshell#41>", line 4, in __init__
    self.startdate = None
  File "c:\python23\lib\reportlab\graphics\widgetbase.py", line 50, in
  File "c:\python23\lib\reportlab\lib\attrmap.py", line 81, in
    raise AttributeError, "Illegal attribute '%s' in class %s" % (name,
AttributeError: Illegal attribute 'startdate' in class timeseriesLinePlot

What am I doing wrong?  I just want to be able to set the start and dates
of my chart. as attributes of the chart itself.

I realize that this probably should occur at the xAxis level, rather than
at the lineplot level, but I'm going to worry about that issue later.