javascript - Highcharts/highstock mouse wheel scroll keeps scrolling on y-axis in -


i working on asp.net mvc 5, using dot net highcharts display data

i wanted add mouse wheel scrolling on y-axis when in zoom found bellow piece of code

(function (h) {      //internal functions     function stopevent(e) {         if (e) {             if (e.preventdefault) {                 e.preventdefault();             }             if (e.stoppropagation) {                 e.stoppropagation();             }             e.cancelbubble = true;         }     }      //the wrap     h.wrap(h.chart.prototype, 'render', function (proceed) {         var chart = this,           mapnavigation = chart.options.mapnavigation;          proceed.call(chart);          // add mousewheel event         h.addevent(chart.container, document.onmousewheel === undefined ? 'dommousescroll' : 'mousewheel', function (event) {              var delta, extr, step, newmin, newmax, axis = chart.yaxis[0];              e = chart.pointer.normalize(event);             // firefox uses e.detail, webkit , ie uses wheeldelta             delta = e.detail || -(e.wheeldelta / 120);             delta = delta < 0 ? 1 : -1;              if (chart.isinsideplot(e.chartx - chart.plotleft, e.charty - chart.plottop)) {                 extr = axis.getextremes();                 step = (extr.max - extr.min) / 5 * delta;                 axis.setextremes(extr.min + step, extr.max + step, true, false);             }              stopevent(event); // issue #5011, returning false non-jquery event not prevent default             return false;         });     }); }(highcharts)); 

but there problem

  1. the wheel scrolling infinite times
  2. i want enable when in zoom

jsfiddle link in comment section

any appreciated


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -