highcharts
Version:
JavaScript charting framework
14 lines • 4.87 kB
JavaScript
/**
* Highcharts JS v12.6.0 (2026-04-13)
* @module highcharts/modules/solid-gauge
* @requires highcharts
* @requires highcharts/highcharts-more
*
* Solid angular gauge module
*
* (c) 2010-2026 Highsoft AS
* Author: Torstein Hønsi
*
* A commercial license may be required depending on use.
* See www.highcharts.com/license
*/import*as t from"../highcharts.js";var e,o,r={};r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let a=t.default;var s=r.n(a);let{doc:n,win:l}=s();function i(t,e){let o;for(o in t||(t={}),e)t[o]=e[o];return t}function d(t){return c(t)&&"number"==typeof t.nodeType}function h(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function c(t,e){let o;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(o=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==o)}function u(t,...e){let o,r=[t,...e],a={},s=function(t,e){return"object"!=typeof t&&(t={}),p(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let a;!c(o,!0)||(a=o?.constructor,c(o,!0)&&!d(o)&&a?.name&&"Object"!==a.name)||d(o)?t[r]=e[r]:t[r]=s(t[r]||{},o)}}),t};!0===t&&(a=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(o=0;o<n;o++)a=s(a,r[o]);return a}function p(t,e,o){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(o||t[r],t[r],r,t)}function f(){let t=arguments,e=t.length;for(let o=0;o<e;o++){let e=t[o];if(null!=e)return e}}function g(t,e){return parseInt(t,e||10)}Array.prototype.find;let{defaultOptions:y}=s(),{noop:m}=s(),C={radius:0,scope:"stack",where:void 0};function b(t,e){return c(t)||(t={radius:t||0}),u(C,e,t)}let A=b,R=t.default.SeriesRegistry;var v=r.n(R);let x=t.default.Color,{parse:j}=r.n(x)();(e=o||(o={})).initDataClasses=function(t){let e=this.chart,o=this.legendItem=this.legendItem||{},r=this.options,a=t.dataClasses||[],s,n,l=e.options.chart.colorCount,i=0,d;this.dataClasses=n=[],o.labels=[];for(let t=0,o=a.length;t<o;++t)s=u(s=a[t]),n.push(s),(e.styledMode||!s.color)&&("category"===r.dataClassColor?(e.styledMode||(l=(d=e.options.colors||[]).length,s.color=d[i]),s.colorIndex=i,++i===l&&(i=0)):s.color=j(r.minColor).tweenTo(j(r.maxColor),o<2?.5:t/(o-1)))},e.initStops=function(){let t=this.options,e=this.stops=t.stops||[[0,t.minColor||""],[1,t.maxColor||""]];for(let t=0,o=e.length;t<o;++t)e[t].color=j(e[t][1])},e.normalizedValue=function(t){let e=this.max||0,o=this.min||0;return this.logarithmic&&(t=this.logarithmic.log2lin(t)),1-(e-t)/(e-o||1)},e.toColor=function(t,e){let o,r,a,s,n,l,i=this.dataClasses,d=this.stops;if(i){for(l=i.length;l--;)if(r=(n=i[l]).from,a=n.to,(void 0===r||t>=r)&&(void 0===a||t<=a)){s=n.color,e&&(e.dataClass=l,e.colorIndex=n.colorIndex);break}}else{for(o=this.normalizedValue(t),l=d.length;l--&&!(o>d[l][0]););r=d[l]||d[l+1],o=1-((a=d[l+1]||r)[0]-o)/(a[0]-r[0]||1),s=r.color.tweenTo(a.color,o)}return s};let M=o,I=function(t){i(t,M)},{gauge:w,pie:O}=v().seriesTypes;class P extends w{translate(){let t=this.yAxis;I(t),!t.dataClasses&&t.options.dataClasses&&t.initDataClasses(t.options),t.initStops(),w.prototype.translate.call(this)}drawPoints(){let t,e=this.yAxis,o=e.center,r=this.options,a=this.chart.renderer,s=r.overshoot,n=r.rounded&&void 0===r.borderRadius,l=h(s)?s/180*Math.PI:0;for(let s of(h(r.threshold)&&(t=e.startAngleRad+e.translate(r.threshold,void 0,void 0,void 0,!0)),this.thresholdAngleRad=f(t,e.startAngleRad),this.points))if(!s.isNull){var d,c,u,p;let t=g(f(s.options.radius,r.radius,100))*o[2]/200,h=g(f(s.options.innerRadius,r.innerRadius,60))*o[2]/200,y=Math.min(e.startAngleRad,e.endAngleRad),m=Math.max(e.startAngleRad,e.endAngleRad),C=s.graphic,b=e.startAngleRad+e.translate(s.y,void 0,void 0,void 0,!0),R,v,x=e.toColor(s.y,s),j=s.getClassName();"none"===x&&(x=s.color||this.color||"none"),"none"!==x&&(s.color=x),d=b,c=y-l,u=m+l,b=d>c?d<u?d:u:c,!1===r.wrap&&(b=(p=b)>y?p<m?p:m:y);let M=n?(t-h)/2/t:0,I=Math.min(b,this.thresholdAngleRad)-M,w=Math.max(b,this.thresholdAngleRad)+M;w-I>2*Math.PI&&(w=I+2*Math.PI);let O=n?"50%":0;r.borderRadius&&(O=A(r.borderRadius).radius),s.shapeArgs=R={x:o[0],y:o[1],r:t,innerR:h,start:I,end:w,borderRadius:O},s.startR=t,C?(v=R.d,C.animate(i({fill:x},R)),v&&(R.d=v)):s.graphic=C=a.arc(R).attr({fill:x,"sweep-flag":0}).add(this.group),this.chart.styledMode?this.yAxis?.stops&&(j=j.replace(/highcharts-color-\d/gm,"").trim()):("square"!==r.linecap&&C.attr({"stroke-linecap":"round","stroke-linejoin":"round"}),C.attr({stroke:r.borderColor||"none","stroke-width":r.borderWidth||0})),C&&C.addClass(j)}}animate(t){t||(this.startAngleRad=this.thresholdAngleRad,O.prototype.animate.call(this,t))}}P.defaultOptions=u(w.defaultOptions,{colorByPoint:!0,dataLabels:{y:0}}),v().registerSeriesType("solidgauge",P);let _=s();export{_ as default};