20 lines
4.7 KiB
JavaScript
20 lines
4.7 KiB
JavaScript
/*
|
|
Highcharts JS v11.1.0 (2023-06-05)
|
|
|
|
Highcharts variwide module
|
|
|
|
(c) 2010-2021 Torstein Honsi
|
|
|
|
License: www.highcharts.com/license
|
|
*/
|
|
'use strict';(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/variwide",["highcharts"],function(f){a(f);a.Highcharts=f;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function f(a,e,q,f){a.hasOwnProperty(e)||(a[e]=f.apply(null,q),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:a[e]}})))}a=a?a._modules:
|
|
{};f(a,"Series/Variwide/VariwideComposition.js",[a["Core/Utilities.js"]],function(a){function e(a){this.variwide&&this.cross&&this.cross.attr("stroke-width",a.point&&a.point.crosshairWidth)}function g(){const a=this;!this.horiz&&this.variwide&&this.chart.labelCollectors.push(function(){return a.tickPositions.filter(function(b){return a.ticks[b].label}).map(function(b,c){b=a.ticks[b].label;b.labelrank=a.zData[c];return b})})}function f(a){const b=this.axis,c=b.horiz?"x":"y";b.variwide&&(this[c+"Orig"]=
|
|
a.pos[c],this.postTranslate(a.pos,c,this.pos))}function u(a,b,g){const c=this.axis;let d=a[b]-c.pos;c.horiz||(d=c.len-d);d=c.series[0].postTranslate(g,d);c.horiz||(d=c.len-d);a[b]=c.pos+d}function v(a,b,g,l,d,w,p,e){var c=Array.prototype.slice.call(arguments,1);const f=d?"x":"y";this.axis.variwide&&"number"===typeof this[f+"Orig"]&&(c[d?0:1]=this[f+"Orig"]);c=a.apply(this,c);this.axis.variwide&&this.axis.categories&&this.postTranslate(c,f,this.pos);return c}const {addEvent:h,wrap:r}=a,m=[];return{compose:function(c,
|
|
b){a.pushUnique(m,c)&&(h(c,"afterDrawCrosshair",e),h(c,"afterRender",g));a.pushUnique(m,b)&&(h(b,"afterGetPosition",f),c=b.prototype,c.postTranslate=u,r(c,"getLabelPosition",v))}}});f(a,"Series/Variwide/VariwidePoint.js",[a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,f){({column:{prototype:{pointClass:a}}}=a.seriesTypes);const {isNumber:g}=f;class e extends a{constructor(){super(...arguments);this.series=this.options=this.crosshairWidth=void 0}isValid(){return g(this.y)&&g(this.z)}}
|
|
return e});f(a,"Series/Variwide/VariwideSeries.js",[a["Core/Series/SeriesRegistry.js"],a["Series/Variwide/VariwideComposition.js"],a["Series/Variwide/VariwidePoint.js"],a["Core/Utilities.js"]],function(a,f,q,t){const {seriesTypes:{column:e}}=a,{addEvent:g,extend:h,merge:r,pick:m}=t;class c extends e{constructor(){super(...arguments);this.zData=this.totalZ=this.relZ=this.points=this.options=this.data=void 0}processData(b){this.totalZ=0;this.relZ=[];a.seriesTypes.column.prototype.processData.call(this,
|
|
b);(this.xAxis.reversed?this.zData.slice().reverse():this.zData).forEach(function(a,b){this.relZ[b]=this.totalZ;this.totalZ+=a},this);this.xAxis.categories&&(this.xAxis.variwide=!0,this.xAxis.zData=this.zData)}postTranslate(a,c,f){var d=this.xAxis,b=this.relZ;a=d.reversed?b.length-a:a;const p=d.reversed?-1:1;var e=d.toPixels(d.reversed?(d.dataMax||0)+d.pointRange:d.dataMin||0),g=d.toPixels(d.reversed?d.dataMin||0:(d.dataMax||0)+d.pointRange);const l=Math.abs(g-e),k=this.totalZ;d=this.chart.inverted?
|
|
g-(this.chart.plotTop-p*d.minPixelPadding):e-this.chart.plotLeft-p*d.minPixelPadding;e=a/b.length*l;g=(a+p)/b.length*l;const h=m(b[a],k)/k*l;b=m(b[a+p],k)/k*l;f&&(f.crosshairWidth=b-h);return d+h+(c-(d+e))*(b-h)/(g-e)}translate(){this.crispOption=this.options.crisp;this.options.crisp=!1;super.translate();this.options.crisp=this.crispOption}correctStackLabels(){const a=this.options,c=this.yAxis;var f;let d,e;for(const b of this.points)e=b.x,d=b.shapeArgs.width,(f=c.stacking.stacks[(this.negStacks&&
|
|
b.y<(a.startFromThreshold?0:a.threshold)?"-":"")+this.stackKey])&&(f=f[e])&&!b.isNull&&f.setOffset(-(d/2)||0,d||0,void 0,void 0,b.plotX,this.xAxis)}}c.compose=f.compose;c.defaultOptions=r(e.defaultOptions,{pointPadding:0,groupPadding:0});g(c,"afterColumnTranslate",function(){const a=this.xAxis,c=this.chart.inverted,f=this.borderWidth%2/2;this.points.forEach((d,b)=>{const e=d.shapeArgs||{},{x:g=0,width:h=0}=e,{plotX:l=0,tooltipPos:k,z:m=0}=d;let n;a.variwide?(n=this.postTranslate(b,g,d),b=this.postTranslate(b,
|
|
g+h)):(n=l,b=a.translate(d.x+m,!1,!1,!1,!0));this.crispOption&&(n=Math.round(n)-f,b=Math.round(b)-f);e.x=n;e.width=Math.max(b-n,1);d.plotX=(n+b)/2;k&&(c?k[1]=a.len-e.x-e.width/2:k[0]=e.x+e.width/2)});this.options.stacking&&this.correctStackLabels()},{order:2});h(c.prototype,{irregularWidths:!0,pointArrayMap:["y","z"],parallelArrays:["x","y","z"],pointClass:q});a.registerSeriesType("variwide",c);"";return c});f(a,"masters/modules/variwide.src.js",[a["Core/Globals.js"],a["Series/Variwide/VariwideSeries.js"]],
|
|
function(a,e){e.compose(a.Axis,a.Tick)})});
|
|
//# sourceMappingURL=variwide.js.map
|