highcharts
Version:
JavaScript charting framework
19 lines (16 loc) • 4.65 kB
JavaScript
/*
Highcharts JS v8.0.0 (2019-12-10)
Support for parallel coordinates in Highcharts
(c) 2010-2019 Pawel Fus
License: www.highcharts.com/license
*/
(function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/modules/parallel-coordinates",["highcharts"],function(f){b(f);b.Highcharts=f;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function f(b,c,f,n){b.hasOwnProperty(c)||(b[c]=n.apply(null,f))}b=b?b._modules:{};f(b,"modules/parallel-coordinates.src.js",[b["parts/Globals.js"],b["parts/Utilities.js"]],function(b,c){function f(a){var d=
this.series&&this.series.chart,l=a.apply(this,Array.prototype.slice.call(arguments,1)),c;if(d&&d.hasParallelCoordinates&&!m(l.formattedValue)){var g=d.yAxis[this.x];var e=g.options;d=(c=r(e.tooltipValueFormat,e.labels.format))?b.format(c,p(this,{value:this.y}),d):g.isDatetimeAxis?d.time.dateFormat(d.time.resolveDTLFormat(e.dateTimeLabelFormats[g.tickPositions.info.unitName]).main,this.y):e.categories?e.categories[this.y]:this.y;l.formattedValue=l.point.formattedValue=d}return l}var n=c.arrayMax,w=
c.arrayMin,m=c.defined,x=c.erase,p=c.extend,r=c.pick,t=c.splat,y=c.wrap;c=b.Axis;var q=b.Chart,z=q.prototype,u=b.Axis.prototype,h=b.addEvent,k=b.merge,v={lineWidth:0,tickLength:0,opposite:!0,type:"category"};b.setOptions({chart:{parallelCoordinates:!1,parallelAxes:{lineWidth:1,title:{text:"",reserveSpace:!1},labels:{x:0,y:4,align:"center",reserveSpace:!1},offset:0}}});h(q,"init",function(a){a=a.args[0];var d=t(a.yAxis||{}),b=d.length,c=[];if(this.hasParallelCoordinates=a.chart&&a.chart.parallelCoordinates){for(this.setParallelInfo(a);b<=
this.parallelInfo.counter;b++)c.push({});a.legend||(a.legend={});"undefined"===typeof a.legend.enabled&&(a.legend.enabled=!1);k(!0,a,{boost:{seriesThreshold:Number.MAX_VALUE},plotOptions:{series:{boostThreshold:Number.MAX_VALUE}}});a.yAxis=d.concat(c);a.xAxis=k(v,t(a.xAxis||{})[0])}});h(q,"update",function(a){a=a.options;a.chart&&(m(a.chart.parallelCoordinates)&&(this.hasParallelCoordinates=a.chart.parallelCoordinates),this.options.chart.parallelAxes=k(this.options.chart.parallelAxes,a.chart.parallelAxes));
this.hasParallelCoordinates&&(a.series&&this.setParallelInfo(a),this.yAxis.forEach(function(a){a.update({},!1)}))});p(z,{setParallelInfo:function(a){var d=this;a=a.series;d.parallelInfo={counter:0};a.forEach(function(a){a.data&&(d.parallelInfo.counter=Math.max(d.parallelInfo.counter,a.data.length-1))})}});u.keepProps.push("parallelPosition");h(c,"afterSetOptions",function(a){var d=this.chart,b=["left","width","height","top"];d.hasParallelCoordinates&&(d.inverted&&(b=b.reverse()),this.isXAxis?this.options=
k(this.options,v,a.userOptions):(this.options=k(this.options,this.chart.options.chart.parallelAxes,a.userOptions),this.parallelPosition=r(this.parallelPosition,d.yAxis.length),this.setParallelPosition(b,this.options)))});h(c,"getSeriesExtremes",function(a){if(this.chart&&this.chart.hasParallelCoordinates&&!this.isXAxis){var b=this.parallelPosition,c=[];this.series.forEach(function(a){a.visible&&m(a.yData[b])&&c.push(a.yData[b])});this.dataMin=w(c);this.dataMax=n(c);a.preventDefault()}});p(u,{setParallelPosition:function(a,
b){var d=(this.parallelPosition+.5)/(this.chart.parallelInfo.counter+1);this.chart.polar?b.angle=360*d:(b[a[0]]=100*d+"%",this[a[1]]=b[a[1]]=0,this[a[2]]=b[a[2]]=null,this[a[3]]=b[a[3]]=null)}});h(b.Series,"bindAxes",function(a){if(this.chart.hasParallelCoordinates){var b=this;this.chart.axes.forEach(function(a){b.insert(a.series);a.isDirty=!0});b.xAxis=this.chart.xAxis[0];b.yAxis=this.chart.yAxis[0];a.preventDefault()}});h(b.Series,"afterTranslate",function(){var a=this.chart,b=this.points,c=b&&
b.length,f=Number.MAX_VALUE,g;if(this.chart.hasParallelCoordinates){for(g=0;g<c;g++){var e=b[g];if(m(e.y)){e.plotX=a.polar?a.yAxis[g].angleRad||0:a.inverted?a.plotHeight-a.yAxis[g].top+a.plotTop:a.yAxis[g].left-a.plotLeft;e.clientX=e.plotX;e.plotY=a.yAxis[g].translate(e.y,!1,!0,null,!0);"undefined"!==typeof h&&(f=Math.min(f,Math.abs(e.plotX-h)));var h=e.plotX;e.isInside=a.isInsidePlot(e.plotX,e.plotY,a.inverted)}else e.isNull=!0}this.closestPointRangePx=f}},{order:1});b.addEvent(b.Series,"destroy",
function(){this.chart.hasParallelCoordinates&&(this.chart.axes||[]).forEach(function(a){a&&a.series&&(x(a.series,this),a.isDirty=a.forceRedraw=!0)},this)});["line","spline"].forEach(function(a){y(b.seriesTypes[a].prototype.pointClass.prototype,"getLabelConfig",f)})});f(b,"masters/modules/parallel-coordinates.src.js",[],function(){})});
//# sourceMappingURL=parallel-coordinates.js.map