|
Remove weekends on X Axis for daily stock price chart |
Posted by Raul Fiedler on Aug-19-2011 20:59 |
|
useing Java and a normal XYChart
Price data is in a candel layer.
Dates are set using layer.setXData(dates)
This is very convenient, because the x axis labes are perfectly spaced when scrolling and
zooming. However I get gaps on the weekends. Hence between Friday and Monday there is
a hole, because x Axis also includes Sat and Sun.
Is there a convenient approach to get rid of the weekend-gaps?
Thank you very much in advance |
Re: Remove weekends on X Axis for daily stock price chart |
Posted by Peter Kwan on Aug-20-2011 00:26 |
|
Hi Raul,
There is an example based on the FinanceChart object below:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1176387267#N1287084794
Bascially, for a standard financial chart, the date/time axis is arbitrary and unpredictable. (It may need to exclude Sat, Sun and national holidays and other non-trading days due to hurricane or typhoon or some other unpredictable events.) As the date/time are arbitrary and cannot be used to position the data points, they are best treated as "names" for human reading. So instead of using setXData, it is suggested you use Axis.setLabels to handle the x-axis labels. To handle zooming and scrolling, you just need to pass the labels selected by the user to ChartDirector.
Hope this can help.
Regards
Peter Kwan |
|