Re: Pass legend labels into LinePlot

Bill Marcum <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAK8q2VQKRrRo+NQEU-yPBE6xyhyKBcFH=bbRkDNdLXjE7j=TUg@mail.gmail.com>
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 <[email protected]> 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.
>
>
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.