UNPKG

highcharts

Version:
13 lines 4.58 kB
!/** * Highcharts JS v13.0.1 (2026-08-17) * @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}};let o={};function i(t){let a=o[t];if(void 0!==a)return a.exports;let s=o[t]={exports:{}};return e[t](s,s.exports,i),s.exports}i.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{if(Array.isArray(e))for(var o=0;o<e.length;){var a=e[o++],s=e[o++];i.o(t,a)?0===s&&o++:0===s?Object.defineProperty(t,a,{enumerable:!0,value:e[o++]}):Object.defineProperty(t,a,{enumerable:!0,get:s})}else for(var a in e)i.o(e,a)&&!i.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let a={};i.d(a,{default:()=>u});var s=i(944),r=i.n(s);let{composed:n}=r();function h(t){let e=this,{trigger:o,selection:i,reset:a,from:s={},to:r={}}=t;"xy"===e.zooming.type&&("mousewheel"===o||"pan"===o||i||a)&&e.series.forEach(i=>{if(!i.isCartesian&&!1!==i.options.zoomEnabled){i.isDirty=!0,e.isDirtyBox=!0,t.hasZoomed=!0;let{plotWidth:a=0,plotHeight:n=0}=e;if("pan"===o&&i.zooming)i.zooming.panX-=(r.x||0)/a,i.zooming.panY-=(r.y||0)/n;else if(Object.keys(s).length){let{width:t=1,height:o=1}=r,h=Math.abs(i.group?.scaleX||1),{x:l=0,y:p=0,width:c=1,height:d=1}=s,m=l,g=p,f=i.zooming?.scale||i.group?.scaleX||1,u=(i.zooming?.width||1)*a,z=(i.zooming?.height||1)*n;if(Object.keys(r).length)u=c/t*u,z=c/o*z,l-=e.plotLeft,p-=e.plotTop,m=l-u/2,g=p-z/2,f=Math.min(a/u,n/z);else{c/=h,d/=h,f=Math.min(a/c,n/d);let t=0,o=0;i.zooming&&(t=i.zooming.x*a,o=i.zooming.y*n);let s=(l-e.plotLeft)/(a-c*h||1),r=(p-e.plotTop)/(n-d*h||1);u=c,z=d,l-=e.plotLeft,p-=e.plotTop,l/=h,p/=h,l+=t+c*s,p+=o+d*r,m-=e.plotLeft,g-=e.plotTop,m/=h,g/=h,m+=t,g+=o}i.zooming={x:m/a,y:g/n,zoomX:l/a,zoomY:p/n,width:u/a,height:z/n,scale:f,panX:0,panY:0},f<1&&delete i.zooming}else delete i.zooming}})}function l(t){let{chart:e,group:o,zooming:i}=this,{plotSizeX:a=0,plotSizeY:s=0}=e,{scale:r,translateX:n,translateY:h,name:l}=t,p=0,c=0,d=n,m=h;e.inverted&&([a,s]=[s,a]),o&&i&&(r=i.scale,p=i.zoomX*a*(r-Math.abs(o.scaleX||1)),c=i.zoomY*s*(r-Math.abs(o.scaleY||1)),"series"===l&&(i.x=Math.max(0,Math.min(1-i.width,i.x+i.panX/r)),p+=i.panX*a,i.panX=0,i.y=Math.max(0,Math.min(1-i.height,i.y+i.panY/r)),c+=i.panY*s,i.panY=0),n=(o.translateX||d)-p,(h=(o.translateY||m)-c)>m?h=m:(o.translateY||m)-c<s*(1-r)+m&&(h=s*(1-r)+m),n>d?n=d:n<a*(1-r)+d&&(n=a*(1-r)+d),t.scale=r,t.translateX=n,t.translateY=h)}function p(){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 c(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,a=t.point.series.group.translateY||0;t.ret[0]=t.ret[0]*o+i-e.plotLeft,t.ret[1]=t.ret[1]*o+a-e.plotTop}}function d(t){t.skipAxes&&this.series.forEach(t=>{t.group&&t.zooming&&t.group.attr({translateX:0,translateY:0,scaleX:1,scaleY:1})})}function m({index:t,zIndex:e=6}){var o;this.hasDataLabels?.()&&(this.dataLabelsParentGroups||(this.dataLabelsParentGroups=[]),(o=this.dataLabelsParentGroups)[t]||(o[t]=this.chart.renderer.g().attr({zIndex:e}).add()))}let g=class{static compose(t,e,o){(0,s.pushUnique)(n,"NonCartesianSeriesZoom")&&((0,s.addEvent)(t,"afterDrawChartBox",p),(0,s.addEvent)(t,"transform",h),(0,s.addEvent)(t,"afterSetChartSize",d),(0,s.addEvent)(e,"getPlotBox",l),(0,s.addEvent)(e,"initDataLabelsGroup",m),(0,s.addEvent)(o,"getAnchor",c))}},f=r();f.NonCartesianSeriesZoom=f.NonCartesianSeriesZoom||g,f.NonCartesianSeriesZoom.compose(f.Chart,f.Series,f.Tooltip);let u=r();return a.default})());