There are two ways you can allow users to select dates or time periods in a chart. The suggested way is to use HTML elements and interact with our API to get data to and from ZingChart.
- You can use HTML elements and our API to create this functionality relatively easy. You will leverage the API event 'zoom' to capture zoom events and use that for the values we are going to zoomTo. Outside of that event just make a couple buttons and zoom to an appropriate range when clicked on.
2. You can make buttons from shapes inside ZingChart so users to choose from pre-set time periods, as seen in this demo. This is not recommended way because its a separation of concerns. You want to keep charts elements inside the chart div and putting the buttons outside of ZingChart is a more modular approach.