[reportlab-users] Pass legend labels into LinePlot
Bill Marcum
bill.marcum at gmail.com
Tue Aug 23 18:38:18 EDT 2016
Any help here? More details:
I'm modeling my code after one of the LinePlot examples. In that example,
in the __init__ method, the code does something similar to this:
sNames = ['Fund1','Fund2','Fund3','Fund4']
colorsList = [ lightgrey, grey, darkgrey, lightblue ]
for i in range(len(sNames)):
self.chart.lines[i].name=sNames[i]
self.chart.lines[i].strokeColor=colorsList[i]
self.legend.colorNamePairs.append( (colorsList[i], sNames[i]))
And this works great, the chart renders with a Legend for those four Funds,
appropriately color coded. BUT, this isn't useful to me, I need to pass in
the labels dynamically, the same way I do the line data in the 'chart.data'
param. I can't find a parameter to use that would support this, and the
param data isn't available during the __init__ method anyway (not sure when
that gets set, or how to access it).
On Tue, Aug 16, 2016 at 10:42 AM, Bill Marcum <bill.marcum at gmail.com> wrote:
> I'm extending one of the sample reportlab graphs, and I'm able to pass in
> dynamic line data using the 'data' param. But I can't figure out how to
> pass in dynamic line labels for the legend. Every example I see hardcodes
> the legend in the graph subclass.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20160823/3e8d9dc0/attachment.html>
More information about the reportlab-users
mailing list