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

Message ListMessage List     Post MessagePost Message

  finance chart - add percebtage Y axis as a second yAxis
Posted by Craig Roberts on Jun-15-2019 12:49
Hello Peter,

Is it possible to add a 2nd Yaxis to a financial chart as a percentage axis.
I see It can be done with other charts in the suite, but I tried and could not figure it out with the finance chart.

Regards
Craig Roberts

  Re: finance chart - add percebtage Y axis as a second yAxis
Posted by Peter Kwan on Jun-18-2019 04:22
Hi Craig,

If you referring to the FinanceChart object, this object has a method FinanceChart.setPercentageAxis that adds a percentage axis on the right side, and hide the original axis which displays price. It is because by default, the right y-axis is used for the price, and the left y-axis is used to display volume, so there is no good place to put the percentage axis except by hiding the price axis.

If you are not including volume bars in the main price chart, you can "unhide" the price axis and move the price axis to the left side. The code is like (in C#/Java):

FinanceChart f = new FinanecChart(.....);

// Add data as usual
f.setData(.....);

// Add the main price chart
XYChart mainChart = f.addMainChart(......);

// Add the percentage axis to the right side, which will also hide the price axis
f.setPercentageAxis();

// Unhide the price axis (which is the yAxis of the XYChart object)
mainChart.yAxis().setColors(Chart.LineColor, Chart.TextColor);

// Move the price axis to the left
mainChart.setYAxisOnRight(false);

//**** Make sure FinanceChart.addVolBars is not used. If you need to add volume bars,
//**** please add it as a separate indicator using FinanceChart.addVolIndicator.


Hope this can help.

Regards
Peter Kwan

  Re: finance chart - add percebtage Y axis as a second yAxis
Posted by Craig Roberts on Jun-18-2019 15:02
Thanks Peter.