[reportlab-users] BarChart barLabelCallout ?
Sun, 8 Dec 2002 10:45:19 +0000
In article <LKENLBBMDHMKBECHIAIACELICPAA.email@example.com>, Andy
Robinson <firstname.lastname@example.org> writes
>> I found a new attribute in BarChart:
>> barLabelCallOut = AttrMapValue(None, desc='Callout
>> Can anybody explain ?
Actually I think this was used for another customer who needed
customisation. The idea is to have a chartwide function that
is passed the label just after it is created and added to the group, g.
The label has all the above info set on it in the _callOutInfo
I think we already handle plus/minus position changing, and the
barchartlabel class knows how to change its anchors.
Pat Johnson's problem was how to change the way labels are displayed
when negative (ie red and absolute value in parentheses).
Ideally we should use some kind of oo to be able to do this kind of
thing. Properly thought out the class of the barlabels etc could be made
into another attribute, but it's not obvious whether the drawing part of
such a label belongs to the chart or the label itself.
>I think this was in response to Pat Johnson's enquiry
>that she wanted positive bars to be labelled e.g. '3.14'
>in black text, and negaive ones to be e.g. '(3.14)' in
>red text. Robin added a callback mechanism so you could
>write your own function which drew a label, and thereby
>permit radically different labels for positive and negative
>amounts. It is not beautiful, but it's hard to see a better