I have this code so far. Right now I want to override where the point is drawn. If the point is below 1 I want to draw the point at 1 and place an orange marker. I have the color set up but now I want to change the Y position. The only method I see I can override is drawItem. But I’m not 100% sure.
public class XYCustomRenderer extends XYShapeRenderer {
@Override
public Paint getItemPaint( int series, int item ) {
TimeSeriesCollection seriesCollection = ( TimeSeriesCollection ) getPlot().getDataset();
//Logger.info( "" + data.getY( 0, 2 ) );
if ( seriesCollection.getYValue( series, item ) < 1 ) {
return Color.ORANGE;
}
return Color.RED;
}
}
You might look at how
BoxAndWhiskerRenderer, seen here, usesOutlier. Alternatively, pin negative ordinates to some arbitrary value, e.g. 0, in your data model, and use your customgetItemPaint()to change the corresponding item’s color.