Home › forums › Using CanvasJS › CanvasJS – Get Current Time Range
This topic contains 4 replies, has 2 voices, and was last updated by patricia.krupa 2 years ago.
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
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.
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:
text: “Temperature History”
dataPoints: [ ]
legendText: “Temperature Set”,
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.
Setting intervalType to minute solved it! Thank you!
You must be logged in to reply to this topic.