[reportlab-users] linecharts.py

Dirk Datzert reportlab-users@reportlab.com
Thu, 8 May 2003 09:23:12 +0200


Hi all,

I have a special use case of linecharts with different length of data =
values:

[None, 1, 2, 3, 4],
[1,2,3,4, None]

In the display of the chart I would expect that the position of None =
wouldn't been drawn, but it goes down to - infinity.

The following patch against latest CVS will change the behaviour.

--- linecharts.py       Wed Jul 31 14:45:08 2002
+++ linecharts.py.rhg   Thu May  8 09:13:33 2003
@@ -179,11 +179,12 @@
             lineRow =3D []
             for colNo in range(len(self.data[rowNo])):
                 datum =3D self.data[rowNo][colNo]
-                (groupX, groupWidth) =3D self.categoryAxis.scale(colNo)
-                x =3D groupX + (0.5 * self.groupSpacing * normFactor)
-                y =3D self.valueAxis.scale(0)
-                height =3D self.valueAxis.scale(datum) - y
-                lineRow.append((x, y+height))
+                if datum is not None:
+                  (groupX, groupWidth) =3D =
self.categoryAxis.scale(colNo)
+                  x =3D groupX + (0.5 * self.groupSpacing * normFactor)
+                  y =3D self.valueAxis.scale(0)
+                  height =3D self.valueAxis.scale(datum) - y
+                  lineRow.append((x, y+height))
             self._positions.append(lineRow)


Best Regards=20
Dirk Datzert