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

Message ListMessage List     Post MessagePost Message

  DrawArea
Posted by Claude Kane on Dec-11-2012 07:24
Attachments:
I can not find a good code example for DrawArea.  Can you provide me something simple?

Tried below, but does not work.

I want to try and create a chart like the attached.

DrawArea c = new DrawArea();
            c.setSize(450, 450);


            c.arc(1, 1, 1, 1, 45, 135, 0xff0000);

            winChartViewer1.Chart = c;
new chart.docx
new chart.docx

95.96 Kb
new chart.docx
new chart.docx

95.96 Kb

  Re: DrawArea
Posted by Peter Kwan on Dec-11-2012 20:26
Hi Claude,

The standalone DrawArea can only output the image as an encoded image (PNG, JPG, BMP, GIF or SVG) in memory or as an image file. If you would like to display the result in a WinChartViewer (which is for viewing charts), instead of using a standalone DrawArea, I suggest you may use embedded DrawArea of a chart. It is like:

PieChart c = new PieChart(450, 450);
DrawArea d = c.makeChart3();
d.arc(1, 1, 1, 1, 45, 135, 0xff0000);

winChartViewer1.Chart = c;

I see that you have attached a Word document showing a chart inside. To create a similar chart, you may use an XYChart object. For the arcs in the chart, if I were you, I would draw them as spline curves. It is because it seems more natural to represent your arcs with "data coordinates" (the coordinates as used by the x and y axes), as opposed to pixel coordinates. If you use pixel coordinates, you may also need to worry about the aspect ratio of the grid (that is, one unit on the x-axis may not be equal to one unit in the y-axis in terms of pixel length).

To draw the arcs with a spline curve, simply computes some points along the curve (may be obtain one point for every 15 degrees), and use points for a spline layer (addSplineLayer). The curve should be visually indistinguishable from an arc.

Hope this can help.

Regards
Peter Kwan

  Re: DrawArea
Posted by Claude Kane on Dec-12-2012 00:46
OK, I guess this should be a scatter chart with a splinelayer.  Is this right?

Also, can Chart Director be used in a silverlight application?

  Re: DrawArea
Posted by Peter Kwan on Dec-13-2012 01:37
Hi Claude,

You can use a spline layer with x and y coordinates. The x coordinates can be set using setXData. It is like:

SplineLayer layer = c.addSplineLayer(dataY, ....);
layer.setXData(dataX);

Currently, for a web application, ChartDirector can only render charts on the server side. In a Silverlight application, ChartDirector can be used to render the charts on the server side. The Silverlight client can be used to display the chart.

Hope this can help.

Regards
Peter Kwan