UNPKG

highcharts

Version:
13 lines 4.31 kB
!/** * Highcharts JS v12.5.0 (2026-01-12) * @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 a=o[t]={exports:{}};return e[t](a,a.exports,i),a.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 a=i(944),r=i.n(a);let{composed:n}=r(),{addEvent:h,pushUnique:p}=r();function l(t){let e=this,{trigger:o,selection:i,reset:s,from:a={},to:r={}}=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:n=0}=e;if("pan"===o&&i.zooming)i.zooming.panX-=(r.x||0)/s,i.zooming.panY-=(r.y||0)/n;else if(Object.keys(a).length){let{width:t=1,height:o=1}=r,h=Math.abs(i.group?.scaleX||1),{x:p=0,y:l=0,width:c=1,height:m=1}=a,g=p,d=l,f=i.zooming?.scale||i.group?.scaleX||1,u=(i.zooming?.width||1)*s,z=(i.zooming?.height||1)*n;if(Object.keys(r).length)u=c/t*u,z=c/o*z,p-=e.plotLeft,l-=e.plotTop,g=p-u/2,d=l-z/2,f=Math.min(s/u,n/z);else{c/=h,m/=h,f=Math.min(s/c,n/m);let t=0,o=0;i.zooming&&(t=i.zooming.x*s,o=i.zooming.y*n);let a=(p-e.plotLeft)/(s-c*h||1),r=(l-e.plotTop)/(n-m*h||1);u=c,z=m,p-=e.plotLeft,l-=e.plotTop,p/=h,l/=h,p+=t+c*a,l+=o+m*r,g-=e.plotLeft,d-=e.plotTop,g/=h,d/=h,g+=t,d+=o}i.zooming={x:g/s,y:d/n,zoomX:p/s,zoomY:l/n,width:u/s,height:z/n,scale:f,panX:0,panY:0},f<1&&delete i.zooming}else delete i.zooming}})}function c(t){let{chart:e,group:o,zooming:i}=this,{plotSizeX:s=0,plotSizeY:a=0}=e,{scale:r,translateX:n,translateY:h,name:p}=t,l=0,c=0,m=n,g=h;e.inverted&&([s,a]=[a,s]),o&&i&&(r=i.scale,l=i.zoomX*s*(r-Math.abs(o.scaleX||1)),c=i.zoomY*a*(r-Math.abs(o.scaleY||1)),"series"===p&&(i.x=Math.max(0,Math.min(1-i.width,i.x+i.panX/r)),l+=i.panX*s,i.panX=0,i.y=Math.max(0,Math.min(1-i.height,i.y+i.panY/r)),c+=i.panY*a,i.panY=0),n=(o.translateX||m)-l,(h=(o.translateY||g)-c)>g?h=g:(o.translateY||g)-c<a*(1-r)+g&&(h=a*(1-r)+g),n>m?n=m:n<s*(1-r)+m&&(n=s*(1-r)+m),t.scale=r,t.translateX=n,t.translateY=h)}function m(){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 g(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 d(t){t.skipAxes&&this.series.forEach(t=>{t.group&&t.zooming&&t.group.attr({translateX:0,translateY:0,scaleX:1,scaleY:1})})}function f({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 u=class{static compose(t,e,o){p(n,"NonCartesianSeriesZoom")&&(h(t,"afterDrawChartBox",m),h(t,"transform",l),h(t,"afterSetChartSize",d),h(e,"getPlotBox",c),h(e,"initDataLabelsGroup",f),h(o,"getAnchor",g))}},z=r();z.NonCartesianSeriesZoom=z.NonCartesianSeriesZoom||u,z.NonCartesianSeriesZoom.compose(z.Chart,z.Series,z.Tooltip);let x=r();return s.default})());