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

Message ListMessage List     Post MessagePost Message

  关于XYChart跳过一个固定的时间段
Posted by idaks on Sep-23-2016 17:38
x轴是由时间戳组成的一个doubleArray。

我想跳过中间的某个时间段。

比如:显示10::00 到 11:00,然后紧接着显示 13:00 到 14:00

跳过中间的两个小时,11:00 后面紧接着的就是 13:00

我该如何实现呢?

  Re: 关于XYChart跳过一个固定的时间段
Posted by Peter Kwan on Sep-24-2016 03:05
Hi idaks,

This kind of axis is commonly used in financial charts. In financial charts, we often skip Saturdays and Sundays. For intraday chart, we may skip lunch hours and other non-trading hours.

The method to create the chart is to treat the x-data as labels. It is like:

c->addBarLayer(DoubleArray(yData, size), ...);

c->xAxis()->setLabels(DoubleArray(xData, size));
c->xAxis()->setLabelFormat("{value|hh:nn}");

If you have many x-axis labels, and you only want to display some of them, you can use Axis.setLabelStep, or you can use Axis.setMultiFormat with filters. An example is:

// Only display the labels which are the first label of an hour
c->xAxis()->setMultiFormat(Chart::StartOfHourFilter(), "{value|hh:nn}");

See:

http://www.advsofteng.com/doc/cdcpp.htm#Axis.setMultiFormat.htm
http://www.advsofteng.com/doc/cdcpp.htm#Axis.setMultiFormat2.htm

Hope this can help.

Regards
Peter Kwan

  Re: 关于XYChart跳过一个固定的时间段
Posted by idaks on Sep-24-2016 10:11
Attachments:
i mean like this.

the time is 11:00, also is 13:00.

and the 11:00~13:00 are passed.

what should i do for that result.
无标题.png

  Re: 关于XYChart跳过一个固定的时间段
Posted by idaks on Sep-24-2016 11:32
oh!!!

i konw.

don't set the Layer Xdata from TimeStamps.

use the "setLabels".

//layer->setXData(viewPortTimeStamps);
c->xAxis()->setLabels(viewPortTimeStamps);

thanks for your time.