highcharts
Version:
JavaScript charting framework
13 lines • 6.89 kB
JavaScript
!/**
* Highcharts JS v12.6.0 (2026-04-13)
* @module highcharts/modules/variwide
* @requires highcharts
*
* Highcharts variwide module
*
* (c) 2010-2026 Highsoft AS
* Author: Torstein Hønsi
*
* 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.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/variwide",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/variwide"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var i={512:t=>{t.exports=e},944:e=>{e.exports=t}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={exports:{}};return i[t](o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};s.d(o,{default:()=>z});var n=s(944),a=s.n(n),l=s(512),h=s.n(l);let{doc:c,win:p}=a();function u(t,e,i,r={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let o=s.hcEvents;a().Point&&t instanceof a().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let n=t.addEventListener;n&&n.call(t,e,i,!!a().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),o[e]||(o[e]=[]);let l={fn:i,order:"number"==typeof r.order?r.order:1/0};return o[e].push(l),o[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,i){function r(e,i){let r=t.removeEventListener;r&&r.call(t,e,i,!1)}function s(i){let s,o;t.nodeName&&(e?(s={})[e]=!0:s=i,g(s,function(t,e){if(i[e])for(o=i[e].length;o--;)r(e,i[e][o].fn)}))}let o="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(o,"hcEvents")){let t=o.hcEvents;if(e){let o=t[e]||[];i?(t[e]=o.filter(function(t){return i!==t.fn}),r(e,i)):(s(t),t[e]=[])}else s(t),delete o.hcEvents}}(t,e,i)}}function f(t,e=0,i){let r=e%2/2,s=i?-1:1;return(Math.round(t*s-r)+r)*s}function d(t){return x(t)&&"number"==typeof t.nodeType}function y(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function x(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function g(t,e,i){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(i||t[r],t[r],r,t)}function v(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}Array.prototype.find;let{composed:m}=a();function b(t){this.variwide&&this.cross&&this.cross.attr("stroke-width",t.point?.crosshairWidth)}function w(){let t=this;this.chart.labelCollectors.push(function(){return t.variwide?t.tickPositions.filter(e=>!!t.ticks[e].label).map((e,i)=>{let r=t.ticks[e].label;return r.labelrank=t.zData?.[i],r}):[]})}function O(t){let e=this.axis,i=e.horiz?"x":"y";e.variwide&&(this[i+"Orig"]=t.pos[i],this.postTranslate(t.pos,i,this.pos))}function A(t,e,i){let r=this.axis,s=t[e]-r.pos;r.horiz||(s=r.len-s),s=r.series[0].postTranslate(i,s),r.horiz||(s=r.len-s),t[e]=r.pos+s}function P(t,e,i,r,s,o,n,a){let l=Array.prototype.slice.call(arguments,1),h=s?"x":"y";this.axis.variwide&&"number"==typeof this[h+"Orig"]&&(l[+!s]=this[h+"Orig"]);let c=t.apply(this,l);return this.axis.variwide&&this.axis.categories&&this.postTranslate(c,h,this.pos),c}let{column:{prototype:{pointClass:T}}}=h().seriesTypes,{column:k}=h().seriesTypes;class j extends k{processData(t){this.totalZ=0,this.relZ=[],h().seriesTypes.column.prototype.processData.call(this,t);let e=this.getColumn("z");(this.xAxis.reversed?e.slice().reverse():e).forEach(function(t,e){this.relZ[e]=this.totalZ,this.totalZ+=t},this),this.xAxis.categories&&(this.xAxis.variwide=!0,this.xAxis.zData=e)}postTranslate(t,e,i){let r=this.xAxis,s=this.relZ,o=r.reversed?s.length-t:t,n=r.reversed?-1:1,a=r.toPixels(r.reversed?(r.dataMax||0)+r.pointRange:r.dataMin||0),l=r.toPixels(r.reversed?r.dataMin||0:(r.dataMax||0)+r.pointRange),h=Math.abs(l-a),c=this.totalZ,p=this.chart.inverted?l-(this.chart.plotTop-n*r.minPixelPadding):a-this.chart.plotLeft-n*r.minPixelPadding,u=o/s.length*h,f=(o+n)/s.length*h,d=v(s[o],c)/c*h,y=v(s[o+n],c)/c*h;return i&&(i.crosshairWidth=y-d),p+d+(e-(p+u))*(y-d)/(f-u)}translate(){this.crispOption=this.options.crisp,this.options.crisp=!1,super.translate(),this.options.crisp=this.crispOption}correctStackLabels(){let t,e,i,r,s=this.options,o=this.yAxis;for(let n of this.points)r=n.x,e=n.shapeArgs.width,(i=o.stacking.stacks[(this.negStacks&&n.y<(s.startFromThreshold?0:s.threshold)?"-":"")+this.stackKey])&&(t=i[r])&&!n.isNull&&t.setOffset(-(e/2)||0,e||0,void 0,void 0,n.plotX,this.xAxis)}getXExtremes(t){let e=function(t){let e=t.length,i=t[0];for(;e--;)t[e]>i&&(i=t[e]);return i}(t),i=this.getColumn("z")[t.indexOf(e)];return{min:function(t){let e=t.length,i=t[0];for(;e--;)t[e]<i&&(i=t[e]);return i}(t),max:e+(this.xAxis.categories?0:i)}}}j.compose=({compose:function(t,e){var i,r;if(i="Variwide",0>m.indexOf(i)&&m.push(i)){let i,s=e.prototype;u(t,"afterDrawCrosshair",b),u(t,"afterRender",w),u(e,"afterGetPosition",O),s.postTranslate=A,i=s[r="getLabelPosition"],s[r]=function(){let t=arguments,e=this;return P.apply(this,[function(){return i.apply(e,arguments.length?arguments:t)}].concat([].slice.call(arguments)))}}}}).compose,j.defaultOptions=function(t,...e){let i,r=[t,...e],s={},o=function(t,e){return"object"!=typeof t&&(t={}),g(e,function(i,r){if("__proto__"!==r&&"constructor"!==r){let s;!x(i,!0)||(s=i?.constructor,x(i,!0)&&!d(i)&&s?.name&&"Object"!==s.name)||d(i)?t[r]=e[r]:t[r]=o(t[r]||{},i)}}),t};!0===t&&(s=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(i=0;i<n;i++)s=o(s,r[i]);return s}(k.defaultOptions,{pointPadding:0,groupPadding:0}),u(j,"afterColumnTranslate",function(){let t=this.xAxis,e=this.chart.inverted,i=-1;for(let r of this.points){let s,o;++i;let n=r.shapeArgs||{},{x:a=0,width:l=0}=n,{plotX:h=0,tooltipPos:c,z:p=0}=r;t.variwide?(s=this.postTranslate(i,a,r),o=this.postTranslate(i,a+l)):(s=h,o=t.translate(r.x+p,!1,!1,!1,!0)),this.crispOption&&(s=f(s,this.borderWidth),o=f(o,this.borderWidth)),n.x=s,n.width=Math.max(o-s,1),r.plotX=(s+o)/2,c&&(e?c[1]=t.len-n.x-n.width/2:c[0]=n.x+n.width/2)}this.options.stacking&&this.correctStackLabels()},{order:2}),function(t,e){let i;for(i in t||(t={}),e)t[i]=e[i]}(j.prototype,{irregularWidths:!0,keysAffectYAxis:["y"],pointArrayMap:["y","z"],parallelArrays:["x","y","z"],pointClass:class extends T{isValid(){return y(this.y)&&y(this.z)}}}),h().registerSeriesType("variwide",j);let E=a();j.compose(E.Axis,E.Tick);let z=a();return o.default})());