[reportlab-users] How to break a line graph?

David Frank david83 at sfsu.edu
Tue Jun 26 20:09:56 EDT 2007


Hi,

Thank you very much for your replies. I think I could follow Tim's
suggestion since that was what I was actually thinking of doing myself.
But the only issue would be that since the graph is COMPLETELY dynamic, I
would need to find some logical program loop that makes sure that this
second line, after breaking, has the same color as the first.

As for the patch for Andy, I can try to do the patch once I finish my Grad
project as I am swamped right now and I also since I'd be more experienced
in Python by then. For now, I'll just mail the code that I am going to
write for breaking the chart data and to retain the color. It may not be
perfect, but would work for sure :-), but if someone comes up with the
patch before I do, please do tell me :-D

Thanks again for all your efforts, guys. This forum's great!!

Regards,

David Frank



>>I'm not 100% sure after scanning the code, but it looks like this might

>>work if you break this yourself:



>> chartdata[2] = [100.2, 100.111, 50.2345, 50.0, None, None, None, ...

]

>> chartdata[3] = [None, None, None, None, None, None, None, None,

None,

>> 106.651199, 50.34, ...]



>>However, the benefit of getting source code is that you can tweak it

>>yourself. It wouldn't take too much work to make the code behave the

>>way you want.



>>--

>>Tim Roberts, timr at probo.com

>>Providenza & Boekelheide, Inc.






>> Tim's right. At present the chart classes don't support interrupted

lines.


>> I suggest you subclass the makeLines() method of HorizontalLineChart

>> (or Vertical if you prefer). This method looks at the data and

>> returns a list of PolyLine objects - primitive shapes our engine can

>> render. You could make it test for None values in each series, and,

>> if any are found, break it into several distinct continuous line

>> segments.



>> If you wanted to modify the class instead, we would be very happy to

>> accept this as a patch. However it would have to properly handle both

>> the 'line' and 'mountain' cases - the latter being where we fill down

>> to the axis, and have some new property to enable this so that nothing

>> changes unless asked for e.g.self.interpolateMissingData (default =

>> True, or False).



>> I hope this helps - sorry I don't have time to add it myself this week.



>> - Andy

_______________________________________________
reportlab-users mailing list
reportlab-users at reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070626/af244f9b/attachment-0001.html>


More information about the reportlab-users mailing list