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

Message ListMessage List     Post MessagePost Message

  How to know the labels number displayed on the vertical axis
Posted by moses on Jan-29-2024 22:10
I didn't set any scale or maxmin bound for the axis, how to know how many labels are displayed on the axis?

  Re: How to know the labels number displayed on the vertical axis
Posted by Peter Kwan on Jan-30-2024 13:52
Hi Moses,

Unless you set the scale for the vertical axis, ChartDirector will automatically determine the axis scale and labels based on all the data on the chart. ChartDirector will assume all the data have been added to the chart when one of the following happens:

(a) Your code call BaseChart.makeChart to generate the chart image or assign the chart to a chart viewer for display,

(b) Your code call BaseChart.layout or BaseChart.layoutAxes.

Note that after doing (a) or (b), you can no longer add layers to the chart (as your code should have already added all the data to the chart), but you can still modify the axis labels, add text, change colors, etc.

To get the axis min/max values, the APIs are Axis.getMaxValue and Axis.getMinValue. To get the position of the "ticks" on the axis, the API is Axis.getTicks. To determine the labels on the ticks, you can use Axis.getLabel.

The following post contains an example that iterates the ticks and custom format the axis labels (it is in C#, but the syntax is almost the same for C++):

See also:

Best Regards
Peter Kwan