Hi,
If your y-axis scale is automatically determined by ChartDirector based on your data, you can use XYChart::setAxisAtOrigin to force an axis to be +/- symmetrical against the 0 line. For example, the y-axis can become y = -80 to +80.
See:
https://www.advsofteng.com/doc/cdcpp.htm#XYChart.setAxisAtOrigin.htm
https://www.advsofteng.com/doc/cdcpp.htm#fourq.htm
For example:
c->setAxisAtOrigin(Chart::XAxisAtOrigin, Chart::YAxisSymmetric);
In a FinanceChart, for the MACD indicator, the y-axis scale is automatically determined based on data, so the code is like:
XYChart *macd = c->addMACD(75, 26, 12, 9, 0x0000ff, 0xff00ff, 0x008000);
macd->setAxisAtOrigin(Chart::XAxisAtOrigin, Chart::YAxisSymmetric);
Hope this can help.
Regards
Peter Kwan |