I’ve got a line chart in my app using ApexCharts:
import ApexCharts from "apexcharts";
var options = {
chart: {
type: "line",
},
series: [
{
name: "sales",
data: [30, 40, 35, 50, 49, 60, 70, 91, 125],
},
],
xaxis: {
categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999],
},
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
When I hover the chart and scroll using the mouse wheel, the chart zooms in/out. How do I disable this behavior while still allowing to select areas of the chart to Zoom (just disable the scroll wheel behavior)?
2
Answers
in your chart object, set
chart.zoom.enabled
tofalse
https://apexcharts.com/docs/options/chart/toolbar/#zoom
Note: original question did not mention still allowing to select areas of the chart to zoom
To disable the zoom when using the mouse wheel, you can use the property
chart.zoom.allowMouseWheelZoom
For example, the code below disables the zoom for scrolling only (The area can still be zoomed in on by selecting it):