UNPKG

highcharts

Version:
14 lines 6.5 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/cylinder * @requires highcharts * @requires highcharts/highcharts-3d * * Highcharts cylinder module * * (c) 2010-2026 Highsoft AS * Author: Kacper Madej * * 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,t._Highcharts.Color,t._Highcharts.RendererRegistry,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/cylinder",["highcharts/highcharts"],function(t){return e(t,t.Color,t.RendererRegistry,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/cylinder"]=e(t._Highcharts,t._Highcharts.Color,t._Highcharts.RendererRegistry,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.Color,t.Highcharts.RendererRegistry,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e,r,o)=>(()=>{"use strict";var n={512:t=>{t.exports=o},608:t=>{t.exports=r},620:t=>{t.exports=e},944:e=>{e.exports=t}},s={};function i(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return n[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 r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var l={};i.d(l,{default:()=>q});var p=i(944),h=i.n(p);let{doc:c,win:a}=h();function y(t,e){let r;for(r in t||(t={}),e)t[r]=e[r];return t}function u(t){return d(t)&&"number"==typeof t.nodeType}function d(t,e){let r;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(r=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==r)}function f(){let t=arguments,e=t.length;for(let r=0;r<e;r++){let e=t[r];if(null!=e)return e}}Array.prototype.find;let{deg2rad:x}=h();function g(t,e,r,o){let n=e.options.chart.options3d,s=f(o,!!r&&e.inverted),i={x:e.plotWidth/2,y:e.plotHeight/2,z:n.depth/2,vd:f(n.depth,1)*f(n.viewDistance,0)},l=e.scale3d||1,p=x*n.beta*(s?-1:1),h=x*n.alpha*(s?-1:1),c={cosA:Math.cos(h),cosB:Math.cos(-p),sinA:Math.sin(h),sinB:Math.sin(-p)};return r||(i.x+=e.plotLeft,i.y+=e.plotTop),t.map(function(t){var e,r,o;let n=(e=(s?t.y:t.x)-i.x,r=(s?t.x:t.y)-i.y,o=(t.z||0)-i.z,{x:c.cosB*e-c.sinB*o,y:-c.sinA*c.sinB*e+c.cosA*r-c.cosB*c.sinA*o,z:c.cosA*c.sinB*e+c.sinA*r+c.cosA*c.cosB*o}),p=z(n,i,i.vd);return p.x=p.x*l+i.x,p.y=p.y*l+i.y,p.z=n.z*l+i.z,{x:s?p.y:p.x,y:s?p.x:p.y,z:p.z}})}function z(t,e,r){let o=r>0&&r<1/0?r/(t.z+e.z+r):1;return{x:t.x*o,y:t.y*o}}function b(t){let e=0,r,o;for(r=0;r<t.length;r++)o=(r+1)%t.length,e+=t[r].x*t[o].y-t[o].x*t[r].y;return e/2}var C=i(620),m=i.n(C),M=i(608),v=i.n(M);let{parse:H}=m(),{Element3D:R}=v().getRendererType().prototype,_=class extends R{constructor(){super(...arguments),this.parts=["top","bottom","front","back"],this.pathType="cylinder"}fillSetter(t){return this.singleSetterForParts("fill",null,{front:t,back:t,top:H(t).brighten(.1).get(),bottom:H(t).brighten(-.1).get()}),this.color=this.fill=t,this}},{charts:A,deg2rad:j}=h(),{perspective:w}={perspective:g,perspective3D:z,pointCameraDistance:function(t,e){let r=e.options.chart.options3d,o={x:e.plotWidth/2,y:e.plotHeight/2,z:f(r.depth,1)*f(r.viewDistance,0)+r.depth};return Math.sqrt(Math.pow(o.x-f(t.plotX,t.x),2)+Math.pow(o.y-f(t.plotY,t.y),2)+Math.pow(o.z-f(t.plotZ,t.z),2))},shapeArea:b,shapeArea3D:function(t,e,r){return b(g(t,e,r))}};function B(t){return!t.some(t=>"C"===t[0])}function T(t){return this.element3d("cylinder",t)}function O(t){let e=A[this.chartIndex],r=this.cuboidPath(t),o=!r.isTop,n=!r.isFront,s=this.getCylinderEnd(e,t),i=this.getCylinderEnd(e,t,!0);return{front:this.getCylinderFront(s,i),back:this.getCylinderBack(s,i),top:s,bottom:i,zIndexes:{top:3*!!o,bottom:3*!o,front:n?2:1,back:n?1:2,group:r.zIndexes.group}}}function P(t){let e=[["M",t[0].x,t[0].y]],r=t.length-2;for(let o=1;o<r;o+=3)e.push(["C",t[o].x,t[o].y,t[o+1].x,t[o+1].y,t[o+2].x,t[o+2].y]);return e}function L(t,e){let r=[];if(B(t)){let e=t[0],o=t[2];"M"===e[0]&&"L"===o[0]&&(r.push(["M",o[1],o[2]]),r.push(t[3]),r.push(["L",e[1],e[2]]))}else"C"===t[2][0]&&r.push(["M",t[2][5],t[2][6]]),r.push(t[3],t[4]);if(B(e)){let t=e[0];"M"===t[0]&&(r.push(["L",t[1],t[2]]),r.push(e[3]),r.push(e[2]))}else{let t=e[2],o=e[3],n=e[4];"C"===t[0]&&"C"===o[0]&&"C"===n[0]&&(r.push(["L",n[5],n[6]]),r.push(["C",n[3],n[4],n[1],n[2],o[5],o[6]]),r.push(["C",o[3],o[4],o[1],o[2],t[5],t[6]]))}return r.push(["Z"]),r}function S(t,e,r){let o,n,{width:s=0,height:i=0,alphaCorrection:l=0}=e,p=f(e.depth,s,0),h=Math.min(s,p)/2,c=j*(t.options.chart.options3d.beta-90+l),a=(e.y||0)+(r?i:0),y=.5519*h,u=s/2+(e.x||0),d=p/2+(e.z||0),x=[{x:0,y:a,z:h},{x:y,y:a,z:h},{x:h,y:a,z:y},{x:h,y:a,z:0},{x:h,y:a,z:-y},{x:y,y:a,z:-h},{x:0,y:a,z:-h},{x:-y,y:a,z:-h},{x:-h,y:a,z:-y},{x:-h,y:a,z:0},{x:-h,y:a,z:y},{x:-y,y:a,z:h},{x:0,y:a,z:h}],g=Math.cos(c),z=Math.sin(c);for(let t of x)o=t.x,n=t.z,t.x=o*g-n*z+u,t.z=n*g+o*z+d;let b=w(x,t,!0);return 2.5>Math.abs(b[3].y-b[9].y)&&2.5>Math.abs(b[0].y-b[6].y)?this.toLinePath([b[0],b[3],b[6],b[9]],!0):this.getCurvedPath(b)}function k(t,e){let r=t.slice(0,3);if(B(e)){let t=e[0];"M"===t[0]&&(r.push(e[2]),r.push(e[1]),r.push(["L",t[1],t[2]]))}else{let t=e[0],o=e[1],n=e[2];"M"===t[0]&&"C"===o[0]&&"C"===n[0]&&(r.push(["L",n[5],n[6]]),r.push(["C",n[3],n[4],n[1],n[2],o[5],o[6]]),r.push(["C",o[3],o[4],o[1],o[2],t[1],t[2]]))}return r.push(["Z"]),r}var D=i(512),E=i.n(D);let{column:{prototype:{pointClass:F}}}=E().seriesTypes;class I extends F{}y(I.prototype,{shapeType:"cylinder"});let{column:Z}=E().seriesTypes;class W extends Z{}W.compose=function(t){let e=t.prototype;e.cylinder||(e.Element3D.types.cylinder=_,y(e,{cylinder:T,cylinderPath:O,getCurvedPath:P,getCylinderBack:L,getCylinderEnd:S,getCylinderFront:k}))},W.defaultOptions=function(t,...e){let r,o=[t,...e],n={},s=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,r){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call((0,t[r]),t[r],r,t)}(e,function(r,o){if("__proto__"!==o&&"constructor"!==o){let n;!d(r,!0)||(n=r?.constructor,d(r,!0)&&!u(r)&&n?.name&&"Object"!==n.name)||u(r)?t[o]=e[o]:t[o]=s(t[o]||{},r)}}),t};!0===t&&(n=o[1],o=Array.prototype.slice.call(o,2));let i=o.length;for(r=0;r<i;r++)n=s(n,o[r]);return n}(Z.defaultOptions,{}),y(W.prototype,{pointClass:I}),E().registerSeriesType("cylinder",W),W.compose(v().getRendererType());let q=h();return l.default})());