Different line styles in a multple series chart

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

Different line styles in a multple series chart

Post by Moshea » Wed Jan 29, 2003 5:18 am

Hiya

I've constructed multiple series chart. Instead of using different colour to indicate various series, can I show them in, say solid line, dotted line etc ???

Thanks very much!!!

Moshea

David Gilbert

Re: Different line styles in a multple series chart

Post by David Gilbert » Thu Jan 30, 2003 12:52 am

In 0.9.4, you can use the setSeriesStroke(...) method that all plots inherit from the Plot class. Supply an array of Stroke objects, and the plot will cycle through the array as it processes each series. The array can be any length, it returns to the start if necessary.

Regards,

Dave Gilbert

Frank

Re: Different line styles in a multple series chart

Post by Frank » Thu Jan 30, 2003 10:43 pm

Heres an example of what Dave mentioned...although I still have another question about this.

// set the stroke for each series...
Stroke[] seriesStrokeArray = new Stroke[6];
seriesStrokeArray[0] = new BasicStroke(2.0f);//straight line

seriesStrokeArray[2] = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,1.0f, new float[] { 2.0f, 6.0f }, 0.0f);

seriesStrokeArray[3] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,1.0f, new float[] { 10.0f, 6.0f }, 0.0f);

seriesStrokeArray[4] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,1.0f, new float[] { 6.0f, 6.0f }, 0.0f);

seriesStrokeArray[5] = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,1.0f, new float[] { 2.0f, 6.0f }, 0.0f);

but can I visually represent these lines ????IN THE LEGEND?????

Sjakie Glas

Re: Different line styles in a multple series chart

Post by Sjakie Glas » Fri Feb 14, 2003 2:13 pm

David,

What's happened with the 0.9.4 Plot.setSeriesStroke(...) method? I try to upgrade to 0.9.5 but I am experiencing troubles with this.

Thanks in advance,

Sjakie Glas

David Gilbert

Re: Different line styles in a multple series chart

Post by David Gilbert » Fri Feb 14, 2003 3:00 pm

All the renderers now inherit setSeriesStroke(...) methods from AbstractRenderer.

Regards,

Dave Gilbert

Locked