Home › forums › Using CanvasJS › How to use viewport on dates
This topic contains 5 replies, has 2 voices, and was last updated by mitul 1 year, 11 months ago.
I have a column chart displaying units of electricity used every day on the y axis and the date in dd-mm-yy format on x axis. The data logger sends in all the data at once(for the whole year). So i have a very cluttered chart which i need to zoom manually to see properly. How can I zoom it in program to view only the last months data and then pan left to view the remaining dates?
You can use viewportMinimum and/or viewportMaximum to zoom to a specific region by default or to handle zooming programmatically.
Thanks for the reply. But can you please tell me how to use viewportminimum/maximum with dates. Suppose i want to display only the current months data from a total dataset of the whole year. The date format displayed on x axis is dd-mm-yy.
You can set viewportMinimum to one month less than the last dataPoint. Here is an example.
Thanks Vishwas. Will try it out.
Works great. Thanks.
You must be logged in to reply to this topic.