UNPKG

highcharts

Version:
13 lines 5.38 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/mouse-wheel-zoom * @requires highcharts * * Non-cartesian series zoom module * * (c) 2024-2026 Highsoft AS * Author: Hubert Kozik * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts):"function"==typeof define&&define.amd?define("highcharts/modules/non-cartesian-zoom",["highcharts/highcharts"],function(t){return e(t)}):"object"==typeof exports?exports["highcharts/modules/non-cartesian-zoom"]=e(t._Highcharts):t.Highcharts=e(t.Highcharts)}("u"<typeof window?this:window,t=>(()=>{"use strict";var e={944:e=>{e.exports=t}},o={};function i(t){var s=o[t];if(void 0!==s)return s.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};i.d(s,{default:()=>x});var r=i(944),n=i.n(r);let{doc:a,win:l}=n();function h(t,e,o,i={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let r=s.hcEvents;n().Point&&t instanceof n().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,o,!!n().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==e.indexOf("touch"):i.passive,capture:!1}),r[e]||(r[e]=[]);let l={fn:o,order:"number"==typeof i.order?i.order:1/0};return r[e].push(l),r[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,o){function i(e,o){let i=t.removeEventListener;i&&i.call(t,e,o,!1)}function s(o){let s,r;if(t.nodeName){e?(s={})[e]=!0:s=o;var n=s,a=function(t,e){if(o[e])for(r=o[e].length;r--;)i(e,o[e][r].fn)};for(let t in n)Object.hasOwnProperty.call(n,t)&&a.call(n[t],n[t],t,n)}}let r="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(r,"hcEvents")){let t=r.hcEvents;if(e){let r=t[e]||[];o?(t[e]=r.filter(function(t){return o!==t.fn}),i(e,o)):(s(t),t[e]=[])}else s(t),delete r.hcEvents}}(t,e,o)}}Array.prototype.find;let{composed:p}=n();function c(t){let e=this,{trigger:o,selection:i,reset:s,from:r={},to:n={}}=t;"xy"===e.zooming.type&&("mousewheel"===o||"pan"===o||i||s)&&e.series.forEach(i=>{if(!i.isCartesian&&!1!==i.options.zoomEnabled){i.isDirty=!0,e.isDirtyBox=!0,t.hasZoomed=!0;let{plotWidth:s=0,plotHeight:a=0}=e;if("pan"===o&&i.zooming)i.zooming.panX-=(n.x||0)/s,i.zooming.panY-=(n.y||0)/a;else if(Object.keys(r).length){let{width:t=1,height:o=1}=n,l=Math.abs(i.group?.scaleX||1),{x:h=0,y:p=0,width:c=1,height:f=1}=r,u=h,d=p,m=i.zooming?.scale||i.group?.scaleX||1,g=(i.zooming?.width||1)*s,y=(i.zooming?.height||1)*a;if(Object.keys(n).length)g=c/t*g,y=c/o*y,h-=e.plotLeft,p-=e.plotTop,u=h-g/2,d=p-y/2,m=Math.min(s/g,a/y);else{c/=l,f/=l,m=Math.min(s/c,a/f);let t=0,o=0;i.zooming&&(t=i.zooming.x*s,o=i.zooming.y*a);let r=(h-e.plotLeft)/(s-c*l||1),n=(p-e.plotTop)/(a-f*l||1);g=c,y=f,h-=e.plotLeft,p-=e.plotTop,h/=l,p/=l,h+=t+c*r,p+=o+f*n,u-=e.plotLeft,d-=e.plotTop,u/=l,d/=l,u+=t,d+=o}i.zooming={x:u/s,y:d/a,zoomX:h/s,zoomY:p/a,width:g/s,height:y/a,scale:m,panX:0,panY:0},m<1&&delete i.zooming}else delete i.zooming}})}function f(t){let{chart:e,group:o,zooming:i}=this,{plotSizeX:s=0,plotSizeY:r=0}=e,{scale:n,translateX:a,translateY:l,name:h}=t,p=0,c=0,f=a,u=l;e.inverted&&([s,r]=[r,s]),o&&i&&(n=i.scale,p=i.zoomX*s*(n-Math.abs(o.scaleX||1)),c=i.zoomY*r*(n-Math.abs(o.scaleY||1)),"series"===h&&(i.x=Math.max(0,Math.min(1-i.width,i.x+i.panX/n)),p+=i.panX*s,i.panX=0,i.y=Math.max(0,Math.min(1-i.height,i.y+i.panY/n)),c+=i.panY*r,i.panY=0),a=(o.translateX||f)-p,(l=(o.translateY||u)-c)>u?l=u:(o.translateY||u)-c<r*(1-n)+u&&(l=r*(1-n)+u),a>f?a=f:a<s*(1-n)+f&&(a=s*(1-n)+f),t.scale=n,t.translateX=a,t.translateY=l)}function u(){let t;this.series.find(t=>!!t.zooming)&&(this.zoomClipRect||(this.zoomClipRect=this.renderer.clipRect()),this.zoomClipRect.attr({x:this.plotLeft,y:this.plotTop,width:this.inverted?this.clipBox.height:this.clipBox.width,height:this.inverted?this.clipBox.width:this.clipBox.height}),t=this.zoomClipRect),this.seriesGroup?.clip(t),this.series.forEach(e=>{e.dataLabelsParentGroups?.forEach(e=>{e.clip(t)})})}function d(t){if(t.point.series&&!t.point.series.isCartesian&&t.point.series.group&&t.point.series.zooming){let e=t.point.series.chart,o=t.point.series.zooming.scale,i=t.point.series.group.translateX||0,s=t.point.series.group.translateY||0;t.ret[0]=t.ret[0]*o+i-e.plotLeft,t.ret[1]=t.ret[1]*o+s-e.plotTop}}function m(t){t.skipAxes&&this.series.forEach(t=>{t.group&&t.zooming&&t.group.attr({translateX:0,translateY:0,scaleX:1,scaleY:1})})}function g({index:t,zIndex:e}){var o;this.hasDataLabels?.()&&(this.dataLabelsParentGroups||(this.dataLabelsParentGroups=[]),(o=this.dataLabelsParentGroups)[t]||(o[t]=this.chart.renderer.g().attr({zIndex:e}).add()))}let y=class{static compose(t,e,o){var i;i="NonCartesianSeriesZoom",0>p.indexOf(i)&&p.push(i)&&(h(t,"afterDrawChartBox",u),h(t,"transform",c),h(t,"afterSetChartSize",m),h(e,"getPlotBox",f),h(e,"initDataLabelsGroup",g),h(o,"getAnchor",d))}},v=n();v.NonCartesianSeriesZoom=v.NonCartesianSeriesZoom||y,v.NonCartesianSeriesZoom.compose(v.Chart,v.Series,v.Tooltip);let x=n();return s.default})());