|
x axis labes to few |
Posted by oded orbach on Jan-25-2013 19:22 |
|
Hello Peter,
I use between 30 to 200 bars in a finance chart. Labels are @ cd.ntime format (i.e 23/01/13 12:25:35 variantdate format).
No axis manipulation is done.
All i see are 2 x labels(?) , 1 with date and 1 time only.
my data bars are usually 1 to 2 minutes long, sometimes 30 seconds.
The data could be intraday data, or multiday from database, all in real time updates ( 1 second apart).
I use vb6.
THANK YOU,
Oded |
Re: x axis labes to few |
Posted by Peter Kwan on Jan-26-2013 01:28 |
|
Hi oded,
Is it possible to attach an example so I may know the details about what the chart looks like?
Note that for an intraday chart, the most common style is to represent the entire trading day on the x-axis, irrespective of the actual amount of data present. If you look at the intraday finance chart of common web sites during trading hours (eg. Yahoo Finance), you can see the x-axis always shows the entire trading day, even if the trading day has just started and there are only a few data points.
So for your data, for intraday charts, the timeStamps array should always contain the timeStamps for the entire day. The highData, lowData, openData, closeData and volData should contain the actual data available. It means the timeStamps array can be longer than the other arrays.
The FinanceChart object is designed so that for intraday charts, it will show at most 1 label per hour. As far as I know, this suits all stock exchanges as a trading day should contain quite a number of trading hours (so there should be quite a number of labels).
Apart from using timeStamps array that are two short, another common reason for an abnormally small number of labels is that the timeStamps are not sorted. ChartDirector assumes the timeStamps are sorted and will determine the labelling rules based on this. If the timeStamps are not sorted, the labels may be unexpected.
Regards
Peter Kwan |
Re: x axis labes to few |
Posted by oded orbach on Jan-26-2013 03:15 |
|
Thank you Peter,
Attached 2 charts.
what i am looking for is x labels that show many ticks and labels, a must is exact hourly and daily labels. |
Re: x axis labes to few |
Posted by oded orbach on Jan-26-2013 03:19 |
|
2 files here
|
Re: x axis labes to few |
Posted by oded orbach on Jan-26-2013 03:31 |
|
another chart, manual labels this time.
no major hour ticks and labels, no new day labels.
btw, all index values in top are the same. why?
|
Re: x axis labes to few |
Posted by Peter Kwan on Jan-28-2013 00:11 |
|
Hi oded,
As mentioned in my previous email, the built-in labelling system in FinanceChart assumes the shortest chart is an intraday chart which covers the whole trading day, and that there will be no more than 1 label per hour. In your "chart 1", the duration is around 2 hours. This is much less than 1 trading day, and as there will be no more than 1 label per hour, so only two labels are displayed.
If you would like to plot less than 1 trading day, and prefer other labelling schemes, there are two methods:
(a) Use custom labelling (see below on "chart 3")
(b) Modify the FinanceChart source code included in the ChartDirector distribution. In the code, the labels are determined in the setXLabels method. You may extend it to support duration of less than 1 trading day. See:
http://www.advsofteng.com/doc/cdcom.htm#FinanceChart.htm
For "chart 2", ChartDirector does not use hourly labels, because this would produce too many labels on the x-axis so that the label spacing is less than the minimum label spacing. The minimal label spacing is configurable using FinanceChart.setDateLabelSpacing and defaults to 50 pixels. If you use a small mnimal label spacing (say 10 pixels), ChartDirector probably would choose to use hourly labels.
For "chart 3", you mentioned that you are using "manual labels". I assume this means you are specifying the labels with your own code by calling Axis.setLabels, which would be something similar to:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1245339010#N1245409768
As your code specifies the labels, you can always choose any labels you like. For example, if you would like to have a label at 15:00 or at the start of each hour, you code can freely add a label there. This method can also solve the prolem for "chart 1" above.
For the legend entry, it shows Open, High, Low, Close all as 1196. I am not sure what is your actual data. In your chart, the last candlestick seems to be empty. It is possible the last candlestick really has high/low/open/close all having the same value, and it is not visible because the candlestick (which would be 1 pixel high) is hidden by your mark line at 1195.94.
Also, I noted that the same legend entry occurs in "chart 1". For "chart 1", the close seems to be at 1195.95, and the high/open are at around 1196.25. The legend labels are probably formatted using a precision of 4 signficiant digits, so they are all formatted as 1196. The numeric label format is configurable using FinanceChart.setNumberLabelFormat. The default is "P3". (See "Parameter Substitution and Formatting" for the meaning of the format specification.)
Hope this can help.
Regards
Peter Kwan |
|