views:

41

answers:

3

I'd like to be able to set a colour of every point (addressed by x&y, where x is a DateTime (of joda-time, actually) and y is a double) on a chart to represent a z=f(x,y) value. Is it possible with JFreeChart?

A: 

As far as I remember that's not possible by default. You can set only one color for every plotted series. However, I think it's possible to extend AbstractRenderer and achieve what you need.

Of course there is possibility that I'm mistaking. Dont remember for sure. :P

Alex Nikolaenkov
+2  A: 

I recommend http://code.google.com/p/jzy3d/

Here are some example charts: http://sites.google.com/site/jzy3dwhite/

And example code to plot a surface: http://code.google.com/p/jzy3d/wiki/DemoSurface

retronym
+1  A: 

If I understood your needs correctly I think you want to use an XYPlot with an XYBlockRenderer. Quoting the docs:

A renderer that represents data from an XYZDataset by drawing a color block at each (x, y) point, where the color is a function of the z-value from the dataset

Check the sample image in the docs for XYBlockRenderer: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYBlockRenderer.html

hbatista