ChartDirector 6.0 (ColdFusion Edition)

XYChart.packPlotArea


Usage

packPlotArea(leftX, topY, rightX, bottomY [, minWidth [, minHeight ]])

Description

Adjusts the plot area size and position to fit the plot area and the axis labels in a bounding box.

In some charts, the axis labels may vary widely and can be very short or very long. It may be difficult to determine to plot area position and size so as to reserve reasonable and sufficient space for the axis labels.

This method adjusts the size and position of the plot area, so that the plot area, together with the axis labels can fit within a given bounding box.

Note that this method only adjusts for the thickness of the primary and secondary axes, and assumes they are at the border of the plot area. For other axes, you may use Axis.getThickness to get their thickness and adjust the plot area size and position accordingly.

For this method to determine the thickness of the axes, it needs to auto-scale the axes to determine the axis labels. That means all the data should be entered to the chart before calling this method.

Furthermore, the labels generated by auto-scaling depend on the number of labels that can fit on the axis, which in turn depends on the plot area size. So even the final plot area size is determined by this method, the XYChart.setPlotArea must still be used to set a reasonable initial plot area size.

To adjust only the plot area width and horizontal position, and leave the height and vertical position unchanged, simply use a bounding box with zero height (eg. set both topY and bottomY to 0). Similarly, to adjust only the height and vertical position, use a bounding box with zero width.

In some extreme cases, the axis labels may be so long that the plot area needs to adjust to an unreasonably small size, or even zero in size. For example, the axis labels may be names entered by the user, and the user may enter a name thousands of characters long. These extreme cases should be avoided by checking and limiting the length of the labels before passing the labels to ChartDirector. This method also has a safeguard for these unreasonable labels by ensuring the plot area will not shrink below a given minimum size.

Arguments

ArgumentDefaultDescription
leftX(Mandatory)The left x coordinate of the bounding box.
topY(Mandatory)The top y coordinate of the bounding box.
rightX(Mandatory)The right x coordinate of the bounding box.
bottomY(Mandatory)The bottom y coordinate of the bounding box.
minWidth0The minimum width the plot area can adjust to.
minHeight0The minimum height the plot area can adjust to.

Return Value

None