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

Message ListMessage List     Post MessagePost Message

  Auto-Sizing Chart
Posted by Scott on Mar-20-2009 04:10
How do I use the new v5.0 feature that is supposed to auto size chart area to fit in a bounding box?

  Re: Auto-Sizing Chart
Posted by Peter Kwan on Mar-20-2009 08:37
Hi Scott,

The API for auto-sizing is XYChart.packPlotArea. Basically, it adjusts the plot area (inclusive of axis labels) to fit a bounding box provided by you. The bounding box can be the entire chart, or part of the chart (you may reserve space for chart title, legend box, or just reserve empty space as margins, etc).

You still need to use setPlotArea to provide an intial plot area size, but the size only need to be approximate. The packPlotArea should be called after the entire chart is configured.

Many ChartDirector sample charts use packPlotArea. If you have the CHM documentation, you may search for "packPlotArea" for a number of sample charts. Examples are "Gradient Bar Shading", "Missing Data Points",  "Bars with Marks", "Multi-Symbol Line Chart", etc..

In brief, you just create the chart as usual, using an approximate plot area size. Then after you have finished adding everything to the chart, call XYChart.packPlotArea to adjust the plot area size to fit the plot area (inclusive of axis labels) to a bounding box of your choice.

Hope this can help.

Regards
Peter Kwan