I am using reportlab to generate simple bar chart. the following is my code.
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
d = Drawing(300, 200)
chart = VerticalBarChart()
chart.width = 260
chart.height = 160
chart.x = 30
chart.y = 30
chart.groupSpacing = 10
chart.barWidth = 4
chart.data = [[20.5,0.01],[32.4,0.01]]
chart.categoryAxis.categoryNames = ['foo','bar']
d.add(chart)
d.save(fnRoot='trial',formats=['png',])
both the bars are being displayed under 'foo' , while one must be under 'foo' and another under 'bar' lables.
I tried groupSpacing and barSpacing but could make the bars to come under correct lables.
Can you please tell me how to solve this. I am new to reportlab and hence not able to solve this, also there is very less documentation for reportlab available.
I need to add more labels so how can i do this.
Thanks
There is a misunderstanding here, your chart data come in series like [[20.5,0.01],[32.4,0.01]] so you first group has two bars of values 20.5 and 32.4, your second group has another two bars of values 0.01 and 0.01. The values on the second series are so small that you cannot see their bars. If your desire was to display the 32.4 bar in the first group and the 20.5 in the second group then you could change your data into
chart.data = [(20.5,32.4),(0.01, 0.01)]