Question

I'm making a program that needs to plot graphs with many different colors and shades .

More specifically, I'm using a scatter graph, and for each new point it has to be in a darker shade than the previously one. When the color of the point became near black, I change the color too.

I tried to do this extending XYLineAndShapeRenderer and then the method getItemColor.

It successfully changed the color and shape of the points (using Color.getHSBColor method), but it didn't change in the sequence I expepected. I thought it would change the color in the sequence the points were inserted, but instead of this, it changed like if the graph was already plotted, and the colors became sequential.

But it's a scatter plot, so I expected a mixture of colors and shapes. So, is it possible to change the color of a point, while this point is being plotted in the graph?

Was it helpful?

Solution

I'd guess that you are using XYSeriesCollection for your dataset. Read carefully the description for the XYSeries constructor...you probably dont want the default autoSort behavior for the series.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top