I am working with this chart and data on a seconds level/granularity and plotting tens of thousands or sometimes hundreds of thousands of seconds of data. SciChart is doing something weird with the time range on zooming in and out. Are there ways to control what the DateTimeAxis displays?
time data:
2024-09-06 08:55:55
2024-09-06 08:48:58
2024-09-06 08:40:06
2024-09-06 08:30:42
2024-09-06 08:26:53
2024-09-06 08:22:41
2024-09-06 08:20:49
2024-09-06 08:17:39
2024-09-06 08:17:03
function updateChartInitial(data) {
const timestamps = new Float64Array(data.map(d => new Date(d.timestamp).getTime()));
const prices = new Float64Array(data.map(d => d.trade_price));
const volumes = new Float64Array(data.map(d => d.agg_volume));
// Clear previous data and append new data to priceSeries
priceSeries.dataSeries.clear();
priceSeries.dataSeries.appendRange(timestamps, prices);
// Clear previous data and append new data to volumeSeries
volumeSeries.dataSeries.clear();
volumeSeries.dataSeries.appendRange(timestamps, volumes);
// Set Y-axis range based on price data
const minPrice = Math.min(...prices);
const maxPrice = Math.max(...prices);
yAxisPrice.visibleRange = new NumberRange(minPrice, maxPrice);
sciChartSurface.zoomExtents();
}
Is there some need to convert to milliseconds and / 1000 or something like this?
Regards
Matt
- Matt Pen asked 1 month ago
- You must login to post comments
Hi
For lost-in-the-distant-past reasons, SciChart’s DateTime formatting expects timestamps in seconds, so you need new Date(d.timestamp).getTime() / 1000
Regards
David
- David Burleigh answered 3 weeks ago
- You must login to post comments
Please login first to submit.