Pre loader

Tag: CategoryAxis

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

0 votes
316 views

Hello,

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,
            })
            sciChartSurface.xAxes.add(xAxes)
            xyDataSeries = new XyDataSeries(wasmContext, { xValues, yValues })

Notes:
– 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

1 vote
2k views

Hi, we are using CategoryAxis to display stock data, however, as you can see in the image below, within the “same” candle or volume, divergent information is displayed.

am I doing something wrong?

Showing 2 results