A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
Fry
- Posts: 14
- Joined: Mon Aug 08, 2005 9:56 pm
- Location: Karlsruhe (Germany)
Post
by Fry » Sun Oct 22, 2006 1:04 am
Hi JFreChart freaks
one question: it is possible to change the colors of the thermometer? I want to use this chart for another issue than temperature and red and green should be replaced by each other. Is there a way to do this?
Thx
Fry
-
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 Oct 23, 2006 11:58 am
You can use the methods setMercuryPaint() and setSubrangePaint() in the ThermometerPlot class.
-
Fry
- Posts: 14
- Joined: Mon Aug 08, 2005 9:56 pm
- Location: Karlsruhe (Germany)
Post
by Fry » Fri Nov 03, 2006 12:34 pm
Hi David,
thank you very much for your answer. I checked both methods and also looked in the source code. It seems to me, that i can set the lines (seperators) beside the thermometer and the setMercuryPaint is usefull if i want to change the content color. But how to call? The following way does not change anything:
Code: Select all
public void addTempExample() {
DefaultValueDataset dataset = new DefaultValueDataset(new Double(99.0));
ThermometerPlot plot = new ThermometerPlot(dataset);
plot.setMercuryPaint(Color.BLUE);
JFreeChart chart = new JFreeChart(
"reached points", // chart title
JFreeChart.DEFAULT_TITLE_FONT,
plot, // plot
false // no legend
);
alertPanelRight = new ChartPanel(chart);
}
can anybody give me some code snipped for this?
See you
Fry
-
Fry
- Posts: 14
- Joined: Mon Aug 08, 2005 9:56 pm
- Location: Karlsruhe (Germany)
Post
by Fry » Fri Nov 03, 2006 3:55 pm
Hi folks
i found it by myself, ignore post please, by setting:
Code: Select all
plot.setSubrange(0, 30.0, 60.0);
plot.setSubrange(1, 60.1, 90.0);
plot.setSubrange(2, 90.1, 100.0);
plot.setSubrangePaint(2, Color.GREEN);
plot.setSubrangePaint(1, Color.ORANGE);
plot.setSubrangePaint(0, Color.RED);
it works now
cya
Fry