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

Message ListMessage List     Post MessagePost Message

  Auto matic Y Axis legend calculation
Posted by icm63 on Dec-29-2013 11:55
Attachments:
Ref: I am using the CHART DIR Finance code

You have this code within the class, and it used by the PPO in the chart attached.

        Public Function addLineIndicator2(ByVal c As XYChart, ByVal data As Double(), ByVal color As Integer, ByVal name As String) As LineLayer
            Return c.addLineLayer(data, color, formatIndicatorLabel(name, data))
        End Function.


Please answer the question in red text within the image thanks! Please click the image to open the file.
Example.png
Example.png

38.31 Kb

  Re: Auto matic Y Axis legend calculation
Posted by Peter Kwan on Dec-30-2013 17:45
Hi icm63,

The auto-scaling algorithm is quite complicated and is proprietary. ChartDirector needs to consider many factors, including the data range of all the data sets, the chart and text geometry, axis scale type, and various configurable parameters (tick density, auto-scale margins, tick end-point rounding, symmetry configuration ...).

To obtain the scale determined by ChartDirector, first called XYChart.layoutAxes to ask ChartDirector to auto-scale the axis, then use Axis.getMinValue and Axis.getMaxValue to obtain the scale at the axis end points.

If you do not like the default scale generated by ChartDirector, you may use Axis.setTickDensity, Axis.setAutoScale, Axis.setRounding, Axis and XYChart.setAxisAtOrigin to configure the auto-scaling behaviour. For example, in your data, the minimum value is -29.9. ChartDirector chooses the minimum scale to be -35 instead of -30, probably because ChartDirector thinks the margin would be to small if -30 is used. If you do not want ChartDirector to add any margin at all, you may use Axis.setAutoScale to disable the scale margins (the default is 5% margin).

Hope this can help.

Regards
Peter Kwan