How can I paint the background of a chart (say) black only for specific region i.e. from (x1,y1) to (x2, y2) only. In this case, say, my range upper bound is 100, I want to paint the chart black from
(x1, 0) to (x2, 100).
Right now, I am doing this by adding XYLineAnnotation and choosing basic stroke,a s shown below: -
Code: Select all
for (float i = fromX; i <= toX; i++) {
Stroke stroke = new BasicStroke(8);
XYLineAnnotation xyLineAnnotation = new XYLineAnnotation(i, 0, i,
RANGE_UPPER_BOUND, stroke, Color.black);
chart.getXYPlot().addAnnotation(xyLineAnnotation);
}
Thank You in Advance.