parallel-coordinates.js 4.12 KB
/*
  Highcharts JS v6.2.0 (2018-10-17)

 Support for parallel coordinates in Highcharts

 (c) 2010-2017 Pawel Fus

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