[reportlab-users] [patch] Workaround for stacked xxBarCharts3D

Gael Chardon gael.dev at 4now.net
Mon Sep 25 05:02:31 EDT 2006


Hello,
the 'stacked' option does not properly work on xxBarChart3D.

This patch is a quick workaround: the 3D bars are drawn in reverse order 
and labels are draws at the end to avoid to be overwritten.

Hope it helps.

Regards.

-- 
Gael Chardon
-------------- next part --------------
Index: barcharts.py
===================================================================
--- barcharts.py	(revision 2971)
+++ barcharts.py	(working copy)
@@ -588,17 +584,20 @@
         g = Group()
         theta_x = self.theta_x
         theta_y = self.theta_y
+        if self.categoryAxis.style == 'stacked':
+          fg_value=fg.value().reverse()
         for t in fg.value():
-            if t[0]==1:
-                z0,z1,x,y,width,height,rowNo,colNo = t[1:]
-                BarChart._addBarLabel(self,g,rowNo,colNo,x,y,width,height)
-            elif t[0]==0:
+            if t[0]==0:
                 z0,z1,x,y,width,height,rowNo,style = t[1:]
                 dz = z1 - z0
                 _draw_3d_bar(g, x, x+width, y, y+height, dz*theta_x, dz*theta_y,
                             fillColor=style.fillColor, fillColorShaded=None,
                             strokeColor=style.strokeColor, strokeWidth=style.strokeWidth,
                             shading=0.45)
+        for t in fg.value():
+            if t[0]==1:
+                z0,z1,x,y,width,height,rowNo,colNo = t[1:]
+                BarChart._addBarLabel(self,g,rowNo,colNo,x,y,width,height)
         return g
 
 class VerticalBarChart3D(BarChart3D,VerticalBarChart):


More information about the reportlab-users mailing list