[reportlab-users] BarChart - small value bar not displaying

Robin Becker robin at reportlab.com
Fri Jul 5 06:29:45 EDT 2013


On 05/07/2013 10:58, Patrick Craston wrote:

> Hi reportlab users

>

> I've encountered a problem when displaying a HorizontalBarChart (same issue for 3D and 2D versions).

>

> My data is [16, 43, 12, 1]

> When I plot the chart it does not display the bar for the item with value 1. See here: http://i.troll.ws/0c6877f6.png

>

> This is obviously a scaling issue but shouldn't it at least display a narrow bar for that value (especially in the 3D version)?

>

> Has anyone encountered this issue and found a solution?

>

> Many thanks for any help.

>

> Patrick

........
Patrick, this issue came up recently with one of the projects we are doing. In
the very latest code I added an option to the BarChartProperties class called
minDimen.

minDimen = AttrMapValue(isNumberOrNone, desc='minimum width/height that will be
drawn.')

obviously the requirements for Horizontal charts are for width and for vertical
charts height.

Anyhow if you set minDimen to some number of view units (ie not in the value
space of the bars) then all bars will get that width/height at least. Obviously
we also need to take account of the fact that bars could be negative so we'll
try and draw negatively for small negative values.

As with all of these properties you can configure a global value ie

chart.bars.minDimen=1 #ie 1 point

of for specified series etc etc eg

chart.bars[0].minDimen = 2
chart.bars[1,0].minDimen.....

I don't think this is yet done for the 3D chart. I'll try & take a look over the
weekend.
--
Robin Becker


More information about the reportlab-users mailing list