getseriespaint

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Humanoid
Posts: 3
Joined: Wed Dec 05, 2007 4:26 pm

getseriespaint

Post by Humanoid » Wed Dec 05, 2007 4:38 pm

I am creating a combined chart, where the first chart contains a number of datapoints, represented by minutes over time.

The next charts are created based on the same datapoints, used at the first chart, but in percent over time, and a chart for every datapoint.

My problem is, to get the series paint from every datapoint in the first chart, and create the next charts, with the same color as used for the same datapoint in the first chart.

I have tryed to use getSeriesPaint, but it returns nothing, unless i manually have set the seriespaint for every datapoint in the first chart.

Is it not possible to get the color used, unless the color is manually set ?

Hope this is not to confusing.

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

Post by david.gilbert » Wed Dec 05, 2007 4:44 pm

How *do* you specify the colours for the first chart?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Humanoid
Posts: 3
Joined: Wed Dec 05, 2007 4:26 pm

Post by Humanoid » Wed Dec 05, 2007 6:12 pm

i am not specifying any color, i need to get the automatically used colors for every datapoint at the first chart.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Thu Dec 06, 2007 11:10 am

Hi humanoid,
please have a look at the lookupSeriesXXX methods in AbstractRenderer.
They will give you what you want.
Regards,Paradoxoff

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

Post by david.gilbert » Thu Dec 06, 2007 11:16 am

There's one other subtlety to consider. The auto-population of the series paint attributes happens during the time the chart is first *drawn*. So if you haven't drawn your chart anywhere yet, there will be no series paint values to look-up in the renderer.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Humanoid
Posts: 3
Joined: Wed Dec 05, 2007 4:26 pm

Post by Humanoid » Fri Dec 07, 2007 8:14 am

ahhh thats why.
I tought the colors where generated before.
OK thanks.

sesar
Posts: 12
Joined: Fri Jul 13, 2007 10:57 am

Post by sesar » Mon Apr 07, 2008 10:18 am

What is the formula to calculate the next auto color??

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

Post by david.gilbert » Mon Apr 07, 2008 1:46 pm

The colours are defined in the ChartColor class. The ChartColor.createDefaultPaintArray() method is called by the DefaultDrawingSupplier class to initialise the DEFAULT_PAINT_SEQUENCE. And that's where the renderer will get its colours from unless you configure it differently.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked