[reportlab-users] Placement and color of bar labels according to length of bar?
Robin Becker
robin at reportlab.com
Mon Nov 12 13:24:25 EST 2007
Stevens, Ian wrote:
> I'm using HorizontalBarChart with bar labels currently displaying just to the right of the end of the bar. Is it possible to adjust the label positions so that for longer bars the label will appear as white within the bar and as black outside of the bar for shorter bars? I'm working in a tight area and would like to same as much space as possible. Here's roughly what I'd like the bar to look like:
>
> |--
> |-- 12%
> |--
> |---------
> |----- 40%
> |---------
>
> thanks,
> Ian.
.........
The bar labels are controlled by an attribute called barLabels
I assume that you have set
chart.barLabels.boxAnchor = 'w'
you can control particular bars using indexing eg
chart.barLabels[3].boxAnchor = 'e'
that will normally bring the label inside the bar. You can tweak the offset with
the barLabel dx attribute and the color with fillColor etc etc
--
Robin Becker
More information about the reportlab-users
mailing list