I create a dual vertical axis timeseries line chart. But distinguishing the different lines on plot is not very easy because the default color of the lines. So, I want to change the default color of the lines in renderer. Before the version 0.9.5, I do this like these codes:
Paint[] paint = { .... }; // An array of Color objects. paint.length=10;
XYPlot plot = chart.getXYPlot();
XYItemRenderer renderer = plot.getRenderer();
int linesCount = plot.getSeriesCount();
int colorsCount = paint.length;
int j = 0;
for (int i = 0; i < linesCount; i++) {
if (j > colorsCount - 1)
j = 0;
plot.setSeriesPaint(i, paint[j]);
j ++;
}
}
But in dual vertical axis timeseries line chart, these codes just change the color of lines corresponding to left vertical axis. How to change the color of lines corresponding to the secondary vertical axis?
How to get lines count on dual axis chart?
Re: How to get lines count on dual axis chart?
The setSeriesPaint(int, Paint) method defaults to setting the color for the primary dataset. If you want to set the color for the secondary dataset, use the setSeriesPaint(int, int, Paint) method - the first argument is the dataset index, 0 for the primary dataset and 1 for the secondary dataset.
Regards,
Dave Gilbert
Regards,
Dave Gilbert