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

Message ListMessage List     Post MessagePost Message

  XYChart - Financial - Left Axis crazy
Posted by icm63 on Jun-02-2019 08:10
Stock price data for CLF

Comparing highs and lows of yAxis on the left hand side of XYCHART.

*** Left Axis Line code ***
Dim myLine As LineLayer =  DrawLayer.addLineLayer(Close, AdjPriceColor, "Line")

*** Left Axis OHLC code ****
Dim myOHLC As HLOCLayer = DrawLayer.addHLOCLayer(High, Low, Open, Close, AdjPriceColor, AdjPriceColor)

Now compare yAxis low to high range for the exact same dataset, for Line and OHLC layer...

QUESTION : Why is it different? I wish it to be the same. yaxis().AutoScale makes no difference

  Re: XYChart - Financial - Left Axis crazy
Posted by Peter Kwan on Jun-02-2019 18:44
Hi icm63,

By default, ChartDirector will use the default auto scale parameters, which will start the y-axis from 0 unless the data range is small. It is because this is appropriate for most common chart applications.

However, for financial chart styles, it will not have a preference to start the y-axis from 0, because it is traditionally how financial charts are plotted.

A HLOCLayer is treated as a financial style layer, while a line layer is just a generic layer. That's why they have different auto-scale behaviour.

You may use Axis.setAutoScale to configure the auto-scale parameters to override the default. The yAxis().setAutoScale will have no effect in your code, because your code uses  the secondary y-axis (yAxis2), not the default y-axis (yAxis). You may try:

DrawLayer.yAxis2().setAutoScale(0.1, 0.1, 0)

Hope this can help.

Peter Kwan