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

Message ListMessage List     Post MessagePost Message

  MFC using labels method
Posted by Robo on Jun-14-2016 17:14
Is ther similar method from finance charts like :
rantable->setDateCol(0, Chart::chartTime(2002, 9, 4), 86400, true);
for set  labels, ploting only yers and months name ?

  Re: MFC using labels method
Posted by Peter Kwan on Jun-15-2016 01:04
Hi Robo,

The rantable->setDataCol are just generating some time series. The actual labels are determined by code inside the FinanceChart object.

I am not sure you configure the x-axis and x-coordinates in your chart. For financial chart, it is standard to treat the timestamps just as labels for human reading, and financial charts do not x-coordinates. The FinanceChart may or may not display only years and months. For example, if the time range is small (eg. 50 days), it may labels every 10 days instead of display just one or two monthly labels. If the time range is large (eg. 10 years), it may display yearly labels with no months. It also depends on the size of the chart, as it determines how many labels can be fit to the x-axis.

For your case, if you are using a real date/time axis (your code is using setXData to set the x-coordinates, which are created with Chart::chartTime or Chart::chartTime2), and if you want to set the labels with your own code, you can use Axis.setDateScale and specify a monthly tick (the tick increment can be 30 * 86400 or its multiples). If you prefer to let ChartDirector automatically determine the x-axis labels, ChartDirector may use monthly labels or other kinds of labels, depending on the date range of your actual data. You can still specify the minimum label spacing by using Axis.setTickDensity. The "Zooming and Scrolling with Track Line (1) (MFC)" sample code includes code that formats the x-axis in which the date range can be from 1 hour to several years. May be you can use them as a reference.

If you need further help, would you mind to inform me of more details? Are you using x-coordinates with Layer.setXData, or are they just labels like in the FinanceChart? (FinanceChart does not actually use x-coordinates because the date/time are rather random - it does not include non-trading days like Saturdays and Sundays and national holidays and other non-trading days due to unpredictable natural phenomena such as hurricanes and typhoon, etc.. Standard financial charts are always plotted as equally spaced even though the date/time are randomly spaced, so the position of the data does not depend on the date/time and the date/time is only for human reading as labels.) What can be the time range of your data?

Regards
Peter Kwan