Custom colors for scatter plots

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
producer123
Posts: 1
Joined: Sun Apr 15, 2018 7:35 pm
antibot: No, of course not.

Custom colors for scatter plots

Post by producer123 » Sun Apr 15, 2018 7:36 pm

Hello there,

I'm plotting thousands of points in a XY scatter plot (generating the image directly), and I use FastScatterPlot for this purpose in order to get good performances.

However, I can't find a way to customize the colors of each point (e.g. according to a property value).

Is it at all possible ?

Thanks :)

John Matthews
Posts: 404
Joined: Wed Sep 12, 2007 3:18 pm

Re: Custom colors for scatter plots

Post by John Matthews » Mon Apr 16, 2018 5:42 pm

The FastScatterPlot method used to render() the scatter plot invokes setPaint() just once at the beginning, but your overridden variation could change colors inside the rendering loop.

david.gilbert
JFreeChart Project Leader
Posts: 11666
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Custom colors for scatter plots

Post by david.gilbert » Mon Apr 16, 2018 8:06 pm

This renderer uses a single color in order to maximise performance - once you start changing the color for each data item, you'll have to bear the cost of that state change.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

Post Reply