I am using this script to draw line charts :
function processData(allText) {
var allLinesArray = allText.split('\r\n');
if(allLinesArray.length>0){
var dataPoints = [];
for (var i = 1; i <= allLinesArray.length-1; i++) {
var rowData = allLinesArray[i].split(';');
dataPoints.push({label:rowData[0],y:parseInt(rowData[1])});
}
drawChart(dataPoints);
}
}
function drawChart( dataPoints) {
var chart = new CanvasJS.Chart("chartContainer", {
theme: "theme2",
zoomEnabled:true,
title:{
text: "RPM"
},
legend: {
horizontalAlign: "right",
verticalAlign: "center"
},
data: [
{
type: "line",
dataPoints: dataPoints
}]
});
chart.render();
}
The current code is zooming upon mouse click and dragging the zone. How to change it so I can zoom with the scroll wheel?
Note the following use undocumented internals from CanvasJS and can break in the future.
attach mousewheel event handler:
implement handler