dumbbell.js 9.5 KB

123456789101112131415161718192021222324252627
  1. /*
  2. Highcharts JS v8.2.0 (2020-08-20)
  3. (c) 2009-2019 Sebastian Bochan, Rafal Sebestjanski
  4. License: www.highcharts.com/license
  5. */
  6. (function(d){"object"===typeof module&&module.exports?(d["default"]=d,module.exports=d):"function"===typeof define&&define.amd?define("highcharts/modules/dumbbell",["highcharts"],function(t){d(t);d.Highcharts=t;return d}):d("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(d){function t(d,r,m,x){d.hasOwnProperty(r)||(d[r]=x.apply(null,m))}d=d?d._modules:{};t(d,"Series/AreaRangeSeries.js",[d["Core/Globals.js"],d["Core/Series/Point.js"],d["Core/Utilities.js"]],function(d,r,m){var x=m.defined,
  7. n=m.extend,t=m.isArray,y=m.isNumber,v=m.pick;m=m.seriesType;var w=d.seriesTypes,u=d.Series.prototype,a=r.prototype;m("arearange","area",{lineWidth:1,threshold:null,tooltip:{pointFormat:'<span style="color:{series.color}">\u25cf</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'},trackByArea:!0,dataLabels:{align:void 0,verticalAlign:void 0,xLow:0,xHigh:0,yLow:0,yHigh:0}},{pointArrayMap:["low","high"],pointValKey:"low",deferTranslatePolar:!0,toYData:function(a){return[a.low,a.high]},
  8. highToXY:function(a){var c=this.chart,b=this.xAxis.postTranslate(a.rectPlotX,this.yAxis.len-a.plotHigh);a.plotHighX=b.x-c.plotLeft;a.plotHigh=b.y-c.plotTop;a.plotLowX=a.plotX},translate:function(){var a=this,c=a.yAxis,b=!!a.modifyValue;w.area.prototype.translate.apply(a);a.points.forEach(function(g){var k=g.high,e=g.plotY;g.isNull?g.plotY=null:(g.plotLow=e,g.plotHigh=c.translate(b?a.modifyValue(k,g):k,0,1,0,1),b&&(g.yBottom=g.plotHigh))});this.chart.polar&&this.points.forEach(function(b){a.highToXY(b);
  9. b.tooltipPos=[(b.plotHighX+b.plotLowX)/2,(b.plotHigh+b.plotLow)/2]})},getGraphPath:function(a){var c=[],b=[],g,f=w.area.prototype.getGraphPath;var e=this.options;var d=this.chart.polar,p=d&&!1!==e.connectEnds,q=e.connectNulls,l=e.step;a=a||this.points;for(g=a.length;g--;){var h=a[g];var n=d?{plotX:h.rectPlotX,plotY:h.yBottom,doCurve:!1}:{plotX:h.plotX,plotY:h.plotY,doCurve:!1};h.isNull||p||q||a[g+1]&&!a[g+1].isNull||b.push(n);var m={polarPlotY:h.polarPlotY,rectPlotX:h.rectPlotX,yBottom:h.yBottom,
  10. plotX:v(h.plotHighX,h.plotX),plotY:h.plotHigh,isNull:h.isNull};b.push(m);c.push(m);h.isNull||p||q||a[g-1]&&!a[g-1].isNull||b.push(n)}a=f.call(this,a);l&&(!0===l&&(l="left"),e.step={left:"right",center:"center",right:"left"}[l]);c=f.call(this,c);b=f.call(this,b);e.step=l;e=[].concat(a,c);!this.chart.polar&&b[0]&&"M"===b[0][0]&&(b[0]=["L",b[0][1],b[0][2]]);this.graphPath=e;this.areaPath=a.concat(b);e.isArea=!0;e.xMap=a.xMap;this.areaPath.xMap=a.xMap;return e},drawDataLabels:function(){var a=this.points,
  11. c=a.length,b,d=[],f=this.options.dataLabels,e,m=this.chart.inverted;if(t(f))if(1<f.length){var p=f[0];var q=f[1]}else p=f[0],q={enabled:!1};else p=n({},f),p.x=f.xHigh,p.y=f.yHigh,q=n({},f),q.x=f.xLow,q.y=f.yLow;if(p.enabled||this._hasPointLabels){for(b=c;b--;)if(e=a[b]){var l=p.inside?e.plotHigh<e.plotLow:e.plotHigh>e.plotLow;e.y=e.high;e._plotY=e.plotY;e.plotY=e.plotHigh;d[b]=e.dataLabel;e.dataLabel=e.dataLabelUpper;e.below=l;m?p.align||(p.align=l?"right":"left"):p.verticalAlign||(p.verticalAlign=
  12. l?"top":"bottom")}this.options.dataLabels=p;u.drawDataLabels&&u.drawDataLabels.apply(this,arguments);for(b=c;b--;)if(e=a[b])e.dataLabelUpper=e.dataLabel,e.dataLabel=d[b],delete e.dataLabels,e.y=e.low,e.plotY=e._plotY}if(q.enabled||this._hasPointLabels){for(b=c;b--;)if(e=a[b])l=q.inside?e.plotHigh<e.plotLow:e.plotHigh>e.plotLow,e.below=!l,m?q.align||(q.align=l?"left":"right"):q.verticalAlign||(q.verticalAlign=l?"bottom":"top");this.options.dataLabels=q;u.drawDataLabels&&u.drawDataLabels.apply(this,
  13. arguments)}if(p.enabled)for(b=c;b--;)if(e=a[b])e.dataLabels=[e.dataLabelUpper,e.dataLabel].filter(function(a){return!!a});this.options.dataLabels=f},alignDataLabel:function(){w.column.prototype.alignDataLabel.apply(this,arguments)},drawPoints:function(){var a=this.points.length,c;u.drawPoints.apply(this,arguments);for(c=0;c<a;){var b=this.points[c];b.origProps={plotY:b.plotY,plotX:b.plotX,isInside:b.isInside,negative:b.negative,zone:b.zone,y:b.y};b.lowerGraphic=b.graphic;b.graphic=b.upperGraphic;
  14. b.plotY=b.plotHigh;x(b.plotHighX)&&(b.plotX=b.plotHighX);b.y=b.high;b.negative=b.high<(this.options.threshold||0);b.zone=this.zones.length&&b.getZone();this.chart.polar||(b.isInside=b.isTopInside="undefined"!==typeof b.plotY&&0<=b.plotY&&b.plotY<=this.yAxis.len&&0<=b.plotX&&b.plotX<=this.xAxis.len);c++}u.drawPoints.apply(this,arguments);for(c=0;c<a;)b=this.points[c],b.upperGraphic=b.graphic,b.graphic=b.lowerGraphic,n(b,b.origProps),delete b.origProps,c++},setStackedPoints:d.noop},{setState:function(){var g=
  15. this.state,c=this.series,b=c.chart.polar;x(this.plotHigh)||(this.plotHigh=c.yAxis.toPixels(this.high,!0));x(this.plotLow)||(this.plotLow=this.plotY=c.yAxis.toPixels(this.low,!0));c.stateMarkerGraphic&&(c.lowerStateMarkerGraphic=c.stateMarkerGraphic,c.stateMarkerGraphic=c.upperStateMarkerGraphic);this.graphic=this.upperGraphic;this.plotY=this.plotHigh;b&&(this.plotX=this.plotHighX);a.setState.apply(this,arguments);this.state=g;this.plotY=this.plotLow;this.graphic=this.lowerGraphic;b&&(this.plotX=this.plotLowX);
  16. c.stateMarkerGraphic&&(c.upperStateMarkerGraphic=c.stateMarkerGraphic,c.stateMarkerGraphic=c.lowerStateMarkerGraphic,c.lowerStateMarkerGraphic=void 0);a.setState.apply(this,arguments)},haloPath:function(){var g=this.series.chart.polar,c=[];this.plotY=this.plotLow;g&&(this.plotX=this.plotLowX);this.isInside&&(c=a.haloPath.apply(this,arguments));this.plotY=this.plotHigh;g&&(this.plotX=this.plotHighX);this.isTopInside&&(c=c.concat(a.haloPath.apply(this,arguments)));return c},destroyElements:function(){["lowerGraphic",
  17. "upperGraphic"].forEach(function(a){this[a]&&(this[a]=this[a].destroy())},this);this.graphic=null;return a.destroyElements.apply(this,arguments)},isValid:function(){return y(this.low)&&y(this.high)}});""});t(d,"Series/DumbbellSeries.js",[d["Core/Globals.js"],d["Core/Utilities.js"]],function(d,r){var m=d.SVGRenderer,t=r.extend,n=r.pick;r=r.seriesType;var z=d.seriesTypes,y=d.Series.prototype,v=z.arearange.prototype,w=z.column.prototype,u=v.pointClass.prototype;r("dumbbell","arearange",{trackByArea:!1,
  18. fillColor:"none",lineWidth:0,pointRange:1,connectorWidth:1,stickyTracking:!1,groupPadding:.2,crisp:!1,pointPadding:.1,lowColor:"#333333",states:{hover:{lineWidthPlus:0,connectorWidthPlus:1,halo:!1}}},{trackerGroups:["group","markerGroup","dataLabelsGroup"],drawTracker:d.TrackerMixin.drawTrackerPoint,drawGraph:d.noop,crispCol:w.crispCol,getConnectorAttribs:function(a){var g=this.chart,c=a.options,b=this.options,d=this.xAxis,f=this.yAxis,e=n(c.connectorWidth,b.connectorWidth),r=n(c.connectorColor,b.connectorColor,
  19. c.color,a.zone?a.zone.color:void 0,a.color),p=n(b.states&&b.states.hover&&b.states.hover.connectorWidthPlus,1),q=n(c.dashStyle,b.dashStyle),l=n(a.plotLow,a.plotY),h=f.toPixels(b.threshold||0,!0);h=n(a.plotHigh,g.inverted?f.len-h:h);a.state&&(e+=p);0>l?l=0:l>=f.len&&(l=f.len);0>h?h=0:h>=f.len&&(h=f.len);if(0>a.plotX||a.plotX>d.len)e=0;a.upperGraphic&&(d={y:a.y,zone:a.zone},a.y=a.high,a.zone=a.zone?a.getZone():void 0,r=n(c.connectorColor,b.connectorColor,c.color,a.zone?a.zone.color:void 0,a.color),
  20. t(a,d));a={d:m.prototype.crispLine([["M",a.plotX,l],["L",a.plotX,h]],e,"ceil")};g.styledMode||(a.stroke=r,a["stroke-width"]=e,q&&(a.dashstyle=q));return a},drawConnector:function(a){var d=n(this.options.animationLimit,250);d=a.connector&&this.chart.pointCount<d?"animate":"attr";a.connector||(a.connector=this.chart.renderer.path().addClass("highcharts-lollipop-stem").attr({zIndex:-1}).add(this.markerGroup));a.connector[d](this.getConnectorAttribs(a))},getColumnMetrics:function(){var a=w.getColumnMetrics.apply(this,
  21. arguments);a.offset+=a.width/2;return a},translatePoint:v.translate,setShapeArgs:z.columnrange.prototype.translate,translate:function(){this.setShapeArgs.apply(this);this.translatePoint.apply(this,arguments);this.points.forEach(function(a){var d=a.shapeArgs,c=a.pointWidth;a.plotX=d.x;d.x=a.plotX-c/2;a.tooltipPos=null});this.columnMetrics.offset-=this.columnMetrics.width/2},seriesDrawPoints:v.drawPoints,drawPoints:function(){var a=this.chart,d=this.points.length,c=this.lowColor=this.options.lowColor,
  22. b=0;for(this.seriesDrawPoints.apply(this,arguments);b<d;){var k=this.points[b];this.drawConnector(k);k.upperGraphic&&(k.upperGraphic.element.point=k,k.upperGraphic.addClass("highcharts-lollipop-high"));k.connector.element.point=k;if(k.lowerGraphic){var f=k.zone&&k.zone.color;f=n(k.options.lowColor,c,k.options.color,f,k.color,this.color);a.styledMode||k.lowerGraphic.attr({fill:f});k.lowerGraphic.addClass("highcharts-lollipop-low")}b++}},markerAttribs:function(){var a=v.markerAttribs.apply(this,arguments);
  23. a.x=Math.floor(a.x);a.y=Math.floor(a.y);return a},pointAttribs:function(a,d){var c=y.pointAttribs.apply(this,arguments);"hover"===d&&delete c.fill;return c}},{destroyElements:u.destroyElements,isValid:u.isValid,pointSetState:u.setState,setState:function(){var a=this.series,d=a.chart,c=a.options.marker,b=this.options,k=n(b.lowColor,a.options.lowColor,b.color,this.zone&&this.zone.color,this.color,a.color),f="attr";this.pointSetState.apply(this,arguments);this.state||(f="animate",this.lowerGraphic&&
  24. !d.styledMode&&(this.lowerGraphic.attr({fill:k}),this.upperGraphic&&(d={y:this.y,zone:this.zone},this.y=this.high,this.zone=this.zone?this.getZone():void 0,c=n(this.marker?this.marker.fillColor:void 0,c?c.fillColor:void 0,b.color,this.zone?this.zone.color:void 0,this.color),this.upperGraphic.attr({fill:c}),t(this,d))));this.connector[f](a.getConnectorAttribs(this))}});""});t(d,"masters/modules/dumbbell.src.js",[],function(){})});
  25. //# sourceMappingURL=dumbbell.js.map