setSeriesPaint problem

A free public discussion forum for the JFreeChart class library.

setSeriesPaint problem

Postby jazz » Thu Mar 01, 2007 3:05 pm

Hi,

I have 2 xyseries in a dataset that has been assigned paint with AbstractRenderer.setSeriesPaint. I want to modifiy one series paint and did :


//Code

XYLineAndShapeRenderer renderer = chart.getXYPlot().getRenderer();
//System.out.println(renderer.getSeriesPaint(1));
renderer.setSeriesPaint(1, Color.blue, true);
//System.out.println(renderer.getSeriesPaint(1));
...

The color has changed but it's not displayed. How to make the new paint displayed ?

thanks for your help.
jazz
 
Posts: 5
Joined: Thu Feb 15, 2007 6:23 pm

Postby david.gilbert » Thu Mar 01, 2007 5:11 pm

That will set the color for series 1. If you don't see any change in your chart, make sure (1) your chart has at least two series (the first has index 0) (2) the 'chart' variable that you are modifying is, in fact, the chart you are looking at, and (3) you didn't set the override paint anywhere in your code (it's confusingly named setPaint(Paint) and it overrides the per-series settings).
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
david.gilbert
JFreeChart Project Leader
 
Posts: 11324
Joined: Fri Mar 14, 2003 10:29 am

Postby wallace » Thu Sep 13, 2007 11:41 am

I have the same problems.
I've debug this thing and saw that :
- object "plot" have in "datasets" 2 "TimeSeriesCollection"
- first "TimeSeriesCollection" include 1 "TimeSeries" (call it A)
- second "TimeSeriesCollection" include 1 "TimeSeries" (call it B)

I want set color for A black , and for B blue.
But when i use
renderer.setSeriesPaint(0, Color.BLACK);//for A
renderer.setSeriesPaint(1, Color.BLUE);//for B

only A's color changed!!!
How can i fix that??

Thanks.
wallace
 
Posts: 13
Joined: Fri May 25, 2007 5:05 pm


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 9 guests