Changing Line color -XY Line chart

A free public discussion forum for the JFreeChart class library.

Changing Line color -XY Line chart

Postby ranyeng » Fri May 22, 2009 7:00 am

Please I need your help...

The following is my line chard part of the code:

final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
final String series1 = xyLabel;
final JFreeChart chart = ChartFactory.createLineChart(
title, // chart title
xLabel, // domain axis label
yLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);

chart.setBackgroundPaint(new Color(249, 231, 236));

How can I set the color of the line?


Thanks in advance

regards,
Ranjan Yengkhom
ranyeng
 
Posts: 13
Joined: Fri May 22, 2009 6:53 am

Re: Changing Line color -XY Line chart

Postby david.gilbert » Fri May 22, 2009 7:39 am

Code: Select all
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.getRenderer().setSeriesPaint(0, Color.RED);
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: 11195
Joined: Fri Mar 14, 2003 10:29 am

Re: Changing Line color -XY Line chart

Postby ranyeng » Fri May 22, 2009 8:08 am

Thanks David..
ranyeng
 
Posts: 13
Joined: Fri May 22, 2009 6:53 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests