different strokes for different lines

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Mezba Mahtab

different strokes for different lines

Post by Mezba Mahtab » Tue Feb 04, 2003 10:50 pm

Hi. I have a simple XY graph that graphs two values, one on x-axis and one on y-axis.

There are two lines, one for "normal" conditions, and the other for "experiment" conditions. I would like one of them to be a dashed line, and the other to be a normal continuous line.

Thus the XYDataset is an XYSeriesCollection containing two XYSeries.

I tried the following.

JFreeChart chart = ChartFactory.....
Plot plot = chart.getPlot()

Then I tried plot.setSeriesOutlineStroke (1, new BasicStroke (....))

I used 1 as I assumed the first series would be index 0, but it gives me an ArrayOutofBoundsException. Could you please help me out here?

Thanx in advance.

David Gilbert

Re: different strokes for different lines

Post by David Gilbert » Thu Feb 06, 2003 3:58 pm

You need to use the setSeriesStroke(...) method rather than the setSeriesOutlineStroke(...) method. Use the method that accepts an array, and make sure that your array has at least two Stroke objects in it.

This is changing in 0.9.5, because the current code doesn't work that well for combined or dual axis charts.

Regards,

Dave Gilbert

Locked