SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


Hi David,

I don’t think this is a bug, but the expected behaviour of the CategoryDateTimeAxis. Please see our article on Category Axis vs. Value Axis here.

Value Axis vs. Category Axis

SciChart ships with a value-axis and a category axis to handle DateTimes. The Value axis includes the Date-value when measuring the X-coordinate, e.g. a sequence of dates such as Monday, Tuesday, Wednesday, Monday, Tuesday, Wednesday will have a large X-gap between the Wednesday / subsequent Monday points. However the CategoryDateTimeAxis is a category axis and would treat each data-point (regardless of value) as equally spaced in the X-direction. As an illustration, consider the following screenshots of SciChart with a DateTimeAxis and CategoryDateTimeAxis respectively, which renders stock price data with gaps overnight (outside of trading hours):

What we do in our examples is we ensure DataSeries on a CategoryDateTImeAxis have the same number of data-points. We do this by pre-pending Moving Averages with double.NaN (a null value). So you can see in the Candlestick and Lines example, the series have different numbers of data-points but are aligned because of padding values.

Best regards,

  • David T
    Ok, I saw the use of the double.NaN (null values) prior to writing this question on the forum. It seems like making sure that each DataSeries has the same amount of DataPoints and not having a main DataSeries, e.g. the Price DataSeries and having everything else automatically (XAxis) lining up with it is a missing feature. This would cause quite a headache when adding & removing different new DataSeries on fly in a RealTime charting situation and it runs the risk of SciChart not representing the correct data if not padded by NaN values correctly??! Surely, for example, AutoRange and the XAxis scaling uses a main DataSeries for its calculations. Is there no more elegant workaround than the dangerous NaN usage? David
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.