ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  xy chart with arc color zones - c# winforms
Posted by Claude Kane on Sep-03-2014 00:06
Attachments:
I am having difficulty drawing arc color zones.  Please see attached graphic.  I really do not want to add background pictures since the size of charts will vary.
Suggestions appreciated as always.
zones.PNG

  Re: xy chart with arc color zones - c# winforms
Posted by Peter Kwan on Sep-03-2014 02:16
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

  Re: xy chart with arc color zones - c# winforms
Posted by Peter Kwan on Sep-03-2014 02:19
Hi Claude,

I have just recalled that is a DrawArea.sector method that can draw sectors. For method
(c) in my last message, you can use DrawArea.sector to draw sectors instead of "drawing
circles and clipping to the plot area".

Regards
Peter Kwan