Hi Claude,
I can think of three methods:
(a) Use a background image. You can ask ChartDirector to resize the image to fit the plot
area size, so it can work for charts of different size. The code is like:
PlotArea p = c.getPlotArea();
c.addText(p.getLeftX(), p.getTopY(),
"<*img=/path/to/background.png*,width=" + p.getWidth() + ",height=" + p.getHeight() +
"*>").setZOrder(Chart.PlotAreaZ);
(b) You may consider to use a contour layer to create such a chart. You would need to
come up with the data points that will produce this type of contours.
(c) You may use the DrawArea API to draw circles on the chart background, clipped to
the plot area. With this method, the plot area itself must have a transparent background
to avoid covering the circles. The code is like:
PlotArea p = c.getPlotArea();
DrawArea d = c.getDrawArea();
d.setClipRect(p.getLeftX(), p.getTopY(), p.getRigthX(), p.getBottomY());
d.circle(.......);
d.circle(.......);
......
//remember to reset the clip rectangle
d.setClipRect(0, 0, c.getWidth(), c.getHeight());
Hope this can help.
Regards
Peter Kwan |