// Add the single color to the beginning of the color cycle, using all the default
// colors. To replace the defaults you have to specify at least two colors.
Paint[] colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + 1];
colors[0] = ((JRSeriesColor)seriesColors.first()).getColor();
System.arraycopy(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, 0, colors, 1, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length);
plot.setDrawingSupplier(new DefaultDrawingSupplier(colors,
DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
}
else if (seriesColors.size() > 1)
{
// Set up a custom drawing supplier that cycles through the user's colors
// instead of the default colors.
Color[] colors = new Color[seriesColors.size()];
JRSeriesColor[] colorSequence = new JRSeriesColor[seriesColors.size()];
seriesColors.toArray(colorSequence);
for (int i = 0; i < colorSequence.length; i++)
{
colors[i] = colorSequence[i].getColor();
}
plot.setDrawingSupplier(new DefaultDrawingSupplier(colors,
DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
}