0

I have a JFreeChart XYPlot with many series, the number of different series depends on input parameters. I wish to colour the lines in groups of two, so that series_0 and series_1 are the same colour then series_2 and series_3 are the same colour. I tried the following solution but it didn't work

```
XYPlot combinedPlot = createPlot(yaxis, new NumberAxis(xaxis), collection, logScale);
for (int j = 1; j < combinedPlot.getSeriesCount(); j++) {
if (j % 2 == 1) combinedPlot.getRenderer().setSeriesPaint(j, combinedPlot.getRenderer().getSeriesPaint(j - 1));
}
```

I don't know why this doesn't work, if I replace combinedPlot.getRenderer().getSeriesPaint(j - 1) by Color.RED it correctly sets every second line to red. Would appreciate any help if you have come accross this before.