Set verticalbarchart label x, y positions depending on value

Matt Bartolome <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAL9O_mPh73sR6pzmHw5TnCXLA6MVc6jY2WCiBCp1yjA9J31AaA@mail.gmail.com>
Hi, I have a stacked vertical bar chart where I need to either manually
place labels or iterate over the existing labels and move them based on
their position (crossing my fingers that there is a simpler way). The
problem I have is that my stacked bar chart has overlapping labels when the
y values are close to zero because of the scale of my chart.

My barLabels settings are like so:

self.chart.barLabelFormat = lambda x: '${0}'.format(x) if x > 0 else None
self.chart.barLabels.boxAnchor = 'w'
self.chart.barLabels.boxFillColor = None
self.chart.barLabels.boxStrokeColor = None
self.chart.barLabels.fontName = fontName
self.chart.barLabels.fontSize = 6
self.chart.barLabels.dy = 5
self.chart.barLabels.dx = -8
self.chart.barLabels.boxTarget = 'mid'

I was hoping there was a setting to avoid overlap, but if that doesn't
exist I would like to loop over the x,y positions of the existing labels
and create my own simple labels to replace them but I can't figure out how
to do that.

Thanks,
Matt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.