Given below is the code and image generated.
My problem is that I don't want the lines to be black but ONLY the data points. Any suggestions?
Also, is it possible to put the value above the plotted data points in the graph ?
Code: Select all
public class MyRenderer extends LineAndShapeRenderer {
private Boolean[] anomaly;
private static int count = 0;
/**
*
*
*/
public MyRenderer(Boolean[] anomaly) {
super();
this.anomaly = anomaly;
}
/**
*
*/
public Paint getItemPaint(int series, int item) {
if(anomaly[item].booleanValue())
return Color.BLACK;
return super.getItemPaint(series,item);
}
}
Code: Select all
public class MyDrawingSupplier extends DefaultDrawingSupplier {
private static Paint[] myPaints = { Color.RED, Color.BLUE, Color.GREEN,
Color.MAGENTA };
private int paintIndex = 0;
public MyDrawingSupplier() {
super();
}
/**
* Returns the next paint in the sequence.
*
* @return The paint.
*/
public Paint getNextPaint() {
Paint result = myPaints[paintIndex % myPaints.length];
paintIndex++;
return result;
}
/**
* Returns the next shape in the sequence.
*
* @return The shape.
*/
public Shape getNextShape() {
double size = 6.0;
double delta = size / 2.0;
// circle
Shape result = new Ellipse2D.Double(-delta, -delta, size, size);
return result;
}
}
