You must be logged in to post your query.
Home › Forums › Chart Support › CanvasJS – Get Current Time Range
Hallo,
i need to write a chart that deals with a large number of datapoints collected on a device, more then a million after after a year. For that i am writing a dynamic fetching mechanismus that gets more detailed data after zooming. Is there a way to get the current start and end date of a rendered chart ? (The Values on X-Axis are Dates)
I found the “intervalStartPosition”, which would be close to the “enddate”, far right axis point, however i dont see a value with contains the other end.
Is there a way to access those informations ?
Thank you very much
@patricia-krupa,
Please have a look at viewPortMinimum, viewPortMaximum, minimum, maximum.
Also you can go through rangeChanged and rangeChanging events which are triggered after/before viewportMinimum or viewPortMaximum are updated while zooming, panning, or reset. ___ Suyash Singh Team CanvasJS
However, those values are some Integers, how can i get the Date values ? Can i set somewhere the type to Date ?
My options object looks like this: { zoomEnabled: true, title: { text: “Temperature History” }, rangeChanged: null, data: [ { type: “line”, showInLegend: true, name: “Temperature”, legendText: “Temperature”, lineThickness: 1, markerType: “circle”, //markerSize: 3, legendMarkerType: “circle”, dataPoints: [ ] }, { type: “line”, legendText: “Temperature Set”, name: “TemperatureSet”, showInLegend: true, lineThickness: 1, markerType: “triangle”, //markerSize: 3, legendMarkerType: “triangle”, dataPoints: [] } ] }
You can pass x-values as either timestamp or in valid date format to use date-time over axisX. Also to set the type of the axisX interval you can use intervalType.
If this doesn’t solve your requirement, can you kindly create a jsfiddle so that we can look into it and help you out better.
___ Suyash Singh Team CanvasJS
Setting intervalType to minute solved it! Thank you!
You must be logged in to reply to this topic. Login/Register