[reportlab-users] HorizontalLineChart background with white stripes
Robin Becker
robin at reportlab.com
Mon Aug 19 06:28:42 EDT 2013
Helga,
see this sample chart script for usage of the visibleGrid stuff. It will likely
have been made to look unusable by email folding
###########################################
from reportlab.graphics.charts.linecharts import HorizontalLineChart
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, Rect
from reportlab.lib.colors import grey, red, white, Color
class Drawing_000(_DrawingEditorMixin,Drawing):
def __init__(self,width=400,height=200,*args,**kw):
Drawing.__init__(self,width,height,*args,**kw)
self._add(self,HorizontalLineChart(),name='chart',validate=None,desc=None)
self.chart.y = 20
self.chart.height = self.height - self.chart.y - 10
self.chart.width = self.width - self.chart.x - 10
self.chart.categoryAxis.labels.dy = 0
self.chart.categoryAxis.categoryNames = ('North', 'South', 'East',
'West')
self.chart.valueAxis.visibleGrid = 1
self.chart.valueAxis.gridStrokeColor = white
self.background =
Rect(0,0,self.width,self.height,fillColor=Color(0.7,0.7,0.7),strokeColor=red,strokeWidth=0.5)
if __name__=="__main__": #NORUNTESTS
Drawing_000().save(formats=['pdf'],outDir='.',fnRoot=None)
###########################################
On 19/08/2013 10:47, Helga Peters wrote:
> Dear Robin,
>
> Thank you for responding. I haven't figured this out yet,
> would appreciate an example, since I haven't found one.
>
> Regards,
> Helga
>
>
>
> 2013/8/19 Robin Becker <robin at reportlab.com>
>
>> On 06/08/2013 10:57, Helga Peters wrote:
>>
>>> In the following document: "Documentation for package "reportlab.graphics"
>>> Generated by: graphdocpy.py version 0.8; Date generated: 2013-05-07
>>> 20:19",
>>> I found a nice example on page 135 with an image of what it should look
>>> like.
>>>
>>> However I can't reproduce the white stripes in the backgound.
>>> I have added: lc.valueAxis.visibleGrid = 1,
>>> then I get black stripes, but how can I change the color of those stripes
>>> ?
>>> I have tried 'lc.categoryAxis.**gridStrokeColor', but that doesn't seem
>>> to do
>>> what I think it would do.
>>>
>> .......
>> Helga,
>>
>> did you figure this out? If not I'll make an example up that shows how to
>> make the grid lines etc etc.
>>
>> Thanks in advance,
>>> Helga
>>>
>> .......
>> --
>> Robin Becker
>>
>
>
>
--
Robin Becker
More information about the reportlab-users
mailing list