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

Message ListMessage List     Post MessagePost Message

  Exclude week-ends/specific days for XYChart
Posted by Olivier on Oct-17-2017 19:02
Hello, I am drawing candlesticks using XYChart and CandleStickLayer.
I did not use FinancialChart class as I could not make it work with scrolling and zooming using ViewPortControl. I would like to exclude week-ends but setXData() method outputs them by default even if my timestamp serie (DoubleArray type) does not contain any. Could you please tell me if there is any way of getting rid of some specific chosen days so they will not be shown on the chart?

Thank you

  Re: Exclude week-ends/specific days for XYChart
Posted by Peter Kwan on Oct-18-2017 19:16
Hi Olivier,

In standard financial chart, the chart only plots trading days. It means it will ignore Saturdays and Sundays, national holidays, and other non-trading days due to natural phenomena or disasters (in my location, the stock exchange stop trading a few days per year due to hurricane or typhoon), or man-made events. That means the trading dates are somewhat random and unpredictable. The dates are only treated as "names" or "labels" for human reading. The x-coordinates in a financial chart are not date/time. (The x-positions are not determined using date/time.) It is the trading session number, which in programming can be considered as the array index is (0, 1, 2, 3, ......).

As this is a common question, there are quite a number of messages in the forum in various programming languages. For example:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1467686966#N1467721784

In brief, you do not need to use setXData at all. The full range is 0 to array_size - 1 (the range of the array index). Your code can determine the starting index and the ending index in the viewport, and construct the "visible data arrays" based on these indexes.

The above would work in FinanceChart or XYChart with Candlestick layer. I think using FinanceChart is easier. Both can use the Viewport Control.

Hope this can help.

Regards
Peter Kwan

  Re: Exclude week-ends/specific days for XYChart
Posted by Olivier on Oct-19-2017 06:19
Hello, I made it using FinanceChart class with ViewPortControl, thanks a lot !