I try to draw a plot with categories, 2 thresholds and some outliers
This picture shows what I can do right now:

And here is my code:
Code: Select all
LineAndShapeRenderer renderer0 = new LineAndShapeRenderer();
renderer0.setBaseLinesVisible(true);
renderer0.setBaseShapesVisible(false);
renderer0.setBaseSeriesVisibleInLegend(false);
renderer0.setBaseToolTipGenerator(this);
renderer0.setSeriesPaint(0,new Color(0,255,0,60));
renderer0.setSeriesPaint(1,new Color(0,255,0,60));
plot.setRenderer(0,renderer0);
plot.setDataset(0,getThreshold());
LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
renderer1.setBaseLinesVisible(false);
renderer1.setBaseSeriesVisibleInLegend(false);
renderer1.setBaseToolTipGenerator(this);
renderer1.setSeriesPaint(0,Color.BLUE);
renderer1.setSeriesShape(0,CustomShape.getSquare());
plot.setRenderer(1,renderer1);
plot.setDataset(1,getBaseline());
LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
renderer2.setBaseLinesVisible(false);
renderer2.setBaseSeriesVisibleInLegend(false);
renderer2.setBaseToolTipGenerator(this);
for(int i=0;i<15;i++) {
renderer2.setSeriesPaint(i,Color.GREEN);
renderer2.setSeriesShape(i,CustomShape.getDiamond());
}
plot.setRenderer(2,renderer2);
plot.setDataset(2,getData());

1) For the moment I use 3 LineAndShapeRenderer (the blue squares, the green diamonds and the green lines for the threshold) and the methods setSeriesPaint and setSeriesShape
How could I use a more generic method in order to specify the color and the shape for one renderer and not for each serie?
I try setBasePaint and setBaseShape but it doesn't work...
2) How could I paint the outliers in red?
I have read that I could override the getItemPaint method but I don't understand how to do that
Thanks for your help