Color Ranges in Area Charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jgcabs
Posts: 2
Joined: Thu Jun 26, 2008 12:11 am

Color Ranges in Area Charts

Post by jgcabs » Thu Jun 26, 2008 12:38 am

We have just converted from ChartDirector to JFreeChart. One chart type we have been using is causing us challenges. Could someone provide some guidance re how to do this. An example chart is available at:

www[dot]absolute-performance[dot]com/images/Area_SLA_Graph.png

Thanks in advance for your help.

-Jerry

PS. Apparently URLS and Images are not allowed for new posters...

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: Color Ranges in Area Charts

Post by RichardWest » Thu Jun 26, 2008 2:27 am

jgcabs wrote:Could someone provide some guidance re how to do this.
Image
There is no native, out-of-the-box approach to creating this type of plot in JFreeChart. You can, however, create a custom renderer which is a modified version of XYAreaRenderer. A quick replacement for a custom renderer would be to simply use an XYAreaRenderer for the plot and add ValueMarkers or IntervalMarkers to the plot's range axis. You could color the IntervalMarkers to reflect the red, yellow, and green ranges.
jgcabs wrote:PS. Apparently URLS and Images are not allowed for new posters...
You obviously did not read How to Ask a Question About JFreeChart - READ THIS!. I added a lighthearted comment in italics inspired by this comment. It is the forum's policy to prevent new users from posting URLs and images as a spam prevention mechanims.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

jgcabs
Posts: 2
Joined: Thu Jun 26, 2008 12:11 am

Post by jgcabs » Thu Jun 26, 2008 3:09 pm

Thank you for the guidance. Roughly how long should it take a strong Java developer to implement your suggestion? Experience with JFreeChart is medium level.

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Thu Jun 26, 2008 5:25 pm

jgcabs wrote:Roughly how long should it take a strong Java developer to implement your suggestion?
I have no idea how long it would take you. My first suggestion would be to use the quick replacement since you can do that without writing a custom renderer. After that, invest some time into reading the code for the XYAreaRenderer and see if you can understand it. If you can, make a copy and start modifying it to suit your needs. Be sure to submit a patch if you get it working.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

prassoon
Posts: 14
Joined: Fri May 23, 2008 1:57 am

Post by prassoon » Sat Jun 28, 2008 11:56 pm

jgcabs wrote:Thank you for the guidance. Roughly how long should it take a strong Java developer to implement your suggestion? Experience with JFreeChart is medium level.
3 minutes 47.5 seconds with a half developer (strong) :lol:

Locked