Pre loader

Adding Datetime to xAxes with FastLineRenderableSeries

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums



I am trying to make my xAxes values to be in datetime, specifically i want to try and get the seconds since my graph will be 20 seconds worth of data.

I checked the Javascript examples however all of them resulted in a wrong date

            // ? Getting start Date
            const startDate = new Date(timestamp).getTime()
            // ? yValues Array size
            const totalPoints = yValues.length
            // ? Getting end Date
            const endDate = startDate + (totalPoints - 1) * 64
            // ? xValues Array. startDate + i * 64 ms
            const xValues = Array.from({ length: totalPoints }, (_, i) => startDate + i * 64)

            // ? xAxes
            const xAxes = new CategoryAxis(wasmContext, {
                defaultXStart: startDate,
                defaultXStep: 64,
                defaultXEnd: endDate,
                labelProvider: new SmartDateLabelProvider(),
                axisAlignment: EAxisAlignment.Bottom,
                autoRange: EAutoRange.Always,
                drawMajorGridLines: false,
                drawMinorGridLines: false,
            xyDataSeries = new XyDataSeries(wasmContext, { xValues, yValues })

– xValues array consists of 320 values from start date to end date going up by 64ms
– Yes all the values of xValues are correct, console logged and checked them manually
– I tried DateTimeNumericAxis but it resulted in the same thing as the below screenshot

  • You must to post comments

The key think to know is that (for historical reasons no-one can remember) scichart.js expects date values for axes to be in seconds, not milliseconds, so just divide everything by 1000 and the formatting will then give you the values you expect.


  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.