Home › forums › Using CanvasJS › viewPort Max/Min with date value
This topic contains 3 replies, has 2 voices, and was last updated by Manoj Mohan 4 months ago.
I’m building a ocean tide chart.
I have tides for 14 days on a spline area chart.
The issue is it shows all 14 days at once.
I need to be able to set the default view port of the chart to one day, with the users ability to pan/scroll on xAxis (left right) to other days.
You can programmatically zoom into a region by setting viewportMinimum and viewportMaximum.
To zoom into a certain region, there should be a minimum of 3-4 dataPoints – behavior is designed such that zooming is limited upto a certain region, so the user doesn’t end up zooming into a blank-region (region with no dataPoints). Due to this restriction, it’s not possible to pan chart as you zoom into the region with just 1 dataPoint.
How would you setup a zoom for a date/time value on the xAxis?
You can set the viewportMinimum as viewportMinimum: new Date(2019,03,14) and viewportMaximum as viewportMaximum:new Date(2019,04,14) to achieve zooming programmatically over data/time axisX type.
viewportMinimum: new Date(2019,03,14)
You must be logged in to reply to this topic.