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

Message ListMessage List     Post MessagePost Message

  How to show chart in a fixed area
Posted by hanson on Aug-08-2012 21:09
Hi Peter,
First of all, thank you for answering my question so that I can move on with ChartDirector.
I want to draw chart in a fixed area, that is to say, the chart will be in the place what i put
the component. As you know, Dim c As XYChart = New XYChart(300, 300)  and
c.setPlotArea(80, 30, 200, 200) will define the area of the chart totally, no matter where
you draw the chart.
Since I would have a few charts to show in one container, it will be difficult to adjust the
position of the chart in the forum. Is there any way to set the chart in a fixed area?
BTW, i program with VB in VS2008 with chartdirector dot net version.
Thanks a lot for your reply

  Re: How to show chart in a fixed area
Posted by Peter Kwan on Aug-09-2012 01:21
Hi hanson,

By "fixed area", do you mean you want to draw a chart to the same size of the "container", something similar to Windows Performance Monitor (perfmon) or the charts in the Task Manager? If this is the case, just draw it at the same size of the container, like:

Dim c As XYChart = New XYChart(myContainer.Size.Width - 4, (myContainer.Size.Height - 4)
c.setPlotArea(80, 30, c.getWidth() - 100, c.getHeight() - 80)
.....

If the container can change size, you can redraw the chart in the "SizeChanged" event of the container. You may put all your charting code in a subroutine, and call that subroutine in the resize event. Note that if your container can become very small (like 1 pixel in size), you may need to design your charting code to handle these special cases (may be not to draw the chart if there is insufficient space for the plot area, or just draw an icon or thunbnail).

(The charts in the Windows performance monitor or Task Manager are also redrawn when the container resizes.)

Hope this can help.

Regards
Peter Kwan

  Re: How to show chart in a fixed area
Posted by hanson on Aug-09-2012 23:15
Hi Peter,
thanks a lot for your reply. Your answer just solved my problem!