Viewport is the visible range of the axis and viewportMinimum allows you to set its minimum value. This can be used in combination with viewportMaximum in order to zoom into a certain region programmatically.
Default: Automatically Calculated based on the data
Example: -100, 350..
- viewportMinimum and viewportMaximum are useful in setting the initial zoom in a chart.
- If viewportMinimum and viewportMaximum are not set, minimum and maximum values of axis will become the viewport’s range.
- Setting viewportMinimum or viewportMaximum will make the zoom/pan toolBar visible. Clicking the reset button will set the viewport range to viewportMinimum and viewportMaximum.
- Setting viewportMinimum and viewportMaximum of all axis to null will hide the toolBar – equivalent to clicking reset button.
var chart = new CanvasJS.Chart("container",
{
.
.
axisY:{
viewportMinimum: -50,
viewportMaximum: 50
},
.
.
});
chart.render();
Is it possible to hide the viewportMinimum value: -500 in this example?
You can dynamically set the viewportMinimum as shown below.
chart.options.axisY.viewportMinimum = yourVariable;