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

Message ListMessage List     Post MessagePost Message

  分时图
Posted by 如何将XYChart的Y轴原点设置到轴的中心 on Dec-05-2018 21:04
目的:
     设置金融图历史分时图的涨跌幅。我想到的方法就是设置Y轴原点到轴中心。然后采取涨跌幅的最大最小值设置到Y轴。

  Re: 分时图
Posted by Peter Kwan on Dec-06-2018 17:19
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

  Re: 分时图
Posted by 如何将XYChart的Y轴原点设置到轴的中心 on Dec-07-2018 09:57
thanks,Peter Kwan!
    The method I use is that I add the data to the LineLayer and then set the line color to the background color. That's what I want!