7 lines
9.0 KiB
JavaScript
7 lines
9.0 KiB
JavaScript
|
!/**
|
||
|
* Highcharts JS v11.4.1 (2024-04-04)
|
||
|
*
|
||
|
* (c) 2009-2024 Torstein Honsi
|
||
|
*
|
||
|
* License: www.highcharts.com/license
|
||
|
*/function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/modules/series-label",["highcharts"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function o(t,e,o,r){t.hasOwnProperty(e)||(t[e]=r.apply(null,o),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}o(e,"Extensions/SeriesLabel/SeriesLabelDefaults.js",[],function(){return{enabled:!0,connectorAllowed:!1,connectorNeighbourDistance:24,format:void 0,formatter:void 0,minFontSize:null,maxFontSize:null,onArea:null,style:{fontSize:"0.8em",fontWeight:"bold"},useHTML:!1,boxesToAvoid:[]}}),o(e,"Extensions/SeriesLabel/SeriesLabelUtilities.js",[],function(){function t(t,e,o,r,i,a){let n=(a-e)*(o-t)-(r-e)*(i-t);return n>0||!(n<0)}function e(e,o,r,i,a,n,s,l){return t(e,o,a,n,s,l)!==t(r,i,a,n,s,l)&&t(e,o,r,i,a,n)!==t(e,o,r,i,s,l)}return{boxIntersectLine:function(t,o,r,i,a,n,s,l){return e(t,o,t+r,o,a,n,s,l)||e(t+r,o,t+r,o+i,a,n,s,l)||e(t,o+i,t+r,o+i,a,n,s,l)||e(t,o,t,o+i,a,n,s,l)},intersectRect:function(t,e){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}}}),o(e,"Extensions/SeriesLabel/SeriesLabel.js",[e["Core/Animation/AnimationUtilities.js"],e["Core/Templating.js"],e["Core/Defaults.js"],e["Core/Globals.js"],e["Extensions/SeriesLabel/SeriesLabelDefaults.js"],e["Extensions/SeriesLabel/SeriesLabelUtilities.js"],e["Core/Utilities.js"]],function(t,e,o,r,i,a,n){let{animObject:s}=t,{format:l}=e,{setOptions:h}=o,{composed:c}=r,{boxIntersectLine:p,intersectRect:d}=a,{addEvent:u,extend:f,fireEvent:x,isNumber:b,pick:m,pushUnique:g,syncTimeout:y}=n;function X(t,e,o,r,i){let a=t.chart,n=t.options.label||{},s=m(n.onArea,!!t.area),l=s||n.connectorAllowed,h=a.boxesToAvoid,c=Number.MAX_VALUE,u=Number.MAX_VALUE,f,x,b,g,y,X,S;for(X=0;h&&X<h.length;X+=1)if(d(h[X],{left:e,right:e+r.width,top:o,bottom:o+r.height}))return!1;for(X=0;X<a.series.length;X+=1){let h=a.series[X],d=h.interpolatedPoints&&[...h.interpolatedPoints];if(h.visible&&d){let m=a.plotHeight/10;for(let t=a.plotTop;t<=a.plotTop+a.plotHeight;t+=m)d.unshift({chartX:a.plotLeft,chartY:t}),d.push({chartX:a.plotLeft+a.plotWidth,chartY:t});for(S=1;S<d.length;S+=1){if(d[S].chartX>=e-16&&d[S-1].chartX<=e+r.width+16){if(p(e,o,r.width,r.height,d[S-1].chartX,d[S-1].chartY,d[S].chartX,d[S].chartY))return!1;t===h&&!b&&i&&(b=p(e-16,o-16,r.width+32,r.height+32,d[S-1].chartX,d[S-1].chartY,d[S].chartX,d[S].chartY))}(l||b)&&(t!==h||s)&&(c=Math.min(c,(g=e+r.width/2-d[S].chartX)*g+(y=o+r.height/2-d[S].chartY)*y))}if(!s&&l&&t===h&&(i&&!b||c<Math.pow(n.connectorNeighbourDistance||1,2))){for(S=1;S<d.length;S+=1)(f=Math.min(Math.pow(e+r.width/2-d[S].chartX,2)+Math.pow(o+r.height/2-d[S].chartY,2),Math.pow(e-d[S].chartX,2)+Math.pow(o-d[S].chartY,2),Math.pow(e+r.width-d[S].chartX,2)+Math.pow(o-d[S].chartY,2),Math.pow(e+r.width-d[S].chartX,2)+Math.pow(o+r.height-d[S].chartY,2),Math.pow(e-d[S].chartX,2)+Math.pow(o+r.height-d[S].chartY,2)))<u&&(u=f,x=d[S]);b=!0}}}return(!i||!!b)&&{x:e,y:o,weight:c-(x?u:0),connectorPoint:x}}function S(t){if(this.renderer){let e=this,o=s(e.renderer.globalAnimation).duration;e.labelSeries=[],e.labelSeriesMaxSum=0,e.seriesLabelTimer&&n.clearTimeout(e.seriesLabelTimer),e.series.forEach(function(r){let i=r.options.label||{},a=r.labelBySeries,n=a&&a.closest;i.enabled&&r.visible&&(r.graph||r.area)&&!r.boosted&&e.labelSeries&&(e.labelSeries.push(r),i.minFontSize&&i.maxFontSize&&r.yData&&(r.sum=r.yData.reduce((t,e)=>(t||0)+(e||0),0),e.labelSeriesMaxSum=Math.max(e.labelSeriesMaxSum||0,r.sum||0)),"load"===t.type&&(o=Math.max(o,s(r.options.animation).duration)),n&&(void 0!==n[0].plotX?a.animate({x:n[0].plotX+n[1],y:n[0].plotY+n[2]}):a.attr({opacity:0})))}),e.seriesLabelTimer=y(function(){e.series&&e.labelSeries&&function(t){t.boxesToAvoid=[];let e=t.labelSeries||[],o=t.boxesToAvoid;t.series.forEach(t=>(t.points||[]).forEach(e=>(e.dataLabels||[]).forEach(e=>{let{width:r,h
|