setSeriesStroke Bug?

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

setSeriesStroke Bug?

Post by Alex » Tue Jan 28, 2003 4:06 am

Hi:

I am trying to change the line style of a series as I add it to an XY PLot.

The first time I add a series to a plot and change the color and line style everything works fine.

When I add a second time series to the plot and modify the line style via
the setSeriesStroke method I get the following exception:

java.lang.ArrayIndexOutOfBoundsException
[java] at com.jrefinery.chart.Plot.setSeriesStroke(Unknown Source)


Here is how my code looks:

historyPlot.setSeriesStroke(lCurrentListIndex,
LineFactory.getLine(lCurrentListIndex));

historyPlot.setSeriesPaint(lCurrentListIndex,aColor);


If you notice, both methods are using the same index and the setSeriesPaint method works!!!

Does setSeriesPaint() take the index of the time series as the first argument?


Any help would be greatly appreciated,

Alex

David Gilbert

Re: setSeriesStroke Bug?

Post by David Gilbert » Wed Jan 29, 2003 12:35 am

Hi Alex,

There is an array of Paint objects and an array of Stroke objects that the chart cycles through. By default, the series paint array has 9 items, whereas the stroke array has only 1 item. The setSeriesStroke(...) method was intended to replace one item in the array, but requires care to make sure you don't go outside the array bounds.

The whole scheme is changed in the upcoming 0.9.5 release, to provide better support for complex combined charts.

Regards,

Dave Gilbert

Alex

Re: setSeriesStroke Bug?

Post by Alex » Wed Jan 29, 2003 2:01 am

Hi Dave,

Thanks for the response. How do I change the Line Style everytime I add a new series to a Chart? What is the best appoach?

Alex

Locked