UNPKG

highcharts

Version:
11 lines 6.63 kB
/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/dumbbell * @requires highcharts * * (c) 2009-2026 Highsoft AS * Author: Sebastian Bochan, Rafał Sebestjański * * A commercial license may be required depending on use. * See www.highcharts.com/license */import*as t from"../highcharts.js";var o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o);let e=t.default;var r=o.n(e);let i=t.default.SeriesRegistry;var s=o.n(i);let{doc:l,win:n}=r();function a(t,o){let e;for(e in t||(t={}),o)t[e]=o[e];return t}function h(t){return c(t)&&"number"==typeof t.nodeType}function p(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function c(t,o){let e;return!!t&&"object"==typeof t&&(!o||"[object Array]"!==(e=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==e)}function d(){let t=arguments,o=t.length;for(let e=0;e<o;e++){let o=t[e];if(null!=o)return o}}Array.prototype.find;let{area:{prototype:{pointClass:y,pointClass:{prototype:u}}}}=s().seriesTypes,g=class extends y{setState(){let t=this.state,o=this.series,e=o.chart.polar;null==this.plotHigh&&(this.plotHigh=o.yAxis.toPixels(this.high,!0)),null==this.plotLow&&(this.plotLow=this.plotY=o.yAxis.toPixels(this.low,!0)),o.lowerStateMarkerGraphic=o.stateMarkerGraphic,o.stateMarkerGraphic=o.upperStateMarkerGraphic,this.graphic=this.graphics&&this.graphics[1],this.plotY=this.plotHigh,e&&p(this.plotHighX)&&(this.plotX=this.plotHighX),u.setState.apply(this,arguments),this.state=t,this.plotY=this.plotLow,this.graphic=this.graphics&&this.graphics[0],e&&p(this.plotLowX)&&(this.plotX=this.plotLowX),o.upperStateMarkerGraphic=o.stateMarkerGraphic,o.stateMarkerGraphic=o.lowerStateMarkerGraphic,o.lowerStateMarkerGraphic=void 0;let r=o.modifyMarkerSettings();u.setState.apply(this,arguments),o.restoreMarkerSettings(r)}haloPath(){let t=this.series.chart.polar,o=[];return this.plotY=this.plotLow,t&&p(this.plotLowX)&&(this.plotX=this.plotLowX),this.isInside&&(o=u.haloPath.apply(this,arguments)),this.plotY=this.plotHigh,t&&p(this.plotHighX)&&(this.plotX=this.plotHighX),this.isTopInside&&(o=o.concat(u.haloPath.apply(this,arguments))),o}isValid(){return p(this.low)&&p(this.high)}};class f extends g{setState(){let t=this.series,o=t.chart,e=t.options.lowColor,r=t.options.marker,i=t.options.lowMarker,s=this.options,l=s.lowColor,n=this.zone&&this.zone.color,h=d(l,i?.fillColor,e,s.color,n,this.color,t.color),p="attr",c,y;if(this.pointSetState.apply(this,arguments),!this.state){p="animate";let[t,e]=this.graphics||[];t&&!o.styledMode&&(t.attr({fill:h}),e&&(y={y:this.y,zone:this.zone},this.y=this.high,this.zone=this.zone?this.getZone():void 0,c=d(this.marker?this.marker.fillColor:void 0,r?r.fillColor:void 0,s.color,this.zone?this.zone.color:void 0,this.color),e.attr({fill:c}),a(this,y)))}this.connector?.[p](t.getConnectorAttribs(this))}destroy(){return this.graphic||(this.graphic=this.connector,this.connector=void 0),super.destroy()}}a(f.prototype,{pointSetState:g.prototype.setState});let w=t.default.SVGRenderer;var C=o.n(w);let{noop:m}=r(),{arearange:k,column:S,columnrange:b}=s().seriesTypes;class M extends k{getConnectorAttribs(t){let o=this.chart,e=t.options,r=this.options,i=this.xAxis,s=this.yAxis,l=d(r.states&&r.states.hover&&r.states.hover.connectorWidthPlus,1),n=d(e.dashStyle,r.dashStyle),h=s.toPixels(r.threshold||0,!0),p=o.inverted?s.len-h:h,c=d(e.connectorWidth,r.connectorWidth),y=d(e.connectorColor,r.connectorColor,e.color,t.zone?t.zone.color:void 0,t.color),u=d(t.plotLow,t.plotY),g=d(t.plotHigh,p),f;if("number"!=typeof u)return{};t.state&&(c+=l),u<0?u=0:u>=s.len&&(u=s.len),g<0?g=0:g>=s.len&&(g=s.len),(t.plotX<0||t.plotX>i.len)&&(c=0),t.graphics&&t.graphics[1]&&(f={y:t.y,zone:t.zone},t.y=t.high,t.zone=t.zone?t.getZone():void 0,y=d(e.connectorColor,r.connectorColor,e.color,t.zone?t.zone.color:void 0,t.color),a(t,f));let w={d:C().prototype.crispLine([["M",t.plotX,u],["L",t.plotX,g]],c)};return!o.styledMode&&(w.stroke=y,w["stroke-width"]=c,n&&(w.dashstyle=n)),w}drawConnector(t){let o=d(this.options.animationLimit,250),e=t.connector&&this.chart.pointCount<o?"animate":"attr";t.connector||(t.connector=this.chart.renderer.path().addClass("highcharts-lollipop-stem").attr({zIndex:-1}).add(this.group)),t.connector[e](this.getConnectorAttribs(t))}getColumnMetrics(){let t=S.prototype.getColumnMetrics.apply(this,arguments);return t.offset+=t.width/2,t}translate(){let t=this.chart.inverted;for(let o of(this.setShapeArgs.apply(this),this.translatePoint.apply(this,arguments),this.points)){let{pointWidth:e,shapeArgs:r={},tooltipPos:i}=o;o.plotX=r.x||0,r.x=o.plotX-e/2,i&&(t?i[1]=this.xAxis.len-o.plotX:i[0]=o.plotX)}this.columnMetrics.offset-=this.columnMetrics.width/2}drawPoints(){let t=this.chart,o=this.points.length,e=this.lowColor=this.options.lowColor,r=this.options.lowMarker,i=0,s,l,n;for(this.seriesDrawPoints.apply(this,arguments);i<o;){let[o,a]=(l=this.points[i]).graphics||[];this.drawConnector(l),a&&(a.element.point=l,a.addClass("highcharts-lollipop-high")),l.connector&&(l.connector.element.point=l),o&&(n=l.zone&&l.zone.color,s=d(l.options.lowColor,r?.fillColor,e,l.options.color,n,l.color,this.color),t.styledMode||o.attr({fill:s}),o.addClass("highcharts-lollipop-low")),i++}}pointAttribs(t,o){let e=super.pointAttribs.apply(this,arguments);return"hover"===o&&delete e.fill,e}setShapeArgs(){S.prototype.translate.apply(this),b.prototype.afterColumnTranslate.apply(this)}}M.defaultOptions=function(t,...o){let e,r=[t,...o],i={},s=function(t,o){return"object"!=typeof t&&(t={}),function(t,o,e){for(let e in t)Object.hasOwnProperty.call(t,e)&&o.call((0,t[e]),t[e],e,t)}(o,function(e,r){if("__proto__"!==r&&"constructor"!==r){let i;!c(e,!0)||(i=e?.constructor,c(e,!0)&&!h(e)&&i?.name&&"Object"!==i.name)||h(e)?t[r]=o[r]:t[r]=s(t[r]||{},e)}}),t};!0===t&&(i=r[1],r=Array.prototype.slice.call(r,2));let l=r.length;for(e=0;e<l;e++)i=s(i,r[e]);return i}(k.defaultOptions,{trackByArea:!1,fillColor:"none",lineWidth:0,pointRange:1,connectorWidth:1,stickyTracking:!1,groupPadding:.2,crisp:!1,pointPadding:.1,legendSymbol:"rectangle",lowColor:"#333333",states:{hover:{lineWidthPlus:0,connectorWidthPlus:1,halo:!1}}}),a(M.prototype,{crispCol:S.prototype.crispCol,drawGraph:m,drawTracker:S.prototype.drawTracker,pointClass:f,seriesDrawPoints:k.prototype.drawPoints,trackerGroups:["group","markerGroup","dataLabelsGroup"],translatePoint:k.prototype.translate}),s().registerSeriesType("dumbbell",M);let v=r();export{v as default};