lineplots.py: added SimpleTimeSeriesPlot
authorrobin
Fri, 22 Feb 2013 11:51:45 +0000
changeset 3650 ee1ab6a5402a
parent 3649 f2364e036d61
child 3651 743a52af7e9a
lineplots.py: added SimpleTimeSeriesPlot
src/reportlab/graphics/charts/lineplots.py
--- a/src/reportlab/graphics/charts/lineplots.py	Thu Feb 21 15:00:00 2013 +0000
+++ b/src/reportlab/graphics/charts/lineplots.py	Fri Feb 22 11:51:45 2013 +0000
@@ -622,9 +622,19 @@
   (20000531, 112.6),
   (20000630, 114.6)]]
 
-class GridLinePlot(LinePlot):
+class SimpleTimeSeriesPlot(LinePlot):
     """A customized version of LinePlot.
     It uses NormalDateXValueAxis() and AdjYValueAxis() for the X and Y axes.
+    """
+    def __init__(self):
+        LinePlot.__init__(self)
+        self.xValueAxis = NormalDateXValueAxis()
+        self.yValueAxis = AdjYValueAxis()
+        self.data = _monthlyIndexData
+
+class GridLinePlot(SimpleTimeSeriesPlot):
+    """A customized version of SimpleTimeSeriesSPlot.
+    It uses NormalDateXValueAxis() and AdjYValueAxis() for the X and Y axes.
     The chart has a default grid background with thin horizontal lines
     aligned with the tickmarks (and labels). You can change the back-
     ground to be any Grid or ShadedRect, or scale the whole chart.
@@ -639,9 +649,7 @@
 
     def __init__(self):
         from reportlab.lib import colors
-        LinePlot.__init__(self)
-        self.xValueAxis = NormalDateXValueAxis()
-        self.yValueAxis = AdjYValueAxis()
+        SimpleTimeSeriesPlot.__init__(self)
         self.scaleFactor = None
         self.background = Grid()
         self.background.orientation = 'horizontal'
@@ -649,13 +657,12 @@
         self.background.useLines = 1
         self.background.strokeWidth = 0.5
         self.background.strokeColor = colors.black
-        self.data = _monthlyIndexData
 
     def demo(self,drawing=None):
         from reportlab.lib import colors
         if not drawing:
             drawing = Drawing(400, 200)
-        lp = AdjLinePlot()
+        lp = GridLinePlot()
         lp.x = 50
         lp.y = 50
         lp.height = 125