UNPKG

@coderundebug/ui-web

Version:

A collection of UI web components that can be used in any web project.

2 lines 73.5 kB
/* By Stephen Paul Hassall (web: https://coderundebug.com) */ import{UiTools as t}from"./ui-tools.js";class i{static TYPE_VERTICAL=0;static TYPE_HORIZONTAL=1;static MODE_BAR=0;static MODE_LINE=1;static MODE_CURVE=2;static COLOR_LIST=["#1858bb","#e1b038","#dd6149","#109b95","#64c056","#df66b0","#756bb2","#18b3bb","#a32dab","#b78675","#757575","#c0ca33","#c35a09","#9678df","#b71c54","#2d8bd5","#67d0dd","#607d8b","#b0bec5","#347936"];constructor(){this.t=null,this.i={},this.i.x=0,this.i.y=0,this.i.width=0,this.i.height=0,this.h={},this.h.x=0,this.h.y=0,this.h.width=0,this.h.height=0,this.l={},this.l.x=0,this.l.y=0,this.l.width=0,this.l.height=0,this.o={},this.o.x=0,this.o.y=0,this.o.width=0,this.o.height=0,this.u=-1,this.p=-1,this.v=[],this.m=0,this.k=0,this._=[],this.L=[],this.I=[],this.M=[],this.S=[],this.C=[],this.A=this.A.bind(this),this.j=this.j.bind(this),this.F=this.F.bind(this),this.T=this.T.bind(this),this.B=this.B.bind(this)}get options(){return this.t}get innerArea(){return this.i}get valueAxisArea(){return this.h}get categoryAxisArea(){return this.l}get dataArea(){return this.o}get minimumWidth(){return this.u}get minimumHeight(){return this.p}get dataList(){return this.v}get valueMin(){return this.m}get valueMax(){return this.k}get segmentList(){return this._}get categoryList(){return this.L}get barIndexList(){return this.I}get lineIndexList(){return this.M}get barList(){return this.S}get lineList(){return this.C}hasData(){return 0!==this.v.length&&(0!==this._.length&&0!==this.L.length)}processOptions(t){if(this.t={},this.t.chartType=i.TYPE_VERTICAL,this.t.selectable=!1,this.t.highlight=!1,this.t.stack=!1,this.t.padding=12,this.t.cornerSize=4,this.t.plusColor=void 0,this.t.minusColor=void 0,this.t.legend={},this.t.legend.type=0,this.t.legend.showPopup=!1,this.t.legend.formatTextCallback=this.F,this.t.series={},this.t.series.valueList=[],this.t.valueAxis={},this.t.valueAxis.show=!0,this.t.valueAxis.size=50,this.t.valueAxis.endPaddingSize=8,this.t.valueAxis.minSegmentSize=32,this.t.valueAxis.segmentDenominator=void 0,this.t.valueAxis.baseLineAdjustment=5,this.t.valueAxis.nubSize=8,this.t.valueAxis.fixedMin=void 0,this.t.valueAxis.fixedMax=void 0,this.t.valueAxis.showLine=!0,this.t.valueAxis.showNub=!0,this.t.valueAxis.showText=!0,this.t.valueAxis.rotateText=!1,this.t.valueAxis.showZero=!0,this.t.valueAxis.textPrefix="",this.t.valueAxis.textSuffix="",this.t.valueAxis.textGap=8,this.t.valueAxis.formatTextCallback=this.A,this.t.guideLine={},this.t.guideLine.showValueAxis=!0,this.t.guideLine.showCategoryAxis=!0,this.t.categoryAxis={},this.t.categoryAxis.show=!0,this.t.categoryAxis.size=50,this.t.categoryAxis.switch=!1,this.t.categoryAxis.nubSize=8,this.t.categoryAxis.nubCenter=!1,this.t.categoryAxis.textType=0,this.t.categoryAxis.textGap=8,this.t.categoryAxis.showLine=!0,this.t.categoryAxis.showNub=!0,this.t.categoryAxis.showText=!0,this.t.categoryAxis.rotateText=!1,this.t.bar={},this.t.bar.categoryGap=8,this.t.bar.valueGap=0,this.t.label={},this.t.label.show=!1,this.t.label.textSuffix="",this.t.label.textPrefix="",this.t.label.textGap=12,this.t.label.location="end",this.t.label.locationLimit=16,this.t.label.formatTextCallback=this.j,this.t.popup={},this.t.popup.show=!1,this.t.popup.formatInfoTextCallback=this.T,this.t.popup.formatValueTextCallback=this.B,this.t.line={},this.t.line.showDots=!0,this.t.line.dotSize=0,this.t.line.interfaceDotSize=12,t){const e="undefined";"vertical"===t.type&&(this.t.chartType=i.TYPE_VERTICAL),"horizontal"===t.type&&(this.t.chartType=i.TYPE_HORIZONTAL),this.t.chartType===i.TYPE_HORIZONTAL&&(this.t.valueAxis.minSegmentSize=60),typeof t.selectable!==e&&(this.t.selectable=t.selectable),typeof t.highlight!==e&&(this.t.highlight=t.highlight),typeof t.stack!==e&&(this.t.stack=t.stack),typeof t.padding!==e&&(this.t.padding=t.padding),typeof t.cornerSize!==e&&(this.t.cornerSize=t.cornerSize),typeof t.plusColor!==e&&(this.t.plusColor=t.plusColor),typeof t.minusColor!==e&&(this.t.minusColor=t.minusColor),"object"==typeof t.legend&&(typeof t.legend.type!==e&&(this.t.legend.type=t.legend.type),typeof t.legend.showPopup!==e&&(this.t.legend.showPopup=t.legend.showPopup),typeof t.legend.formatTextCallback!==e&&(this.t.legend.formatTextCallback=t.legend.formatTextCallback)),"object"==typeof t.series&&!0===Array.isArray(t.series.valueList)&&t.series.valueList.forEach((t=>{const e={};e.name=t.name,e.color=t.color,e.mode=i.MODE_BAR,e.smoothing=t.smoothing,"line"===t.mode&&(e.mode=i.MODE_LINE),"curve"===t.mode&&(e.mode=i.MODE_CURVE),this.t.series.valueList.push(e)})),"object"==typeof t.valueAxis&&(typeof t.valueAxis.show!==e&&(this.t.valueAxis.show=t.valueAxis.show),typeof t.valueAxis.size!==e&&(this.t.valueAxis.size=t.valueAxis.size),typeof t.valueAxis.endPaddingSize!==e&&(this.t.valueAxis.endPaddingSize=t.valueAxis.endPaddingSize),typeof t.valueAxis.minSegmentSize!==e&&(this.t.valueAxis.minSegmentSize=t.valueAxis.minSegmentSize),typeof t.valueAxis.segmentDenominator!==e&&(this.t.valueAxis.segmentDenominator=t.valueAxis.segmentDenominator),typeof t.valueAxis.baseLineAdjustment!==e&&(this.t.valueAxis.baseLineAdjustment=t.valueAxis.baseLineAdjustment),typeof t.valueAxis.nubSize!==e&&(this.t.valueAxis.nubSize=t.valueAxis.nubSize),typeof t.valueAxis.fixedMin!==e&&(this.t.valueAxis.fixedMin=t.valueAxis.fixedMin),typeof t.valueAxis.fixedMax!==e&&(this.t.valueAxis.fixedMax=t.valueAxis.fixedMax),typeof t.valueAxis.showLine!==e&&(this.t.valueAxis.showLine=t.valueAxis.showLine),typeof t.valueAxis.showNub!==e&&(this.t.valueAxis.showNub=t.valueAxis.showNub),typeof t.valueAxis.showText!==e&&(this.t.valueAxis.showText=t.valueAxis.showText),typeof t.valueAxis.rotateText!==e&&(this.t.valueAxis.rotateText=t.valueAxis.rotateText),typeof t.valueAxis.showZero!==e&&(this.t.valueAxis.showZero=t.valueAxis.showZero),typeof t.valueAxis.textPrefix!==e&&(this.t.valueAxis.textPrefix=t.valueAxis.textPrefix),typeof t.valueAxis.textSuffix!==e&&(this.t.valueAxis.textSuffix=t.valueAxis.textSuffix),typeof t.valueAxis.textGap!==e&&(this.t.valueAxis.textGap=t.valueAxis.textGap),typeof t.valueAxis.formatTextCallback!==e&&(this.t.valueAxis.formatTextCallback=t.valueAxis.formatTextCallback)),"object"==typeof t.categoryAxis&&(typeof t.categoryAxis.show!==e&&(this.t.categoryAxis.show=t.categoryAxis.show),typeof t.categoryAxis.switch!==e&&(this.t.categoryAxis.switch=t.categoryAxis.switch),typeof t.categoryAxis.size!==e&&(this.t.categoryAxis.size=t.categoryAxis.size),typeof t.categoryAxis.nubSize!==e&&(this.t.categoryAxis.nubSize=t.categoryAxis.nubSize),typeof t.categoryAxis.nubCenter!==e&&(this.t.categoryAxis.nubCenter=t.categoryAxis.nubCenter),typeof t.categoryAxis.textType!==e&&(this.t.categoryAxis.textType=t.categoryAxis.textType),typeof t.categoryAxis.textGap!==e&&(this.t.categoryAxis.textGap=t.categoryAxis.textGap),typeof t.categoryAxis.showLine!==e&&(this.t.categoryAxis.showLine=t.categoryAxis.showLine),typeof t.categoryAxis.showNub!==e&&(this.t.categoryAxis.showNub=t.categoryAxis.showNub),typeof t.categoryAxis.showText!==e&&(this.t.categoryAxis.showText=t.categoryAxis.showText),typeof t.categoryAxis.rotateText!==e&&(this.t.categoryAxis.rotateText=t.categoryAxis.rotateText)),"object"==typeof t.guideLine&&(typeof t.guideLine.showValueAxis!==e&&(this.t.guideLine.showValueAxis=t.guideLine.showValueAxis),typeof t.guideLine.showCategoryAxis!==e&&(this.t.guideLine.showCategoryAxis=t.guideLine.showCategoryAxis)),"object"==typeof t.bar&&(typeof t.bar.categoryGap!==e&&(this.t.bar.categoryGap=t.bar.categoryGap),typeof t.bar.valueGap!==e&&(this.t.bar.valueGap=t.bar.valueGap)),"object"==typeof t.label&&(typeof t.label.show!==e&&(this.t.label.show=t.label.show),typeof t.label.textSuffix!==e&&(this.t.label.textSuffix=t.label.textSuffix),typeof t.label.textPrefix!==e&&(this.t.label.textPrefix=t.label.textPrefix),typeof t.label.textGap!==e&&(this.t.label.textGap=t.label.textGap),typeof t.label.location!==e&&(this.t.label.location=t.label.location),typeof t.label.locationLimit!==e&&(this.t.label.locationLimit=t.label.locationLimit),typeof t.label.formatTextCallback!==e&&(this.t.label.formatTextCallback=t.label.formatTextCallback)),"object"==typeof t.popup&&(typeof t.popup.show!==e&&(this.t.popup.show=t.popup.show),typeof t.popup.formatInfoTextCallback!==e&&(this.t.popup.formatInfoTextCallback=t.popup.formatInfoTextCallback),typeof t.popup.formatValueTextCallback!==e&&(this.t.popup.formatValueTextCallback=t.popup.formatValueTextCallback)),"object"==typeof t.line&&(typeof t.line.showDots!==e&&(this.t.line.showDots=t.line.showDots),typeof t.line.dotSize!==e&&(this.t.line.dotSize=t.line.dotSize),typeof t.line.interfaceDotSize!==e&&(this.t.line.interfaceDotSize=t.line.interfaceDotSize))}this.t.chartType===i.TYPE_VERTICAL&&(this.u=this.t.valueAxis.size+2*this.t.padding+48,this.p=this.t.categoryAxis.size+2*this.t.padding+48),this.t.chartType===i.TYPE_HORIZONTAL&&(this.u=this.t.categoryAxis.size+2*this.t.padding+48,this.p=this.t.valueAxis.size+2*this.t.padding+48)}processData(t){if(this.v=[],!t)return;if(!1===Array.isArray(t))return;t.forEach((t=>{if(!t.category)return;if("number"!=typeof t.value&&!1===Array.isArray(t.valueList))return;const i={};i.category=t.category,i.valueList=[],i.textList=[],"number"==typeof t.value&&i.valueList.push(t.value),!0===Array.isArray(t.valueList)&&t.valueList.forEach((t=>{i.valueList.push(t)})),"string"==typeof t.text&&i.textList.push(t.text),!0===Array.isArray(t.textList)&&t.textList.forEach((t=>{i.textList.push(t)})),i.data=t.data,0!==i.valueList.length&&this.v.push(i)}));for(let t=0;t<this.v.length;t++){this.v[t].index=t}if(0===this.v.length)return;this.v.forEach((t=>{const e=t.valueList[0];t.min=e,t.max=e,t.totalPlus=0,t.totalMinus=0;for(let e=0;e<t.valueList.length;e++){const s=t.valueList[e];s<t.min&&(t.min=s),s>t.max&&(t.max=s);let r=!0;if(e<this.t.series.valueList.length){this.t.series.valueList[e].mode!==i.MODE_BAR&&(r=!1)}!0===r&&(s>0&&(t.totalPlus+=s),s<0&&(t.totalMinus+=s))}}));const e=this.v[0];let s=e.min,r=e.max;!0===this.t.stack&&(e.totalMinus<s&&(s=e.totalMinus),e.totalPlus>r&&(r=e.totalPlus)),this.v.forEach((t=>{t.min<s&&(s=t.min),t.max>r&&(r=t.max),!0===this.t.stack&&(t.totalMinus<s&&(s=t.totalMinus),t.totalPlus>r&&(r=t.totalPlus))})),s>0&&r>0&&(s=0),s<0&&r<0&&(r=0),0===s&&0===r&&(r=1),this.m=s,this.k=r,void 0!==this.t.valueAxis.fixedMin&&this.t.valueAxis.fixedMin<this.m&&(this.m=this.t.valueAxis.fixedMin),void 0!==this.t.valueAxis.fixedMax&&this.t.valueAxis.fixedMax>this.k&&(this.k=this.t.valueAxis.fixedMax);let h=1;this.t.series.valueList.forEach((t=>{t.color||(t.color="var(--ui-chart-color"+h.toString()+", "+i.COLOR_LIST[h-1]+")",h++,h>20&&(h=1))})),h=1,this.v.forEach((t=>{t.color||(t.color="var(--ui-chart-color"+h.toString()+", "+i.COLOR_LIST[h-1]+")")})),this.I=[],this.M=[];for(let t=0;t<this.t.series.valueList.length;t++){const e=this.t.series.valueList[t];e.mode===i.MODE_BAR&&this.I.push(t),e.mode!==i.MODE_BAR&&this.M.push(t)}if(0!==this.v.length&&0===this.t.series.valueList.length){const t=this.v[0];for(let i=0;i<t.valueList.length;i++)this.I.push(i)}}createBarList(){const t=this.t.bar.categoryGap/2;let e=this._[this._.length-1],s=this._[0],r=null;for(let t=0;t<this._.length;t++){const i=this._[t];if(0===i.value){r=i;break}}let h=s.pixel;r&&(h=r.pixel);let a=Math.abs((s.pixel-e.pixel)/(e.value-s.value)),n=!1;this.t.chartType===i.TYPE_HORIZONTAL&&(n=!0),this.S=[];const l=this.I.length+this.M.length;if(!1===this.t.stack)for(let e=0;e<this.v.length;e++){const s=this.v[e],r=this.L[e],o=(r.size-this.t.bar.categoryGap-(this.I.length-1)*this.t.bar.valueGap)/this.I.length;let c=r.pixel;c+=t;let u=1;for(let t=0;t<this.I.length;t++){const r=this.I[t],d=s.valueList[r];let p=null;r<this.t.series.valueList.length&&(p=this.t.series.valueList[r]);const f={};f.locationPixel=c,f.locationSize=o,f.lengthSize=Math.round(d*a),f.lengthSize>0&&(f.lengthPixel=!0===n?h:h-f.lengthSize),f.lengthSize<0&&(f.lengthSize=-f.lengthSize,f.lengthPixel=!0===n?h-f.lengthSize:h),p&&(f.color=p.color),f.color||(f.color="var(--ui-chart-color"+u.toString()+", "+i.COLOR_LIST[u-1]+")",u++,u>20&&(u=1)),d>0&&this.t.plusColor&&(f.color=this.t.plusColor),d<0&&this.t.minusColor&&(f.color=this.t.minusColor),f.start=!1,f.end=!1,d>0?f.end=!0:f.start=!0,f.item=s,f.value=d,f.categoryIndex=e,f.seriesIndex=r,f.valueIndex=e*l+r,c+=o,c+=this.t.bar.valueGap,0!==d&&this.S.push(f)}}if(!0===this.t.stack)for(let e=0;e<this.v.length;e++){const s=this.v[e],r=this.L[e],o=r.size-this.t.bar.categoryGap;let c=r.pixel;c+=t;let u=h,d=h,p=1,f=null,g=null;for(let t=0;t<this.I.length;t++){const r=this.I[t],h=s.valueList[r];if(0===h)continue;let v=null;r<this.t.series.valueList.length&&(v=this.t.series.valueList[r]);const b={};b.locationPixel=c,b.locationSize=o,h>0&&(b.lengthSize=Math.round(h*a),!0===n?(b.lengthPixel=u,u+=b.lengthSize):(b.lengthPixel=u-b.lengthSize,u-=b.lengthSize),g=b),h<0&&(b.lengthSize=-Math.round(h*a),!0===n?(b.lengthPixel=d-b.lengthSize,d-=b.lengthSize):(b.lengthPixel=d,d+=b.lengthSize),f=b),v&&(b.color=v.color),b.color||(b.color="var(--ui-chart-color"+p.toString()+", "+i.COLOR_LIST[p-1]+")",p++,p>20&&(p=1)),b.start=!1,b.end=!1,b.item=s,b.value=h,b.categoryIndex=e,b.seriesIndex=r,b.valueIndex=e*l+r,this.S.push(b)}f&&(f.start=!0),g&&(g.end=!0)}}createLineList(){if(0===this.M.length)return[];let t=this._[this._.length-1],e=this._[0],s=null;for(let t=0;t<this._.length;t++){const i=this._[t];if(0===i.value){s=i;break}}let r=e.pixel;s&&(r=s.pixel);const h=(e.pixel-t.pixel)/(t.value-e.value);this.C=[];let a=1,n=this.o.width;this.t.chartType===i.TYPE_HORIZONTAL&&(n=this.o.height);const l=Math.floor(n/this.v.length),o=this.I.length+this.M.length;for(let t=0;t<this.M.length;t++){const e=this.M[t];let s=null;e<this.t.series.valueList.length&&(s=this.t.series.valueList[e]);const n={};n.mode=i.MODE_LINE,s.mode&&(n.mode=s.mode),n.smoothing=s.smoothing,n.pointList=[],s&&(n.color=s.color),n.color||(n.color="var(--ui-chart-color"+a.toString()+", "+i.COLOR_LIST[a-1]+")",a++,a>20&&(a=1)),n.seriesIndex=e;let c=l/2;for(let t=0;t<this.v.length;t++){const i=this.v[t],s=i.valueList[e],a={};a.locationPixel=c,a.lengthPixel=r-Math.round(s*h),a.item=i,a.value=s,a.valueIndex=t*o+e,a.categoryIndex=t,c+=l,n.pointList.push(a)}this.C.push(n)}}createSegmentList(t){if(t<1)return;if(this.m>this.k)return;if(this.t.valueAxis.minSegmentSize<1)return;const i=this.k-this.m;if(0===i)return;let e=0;if(i>1){const t=i.toFixed(0);e=Math.pow(10,t.length-1)}else{const t=i.toString();let s=0;for(let i=2;i<t.length;i++){if("0"!==t.charAt(i))break;s++}e=.1*Math.pow(.1,s)}for(;;){const s=Math.ceil(i/e);if(Math.ceil(t/s)<this.t.valueAxis.minSegmentSize)break;e/=2}for(;;){const s=Math.ceil(i/e);if(Math.ceil(t/s)>this.t.valueAxis.minSegmentSize)break;if(1===s)break;e*=2}this.t.valueAxis.segmentDenominator&&(e=this.t.valueAxis.segmentDenominator);let s=0,r=0;0!==this.m&&(r=Math.floor(this.m/e)*e),0!==this.k&&(s=Math.ceil(this.k/e)*e);let h=t,a=this.t.valueAxis.endPaddingSize,n=this.t.valueAxis.endPaddingSize;!0===this.t.categoryAxis.show&&(!1===this.t.categoryAxis.switch&&(a=0),!0===this.t.categoryAxis.switch&&(n=0)),0!==this.m&&(h-=a),0!==this.k&&(h-=n);const l=Math.floor((s-r)/e),o=Math.floor(h/l);let c=this.O(e);if(this._=[],!1===this.t.categoryAxis.switch){let i=r,h=t;!1===this.t.categoryAxis.show&&(h-=a);const n=parseFloat(s.toFixed(c));for(;;){const t={};t.value=i,t.valueText=this.t.valueAxis.formatTextCallback(t.value,c),t.pixel=h,this._.push(t),i+=e,h-=o;if(parseFloat(i.toFixed(c))>n)break}}if(!0===this.t.categoryAxis.switch){let t=s,i=0;!1===this.t.categoryAxis.show&&(i+=n);const h=parseFloat(r.toFixed(c));for(;;){const s={};s.value=t,s.valueText=this.t.valueAxis.formatTextCallback(s.value,c),s.pixel=i,this._.push(s),t-=e,i+=o;if(parseFloat(t.toFixed(c))<h)break}}}O(t){const i=t.toString(),e=i.indexOf(".");if(-1===e)return 0;let s=0,r=0;for(let t=e+1;t<i.length;t++){const e=i.charAt(t);if(r++,0===s){if("0"===e)continue;s=1}if(1===s){if("0"!==e)continue;r--;break}}return r}checkBaseLine(){if(0===this.t.valueAxis.baseLineAdjustment)return!1;if(!1===this.t.categoryAxis.show)return!1;if(!1===this.t.categoryAxis.showLine)return!1;let t=!1;if(this.t.chartType===i.TYPE_VERTICAL){if(this.m<0&&!1===this.t.categoryAxis.switch){let i=this._[0];this.m===i.value&&(this.m=this.m+this.m*this.t.valueAxis.baseLineAdjustment/100,t=!0)}if(this.k>0&&!0===this.t.categoryAxis.switch){let i=this._[0];this.k===i.value&&(this.k=this.k+this.k*this.t.valueAxis.baseLineAdjustment/100,t=!0)}}if(this.t.chartType===i.TYPE_HORIZONTAL){if(this.m<0&&!1===this.t.categoryAxis.switch){let i=this._[0];this.m===i.value&&(this.m=this.m+this.m*this.t.valueAxis.baseLineAdjustment/100,t=!0)}if(this.k>0&&!0===this.t.categoryAxis.switch){let i=this._[0];this.k===i.value&&(this.k=this.k+this.k*this.t.valueAxis.baseLineAdjustment/100,t=!0)}}return t}createCategoryList(t){const i=Math.floor(t/this.v.length);let e=0;this.L=[],this.v.forEach((t=>{const s={};s.pixel=e,s.size=i,s.middle=s.pixel+s.size/2,s.text=t.category,this.L.push(s),e+=i}))}A(t,i){return this.t.valueAxis.textPrefix+t.toFixed(i)+this.t.valueAxis.textSuffix}j(t,i,e){if(e<i.textList.length)return i.textList[e];return this.t.label.textPrefix+t.toString()+this.t.label.textSuffix}F(t,i){return 0===this.t.legend.type?t:1===this.t.legend.type?i:2===this.t.legend.type?t+" / "+i:void 0}T(t,i){return 0===this.t.legend.type?t.category:1===this.t.legend.type?i.name:2===this.t.legend.type?t.category+" / "+i.name:void 0}B(t,i,e){if(i<e.textList.length)return e.textList[i];return t.toString()}}class e{constructor(t,i){this.P=t,this.H=i,this.V=t.shadowRoot.querySelector(".base"),this.D=t.shadowRoot.getElementById("chart"),this.U=t.shadowRoot.getElementById("popup"),this.R=t.shadowRoot.getElementById("popup-color"),this.Z=t.shadowRoot.getElementById("popup-info"),this.N=t.shadowRoot.getElementById("popup-value"),this.Y=this.Y.bind(this),this.G=this.G.bind(this),this.W=this.W.bind(this),this.q=[],this.J=null,this.K=null,this.X=-1,this.$=-1,this.tt=null,this.it=null}addEvents(t){t.addEventListener("click",this.Y),this.q.forEach((t=>{t.removeEventListener("pointermove",this.G),t.removeEventListener("pointerout",this.W)})),!0!==this.H.options.popup.show&&!0!==this.H.options.highlight||(this.q=this.P.shadowRoot.querySelectorAll(".bar"),this.q.forEach((t=>{t.addEventListener("pointermove",this.G),t.addEventListener("pointerout",this.W)})))}removeEvents(t){t.removeEventListener("click",this.Y),this.q.forEach((t=>{t.removeEventListener("pointermove",this.G),t.removeEventListener("pointerout",this.W)}))}chartItemHighlight(t){if(null==t)return void this.et(null,-1);if("number"!=typeof t)return;if(t<0)return;let i="";0===this.H.options.legend.type&&(i='.bar[data-category-index="'+t.toString()+'"]'),1===this.H.options.legend.type&&(i='.bar[data-series-index="'+t.toString()+'"]'),2===this.H.options.legend.type&&(i='.bar[data-value-index="'+t.toString()+'"]');const e=this.P.shadowRoot.querySelectorAll(i);if(0!==e.length){if(!0===this.H.options.legend.showPopup){if(2!==this.H.options.legend.type&&1===e.length){const t=e[0];this.st(t)}if(2===this.H.options.legend.type){const t=e[0];this.st(t)}}this.et(e,t)}}chartItemSelect(t){if(null==t)return void this.rt(null,-1);if("number"!=typeof t)return;if(t<0)return;let i="";0===this.H.options.legend.type&&(i='.bar[data-category-index="'+t.toString()+'"]'),1===this.H.options.legend.type&&(i='.bar[data-series-index="'+t.toString()+'"]'),2===this.H.options.legend.type&&(i='.bar[data-value-index="'+t.toString()+'"]');const e=this.P.shadowRoot.querySelectorAll(i);this.rt(e,t)}Y(t){let i=t.target;if(null===i)return;const e=this.X;if(this.rt(null,-1),!1===i.classList.contains("bar"))return;if(!1===this.H.options.selectable)return;let s=0;if(0===this.H.options.legend.type&&(s=i.dataset.categoryIndex),1===this.H.options.legend.type&&(s=i.dataset.seriesIndex),2===this.H.options.legend.type&&(s=i.dataset.valueIndex),void 0===s)return;if(s===e)return;this.ht(i);let r="";0===this.H.options.legend.type&&(r='.bar[data-category-index="'+s.toString()+'"]'),1===this.H.options.legend.type&&(r='.bar[data-series-index="'+s.toString()+'"]'),2===this.H.options.legend.type&&(r='.bar[data-value-index="'+s.toString()+'"]');const h=this.P.shadowRoot.querySelectorAll(r);this.rt(h,s)}G(t){let i=t.target;if(null===i)return;if(i===this.it)return;this.it=i,this.st(i);let e=0;if(0===this.H.options.legend.type&&(e=i.dataset.categoryIndex),1===this.H.options.legend.type&&(e=i.dataset.seriesIndex),2===this.H.options.legend.type&&(e=i.dataset.valueIndex),void 0===e)return;let s="";0===this.H.options.legend.type&&(s='.bar[data-category-index="'+e.toString()+'"]'),1===this.H.options.legend.type&&(s='.bar[data-series-index="'+e.toString()+'"]'),2===this.H.options.legend.type&&(s='.bar[data-value-index="'+e.toString()+'"]');const r=this.P.shadowRoot.querySelectorAll(s);0!==r.length&&!0===this.H.options.highlight&&(this.nt(i),this.et(r,e))}W(t){this.it=null,this.et(null,-1)}et(t,i){if(this.J&&0!==this.J.length){const t=this.J[0].parentElement;this.J.forEach((i=>{i.remove(),t.appendChild(i)}))}if(null===t)return this.K&&(this.K.forEach((t=>{t.classList.remove("highlighting")})),this.K=null),this.$=-1,this.U.style.display="none",void(this.tt=null);if(i===this.$)return;if(this.$=i,this.K&&(this.K.forEach((t=>{t.classList.remove("highlighting")})),this.K=null),this.K=t,0===t.length)return;const e=t[0].parentElement;this.K.forEach((t=>{t.remove(),e.appendChild(t),t.classList.add("highlighting")}))}rt(t,i){if(null===t||0===t.length)return this.J&&(this.J.forEach((t=>{t.classList.remove("select")})),this.J=null),void(this.X=-1);if(i===this.X)return this.J&&(this.J.forEach((t=>{t.classList.remove("select")})),this.J=null),void(this.X=-1);if(this.X=i,this.J&&(this.J.forEach((t=>{t.classList.remove("select")})),this.J=null),this.J=t,0===t.length)return;const e=t[0].parentElement;this.J.forEach((t=>{t.remove(),e.appendChild(t),t.classList.add("select")}))}nt(t){const i=parseInt(t.dataset.categoryIndex),e=parseInt(t.dataset.seriesIndex),s=new CustomEvent("highlighted",{bubbles:!0,composed:!0,detail:{categoryIndex:i,seriesIndex:e}});this.P.dispatchEvent(s)}ht(t){const i=parseInt(t.dataset.categoryIndex),e=parseInt(t.dataset.seriesIndex),s=new CustomEvent("selected",{bubbles:!0,composed:!0,detail:{categoryIndex:i,seriesIndex:e}});this.P.dispatchEvent(s)}st(t){const e=this.H.options;if(!1===e.popup.show)return;if(t===this.tt)return;this.tt=t;const s=parseInt(t.dataset.barIndex);let r=0,h=0;const a=this.D.querySelector('text[data-label="'+s.toString()+'"]');if(a){const t=a.getBoundingClientRect();r=t.width/2+2,h=t.height/2+2}const n=this.H.barList[s];let l=0,o=0;const c=this.H.dataArea;e.chartType===i.TYPE_VERTICAL&&(l=c.x+n.locationPixel+n.locationSize/2,o=c.y+n.lengthPixel+n.lengthSize/2),e.chartType===i.TYPE_HORIZONTAL&&(l=c.x+n.lengthPixel+n.lengthSize/2,o=c.y+n.locationPixel+n.locationSize/2);const u=this.V.getBoundingClientRect(),d=u.width/2,p=u.height/2;this.U.style.opacity=0,this.U.style.display="grid",this.U.classList.remove("triangle-top","triangle-bottom","triangle-left","triangle-right"),this.lt(n);const f=this.U.getBoundingClientRect();let g=null,v=null,b=null,x=null;const y=f.width/2,m=f.height/2;e.chartType===i.TYPE_VERTICAL&&(l<d?o<=m?l<y?(b=o+h,g=l+r):(this.U.classList.add("triangle-top"),b=o+h,g=l-y):o>u.height-m?l<y?(x=u.height-o+h,g=l+r):(this.U.classList.add("triangle-bottom"),x=u.height-o+h,g=l-y):(this.U.classList.add("triangle-left"),b=o-f.height/2,g=l+r):o<=m?l>=u.width-y?(b=o+h,v=u.width-l+r):(this.U.classList.add("triangle-top"),b=o+h,v=u.width-l-y):o>u.height-m?l>=u.width-y?(x=u.height-o+h,v=u.width-l+r):(this.U.classList.add("triangle-bottom"),x=u.height-o+h,v=u.width-l-y):(this.U.classList.add("triangle-right"),b=o-f.height/2,v=u.width-l+r)),e.chartType===i.TYPE_HORIZONTAL&&(o<p?l<=y?o<m?(b=o+h,g=l+r):(this.U.classList.add("triangle-left"),b=o-m,g=l+r):l>u.width-y?o<m?(b=o+h,v=u.width-l+r):(this.U.classList.add("triangle-right"),b=o-m,v=u.width-l+r):(this.U.classList.add("triangle-top"),b=o+h,g=l-f.width/2):l<=y?o>u.height-m?(x=u.height-o+h,g=l+r):(this.U.classList.add("triangle-left"),b=o-m,g=l+r):l>u.width-y?o>u.height-m?(x=u.height-o+h,v=u.width-l+r):(this.U.classList.add("triangle-right"),b=o-m,v=u.width-l+r):(this.U.classList.add("triangle-bottom"),x=u.height-o+h,g=l-f.width/2)),this.U.style.left="",this.U.style.right="",this.U.style.top="",this.U.style.bottom="",g&&(this.U.style.left=g.toString()+"px"),v&&(this.U.style.right=v.toString()+"px"),b&&(this.U.style.top=b.toString()+"px"),x&&(this.U.style.bottom=x.toString()+"px"),this.U.style.opacity=1}lt(t){const i=this.H.options,e=this.H.dataList[t.categoryIndex];let s,r=t.color;0!==i.series.valueList.length&&(s=i.series.valueList[t.seriesIndex],r=s.color);const h=i.popup.formatInfoTextCallback(e,s),a=i.popup.formatValueTextCallback(t.value,t.seriesIndex,e);this.R.style.backgroundColor=r,this.Z.innerText=h,this.N.innerText=a,this.U.classList.remove("has-info","has-value"),h&&this.U.classList.add("has-info"),a&&this.U.classList.add("has-value"),h||a||(this.U.style.display="none")}}class s{constructor(t,i){this.P=t,this.H=i,this.V=t.shadowRoot.querySelector(".base"),this.U=t.shadowRoot.getElementById("popup"),this.R=t.shadowRoot.getElementById("popup-color"),this.Z=t.shadowRoot.getElementById("popup-info"),this.N=t.shadowRoot.getElementById("popup-value"),this.Y=this.Y.bind(this),this.ot=this.ot.bind(this),this.ct=this.ct.bind(this),this.ut=[],this.dt=[],this.ft=null,this.gt=null,this.vt=null,this.bt=null,this.X=-1,this.$=-1,this.tt=null,this.it=null}addEvents(t){t.addEventListener("click",this.Y),this.ut.forEach((t=>{t.removeEventListener("pointermove",this.ot),t.removeEventListener("pointerout",this.ct)})),this.dt.forEach((t=>{t.removeEventListener("pointermove",this.ot),t.removeEventListener("pointerout",this.ct)})),!0!==this.H.options.popup.show&&!0!==this.H.options.highlight||(this.ut=this.P.shadowRoot.querySelectorAll(".line-event"),this.ut.forEach((t=>{t.addEventListener("pointermove",this.ot),t.addEventListener("pointerout",this.ct)})),this.dt=this.P.shadowRoot.querySelectorAll(".line-event-dot"),this.dt.forEach((t=>{t.addEventListener("pointermove",this.ot),t.addEventListener("pointerout",this.ct)})))}removeEvents(t){t.removeEventListener("click",this.Y),this.ut.forEach((t=>{t.removeEventListener("pointermove",this.ot),t.removeEventListener("pointerout",this.ct)})),this.dt.forEach((t=>{t.removeEventListener("pointermove",this.ot),t.removeEventListener("pointerout",this.ct)}))}chartItemHighlight(t){if(null==t)return void this.et(null,null,-1);if("number"!=typeof t)return;if(t<0)return;if(0===this.H.options.legend.type)return void(this.H.barIndexList.length+this.H.lineIndexList.length!==1&&this.et(null,null,-1));if(!0===this.H.options.legend.showPopup&&2===this.H.options.legend.type){const i=this.P.shadowRoot.querySelector('.line-interface-dot[data-value-index="'+t.toString()+'"]');i&&this.st(i)}if(0===this.H.options.legend.type&&this.et(null,null,-1),2===this.H.options.legend.type){t%=this.H.barIndexList.length+this.H.lineIndexList.length}if(-1===this.H.lineIndexList.indexOf(t))return;const i=this.xt(0,t),e=this.xt(1,t);this.et(i,e,t)}chartItemSelect(t){if(null==t)return void this.rt(null,null,-1);if("number"!=typeof t)return;if(t<0)return;if(0===this.H.options.legend.type)return void this.rt(null,null,-1);if(2===this.H.options.legend.type){t%=this.H.barIndexList.length+this.H.lineIndexList.length}const i=this.xt(0,t),e=this.xt(1,t);this.rt(i,e,t)}Y(t){let i=t.target;if(null===i)return;const e=this.X;if(this.rt(null,null,-1),0===this.H.options.legend.type)return;if(!1===i.classList.contains("line-event")&&!1===i.classList.contains("line-event-dot"))return;if(!1===this.H.options.selectable)return;if(!i.dataset.seriesIndex)return;let s=parseInt(i.dataset.seriesIndex);if(s===e)return;this.ht(i);const r=this.xt(0,s),h=this.xt(1,s);this.rt(r,h,s)}ot(t){let i=t.target;if(null===i)return;if(i===this.it)return;if(!i.dataset.seriesIndex)return;if(0===this.H.options.legend.type)return;this.it=i;const e=parseInt(i.dataset.seriesIndex);if(2===this.H.options.legend.type){const t=parseInt(i.dataset.valueIndex),e=this.P.shadowRoot.querySelector('.line-interface-dot[data-value-index="'+t.toString()+'"]');e&&this.st(e)}const s=this.xt(0,e),r=this.xt(1,e);!0===this.H.options.highlight&&(this.nt(i),this.et(s,r,e))}ct(t){this.it=null,this.et(null,null,-1)}xt(t,i){let e='[data-series-index="'+i.toString()+'"]',s="";0===t&&(s=".line"+e),1===t&&(s=".line-dot"+e);return this.P.shadowRoot.querySelectorAll(s)}et(t,i,e){if(null===t)return this.vt&&(this.vt.forEach((t=>{t.classList.remove("highlighting")})),this.vt=null),this.bt&&(this.bt.forEach((t=>{t.classList.remove("highlighting")})),this.bt=null),this.$=-1,this.U.style.display="none",void(this.tt=null);e!==this.$&&(this.$=e,this.vt&&(this.vt.forEach((t=>{t.classList.remove("highlighting")})),this.vt=null),this.bt&&(this.bt.forEach((t=>{t.classList.remove("highlighting")})),this.bt=null),this.vt=t,this.vt.forEach((t=>{t.classList.add("highlighting")})),this.bt=i,this.bt.forEach((t=>{t.classList.add("highlighting")})))}rt(t,i,e){return null===t||0===t.length||e===this.X?(this.ft&&(this.ft.forEach((t=>{t.classList.remove("select")})),this.ft=null),this.gt&&(this.gt.forEach((t=>{t.classList.remove("select")})),this.gt=null),void(this.X=-1)):(this.X=e,this.ft&&(this.ft.forEach((t=>{t.classList.remove("select")})),this.ft=null),this.gt&&(this.gt.forEach((t=>{t.classList.remove("select")})),this.gt=null),this.ft=t,this.ft.forEach((t=>{t.classList.add("select")})),this.gt=i,void this.gt.forEach((t=>{t.classList.add("select")})))}nt(t){let i=-1;t.dataset.categoryIndex&&(i=parseInt(t.dataset.categoryIndex));const e=parseInt(t.dataset.seriesIndex),s=new CustomEvent("highlighted",{bubbles:!0,composed:!0,detail:{categoryIndex:i,seriesIndex:e}});this.P.dispatchEvent(s)}ht(t){let i=-1;t.dataset.categoryIndex&&(i=parseInt(t.dataset.categoryIndex));const e=parseInt(t.dataset.seriesIndex),s=new CustomEvent("selected",{bubbles:!0,composed:!0,detail:{categoryIndex:i,seriesIndex:e}});this.P.dispatchEvent(s)}st(t){if(!1===this.H.options.popup.show)return;if(!1===t.classList.contains("line-interface-dot"))return;if(t===this.tt)return;this.tt=t;const i=this.V.getBoundingClientRect(),e=t.getBoundingClientRect();let s=e.x+e.width/2-i.x,r=e.y+e.height/2-i.y;const h=i.width/2;this.U.style.opacity=0,this.U.style.display="grid",this.U.classList.remove("triangle-top","triangle-bottom","triangle-left","triangle-right"),this.lt(t);const a=this.U.getBoundingClientRect();let n=null,l=null,o=null,c=null;const u=a.width/2,d=a.height/2,p=this.H.options.line.interfaceDotSize/2;s<h?r<=d?s<u?(o=r+p,n=s+p):(this.U.classList.add("triangle-top"),o=r+p,n=s-u):r>i.height-d?s<u?(c=i.height-r+p,n=s+p):(this.U.classList.add("triangle-bottom"),c=i.height-r+p,n=s-u):(this.U.classList.add("triangle-left"),o=r-a.height/2,n=s+p):r<=d?s>=i.width-u?(o=r+p,l=i.width-s+p):(this.U.classList.add("triangle-top"),o=r+p,l=i.width-s-u):r>i.height-d?s>=i.width-u?(c=i.height-r+p,l=i.width-s+p):(this.U.classList.add("triangle-bottom"),c=i.height-r+p,l=i.width-s-u):(this.U.classList.add("triangle-right"),o=r-d,l=i.width-s+p),this.U.style.left="",this.U.style.right="",this.U.style.top="",this.U.style.bottom="",n&&(this.U.style.left=n.toString()+"px"),l&&(this.U.style.right=l.toString()+"px"),o&&(this.U.style.top=o.toString()+"px"),c&&(this.U.style.bottom=c.toString()+"px"),this.U.style.opacity=1}lt(t){const i=this.H.options,e=parseInt(t.dataset.categoryIndex),s=parseInt(t.dataset.seriesIndex),r=this.H.dataList[e],h=r.valueList[s];let a,n=r.color;0!==i.series.valueList.length&&(a=i.series.valueList[s],n=a.color);const l=i.popup.formatInfoTextCallback(r,a),o=i.popup.formatValueTextCallback(h,s,r);this.R.style.backgroundColor=n,this.Z.innerText=l,this.N.innerText=o,this.U.classList.remove("has-info","has-value"),l&&this.U.classList.add("has-info"),o&&this.U.classList.add("has-value"),l||o||(this.U.style.display="none")}}class r{yt(t,i,e){const s=t.options,r=t.innerArea,h=t.valueAxisArea,a=t.categoryAxisArea,n=t.dataArea;r.x=s.padding,r.y=s.padding,r.width=i-2*s.padding,r.height=e-2*s.padding,!0===s.valueAxis.show&&!1===s.categoryAxis.show&&(h.x=r.x,h.y=r.y,h.width=s.valueAxis.size,h.height=r.height,n.x=r.x+s.valueAxis.size,n.y=r.y,n.width=r.width-s.valueAxis.size,n.height=r.height,a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height),!0===s.valueAxis.show&&!0===s.categoryAxis.show&&(!1===s.categoryAxis.switch&&(h.x=r.x,h.y=r.y,h.width=s.valueAxis.size,h.height=r.height-s.categoryAxis.size,a.x=r.x+s.valueAxis.size,a.y=r.y+r.height-s.categoryAxis.size,a.width=r.width-s.valueAxis.size,a.height=s.categoryAxis.size,n.x=r.x+s.valueAxis.size,n.y=r.y,n.width=r.width-s.valueAxis.size,n.height=r.height-s.categoryAxis.size),!0===s.categoryAxis.switch&&(h.x=r.x,h.y=r.y+s.categoryAxis.size,h.width=s.valueAxis.size,h.height=r.height-s.categoryAxis.size,a.x=r.x+s.valueAxis.size,a.y=r.y,a.width=r.width-s.valueAxis.size,a.height=s.categoryAxis.size,n.x=r.x+s.valueAxis.size,n.y=r.y+s.categoryAxis.size,n.width=r.width-s.valueAxis.size,n.height=r.height-s.categoryAxis.size)),!0===s.categoryAxis.show&&!1===s.valueAxis.show&&(!1===s.categoryAxis.switch&&(a.x=r.x,a.y=r.y+r.height-s.categoryAxis.size,a.width=r.width,a.height=s.categoryAxis.size,n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height-s.categoryAxis.size),!0===s.categoryAxis.switch&&(a.x=r.x,a.y=r.y,a.width=r.width,a.height=s.categoryAxis.size,n.x=r.x,n.y=r.y+s.categoryAxis.size,n.width=r.width,n.height=r.height-s.categoryAxis.size),h.x=n.x,h.y=n.y,h.width=n.width,h.height=n.height),!1===s.valueAxis.show&&!1===s.categoryAxis.show&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height,h.x=n.x,h.y=n.y,h.width=n.width,h.height=n.height,a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height);const l=Math.floor(a.width/t.dataList.length)*t.dataList.length;a.width=l,n.width=l}createChartSvg(t,i,e){if(this.yt(t,i,e),t.createSegmentList(t.h.height),!0===t.checkBaseLine()&&t.createSegmentList(t.h.height),t.createCategoryList(t.l.width),!1===t.hasData())return;t.createBarList(),t.createLineList();const s=[];this.wt(t,s),this.kt(t,s),this._t(t,s),this.Lt(t,s),this.zt(t,s),this.It(t,s),this.Mt(t,s),this.St(t,s);return s.join("")}_t(t,i){const e=t.options;if(!1===e.valueAxis.show)return;const s=t.valueAxisArea;if(!0===e.valueAxis.showLine){let t=s.x+s.width,e=s.y,r=s.y+s.height;i.push('<line class="value-axis-line" x1="'+t.toString()+'" y1="'+e.toString()+'" x2="'+t.toString()+'" y2="'+r.toString()+'"></line>')}let r=s.x+s.width;e.valueAxis.showNub&&(r-=e.valueAxis.nubSize),r-=e.valueAxis.textGap,!0===e.valueAxis.rotateText&&(r=s.x+s.width-e.valueAxis.textGap,e.valueAxis.showNub&&(r-=e.valueAxis.nubSize));let h=s.x+s.width-e.valueAxis.nubSize,a=s.x+s.width;t.segmentList.forEach((t=>{const n=s.y+t.pixel;let l=!0;0===t.value&&!1===e.valueAxis.showZero&&(l=!1),!1===e.valueAxis.showText&&(l=!1),!0===l&&(!0===e.valueAxis.rotateText&&i.push('<text class="value-axis-text" x="'+r.toString()+'" y="'+n.toString()+'" dominant-baseline="middle" text-anchor="middle" transform="rotate(-90,'+r.toString()+","+n.toString()+')">'+t.valueText+"</text>"),!1===e.valueAxis.rotateText&&i.push('<text class="value-axis-text" x="'+r.toString()+'" y="'+n.toString()+'" dominant-baseline="middle" text-anchor="end">'+t.valueText+"</text>")),!0===e.valueAxis.showNub&&i.push('<line class="value-axis-nub" x1="'+h.toString()+'" y1="'+n.toString()+'" x2="'+a.toString()+'" y2="'+n.toString()+'"></line>')}))}wt(t,i){if(!1===t.options.guideLine.showValueAxis)return;const e=t.dataArea,s=t.valueAxisArea;let r=e.x,h=e.x+e.width;t.segmentList.forEach((t=>{const e=s.y+t.pixel;i.push('<line class="guide-line-value-axis" x1="'+r.toString()+'" y1="'+e.toString()+'" x2="'+h.toString()+'" y2="'+e.toString()+'"></line>')}))}It(t,i){let e=null;for(let i=0;i<t.segmentList.length;i++){const s=t.segmentList[i];if(0===s.value){e=s;break}}if(!e)return;const s=t.dataArea;let r=s.x,h=s.x+s.width;const a=s.y+e.pixel;i.push('<line class="guide-line-zero" x1="'+r.toString()+'" y1="'+a.toString()+'" x2="'+h.toString()+'" y2="'+a.toString()+'"></line>')}Lt(t,i){const e=t.options;if(!1===e.categoryAxis.show)return;const s=t.categoryAxisArea;if(!0===e.categoryAxis.showLine){let t=s.x,r=s.x+s.width,h=s.y;!0===e.categoryAxis.switch&&(h=s.y+s.height),i.push('<line class="category-axis-line" x1="'+t.toString()+'" y1="'+h.toString()+'" x2="'+r.toString()+'" y2="'+h.toString()+'"></line>')}let r=s.y,h=s.y+e.categoryAxis.nubSize;!0===e.categoryAxis.switch&&(r=s.y+s.height-e.categoryAxis.nubSize,h=s.y+s.height),-1===e.categoryAxis.nubSize&&(r=s.y,h=s.y+s.height),!0===e.categoryAxis.showNub&&!1===e.categoryAxis.nubCenter&&i.push('<line class="category-axis-nub" x1="'+s.x.toString()+'" y1="'+r.toString()+'" x2="'+s.x.toString()+'" y2="'+h.toString()+'"></line>');let a=s.height;e.categoryAxis.showNub&&(a-=e.categoryAxis.nubSize);let n=s.y+s.height-a/2,l="end";!0===e.categoryAxis.rotateText&&(!0===e.categoryAxis.switch?(n=s.y+s.height-e.categoryAxis.textGap,e.categoryAxis.showNub&&(n-=e.categoryAxis.nubSize),l="start"):(n=s.y+e.categoryAxis.textGap,e.categoryAxis.showNub&&(n+=e.categoryAxis.nubSize))),t.categoryList.forEach((t=>{const a=s.x+t.pixel+t.size,o=s.x+t.middle;!0===e.categoryAxis.showText&&(!0===e.categoryAxis.rotateText&&i.push('<text class="category-axis-text" x="'+o.toString()+'" y="'+n.toString()+'" dominant-baseline="middle" text-anchor="'+l+'" transform="rotate(-90,'+o.toString()+","+n.toString()+')">'+t.text+"</text>"),!1===e.categoryAxis.rotateText&&i.push('<text class="category-axis-text" x="'+o.toString()+'" y="'+n.toString()+'" dominant-baseline="middle" text-anchor="middle">'+t.text+"</text>")),!0===e.categoryAxis.showNub&&!1===e.categoryAxis.nubCenter&&i.push('<line class="category-axis-nub" x1="'+a.toString()+'" y1="'+r.toString()+'" x2="'+a.toString()+'" y2="'+h.toString()+'"></line>'),!0===e.categoryAxis.showNub&&!0===e.categoryAxis.nubCenter&&i.push('<line class="category-axis-nub" x1="'+o.toString()+'" y1="'+r.toString()+'" x2="'+o.toString()+'" y2="'+h.toString()+'"></line>')}))}kt(t,i){if(!1===t.options.guideLine.showCategoryAxis)return;const e=t.dataArea,s=t.categoryAxisArea;let r=e.y,h=e.y+e.height;for(let e=0;e<t.categoryList.length;e++){const a=t.categoryList[e],n=s.x+a.pixel+a.size;i.push('<line class="guide-line-category-axis" x1="'+n.toString()+'" y1="'+r.toString()+'" x2="'+n.toString()+'" y2="'+h.toString()+'"></line>')}}zt(t,i){const e=t.options,s=t.dataArea;i.push('<g class="bar-group">');for(let r=0;r<t.barList.length;r++){const h=t.barList[r];if(!0===h.end){i.push('<path class="bar" '),i.push('data-category-index="'+h.categoryIndex.toString()+'" '),i.push('data-series-index="'+h.seriesIndex.toString()+'" '),i.push('data-value-index="'+h.valueIndex.toString()+'" '),i.push('data-bar-index="'+r.toString()+'" '),i.push('fill="'+h.color+'" ');let t=s.x+h.locationPixel,a=s.y+h.lengthPixel+h.lengthSize,n=s.x+h.locationPixel+h.locationSize,l=s.y+h.lengthPixel;const o='d="M '+t.toString()+","+a.toString()+" L "+t.toString()+","+(l+e.cornerSize).toString()+" Q "+t.toString()+","+l.toString()+" "+(t+e.cornerSize).toString()+","+l.toString()+" L "+(n-e.cornerSize).toString()+","+l.toString()+" Q "+n.toString()+","+l.toString()+" "+n.toString()+","+(l+e.cornerSize).toString()+" L "+n.toString()+","+a.toString()+" L "+t.toString()+","+a.toString()+' z" ';i.push(o),i.push("></path>")}if(!0===h.start){i.push('<path class="bar"'),i.push('data-category-index="'+h.categoryIndex.toString()+'" '),i.push('data-series-index="'+h.seriesIndex.toString()+'" '),i.push('data-value-index="'+h.valueIndex.toString()+'" '),i.push('data-bar-index="'+r.toString()+'" '),i.push('fill="'+h.color+'" ');let t=s.x+h.locationPixel,a=s.y+h.lengthPixel+h.lengthSize,n=s.x+h.locationPixel+h.locationSize,l=s.y+h.lengthPixel;const o='d="M '+t.toString()+","+l.toString()+" L "+t.toString()+","+(a-e.cornerSize).toString()+" Q "+t.toString()+","+a.toString()+" "+(t+e.cornerSize).toString()+","+a.toString()+" L "+(n-e.cornerSize).toString()+","+a.toString()+" Q "+n.toString()+","+a.toString()+" "+n.toString()+","+(a-e.cornerSize).toString()+" L "+n.toString()+","+l.toString()+" L "+t.toString()+","+l.toString()+' z" ';i.push(o),i.push("></path>")}if(!1===h.start&&!1===h.end){i.push('<rect class="bar"'),i.push('data-category-index="'+h.categoryIndex.toString()+'" '),i.push('data-series-index="'+h.seriesIndex.toString()+'" '),i.push('data-value-index="'+h.valueIndex.toString()+'" '),i.push('data-bar-index="'+r.toString()+'" '),i.push('fill="'+h.color+'" ');let t=s.x+h.locationPixel;i.push('x="'+t.toString()+'" ');let e=s.y+h.lengthPixel;i.push('y="'+e.toString()+'" ');let a=h.locationSize;i.push('width="'+a.toString()+'" ');let n=h.lengthSize;i.push('height="'+n.toString()+'"'),i.push("></rect>")}}i.push("</g>")}Mt(t,e){0!==t.lineList.length&&(t.lineList.forEach((s=>{s.mode===i.MODE_LINE&&(this.Ct(t,e,s,0),this.Ct(t,e,s,1),this.Ct(t,e,s,2)),s.mode===i.MODE_CURVE&&(this.Et(t,e,s,0),this.Et(t,e,s,1),this.Et(t,e,s,2))})),!1!==t.options.line.showDots&&(0!==t.options.line.dotSize&&this.At(t,e,t.options.line.dotSize,0,!1),0!==t.options.line.interfaceDotSize&&(this.At(t,e,t.options.line.dotSize,1,!0),this.At(t,e,t.options.line.interfaceDotSize,2,!0))))}Ct(t,i,e,s){if(e.pointList.length<=1)return;i.push("<path "),0===s&&i.push('class="line" '),1===s&&i.push('class="line line-interface" '),2===s&&i.push('class="line line-event" '),i.push('data-series-index="'+e.seriesIndex.toString()+'" '),i.push('stroke="'+e.color+'" '),i.push('d="');let r=e.pointList[0],h=t.dataArea.x+r.locationPixel,a=t.dataArea.y+r.lengthPixel;i.push("M "+h.toString()+" "+a.toString());for(let s=1;s<e.pointList.length;s++){const r=e.pointList[s];h=t.dataArea.x+r.locationPixel,a=t.dataArea.y+r.lengthPixel,i.push(" L "+h.toString()+" "+a.toString())}i.push('"></path>')}Et(t,i,e,s){if(e.pointList.length<=1)return;i.push("<path "),0===s&&i.push('class="line" '),1===s&&i.push('class="line line-interface" '),2===s&&i.push('class="line line-event" '),i.push('data-series-index="'+e.seriesIndex.toString()+'" '),i.push('stroke="'+e.color+'" '),i.push('d="');let r=e.pointList[0],h=t.dataArea.x+r.locationPixel,a=t.dataArea.y+r.lengthPixel;i.push("M "+h.toString()+" "+a.toString());let n=.15;e.smoothing&&(n=e.smoothing);for(let s=0;s<e.pointList.length-1;s++){let r=null,h=null,a=null,l=null;r=0===s?e.pointList[s]:e.pointList[s-1],h=e.pointList[s],a=e.pointList[s+1],l=s===e.pointList.length-2?a:e.pointList[s+2];let o=r.locationPixel,c=r.lengthPixel,u=h.locationPixel,d=h.lengthPixel,p=a.locationPixel,f=a.lengthPixel,g=l.locationPixel,v=l.lengthPixel,b=t.dataArea.x+(u+(p-o)*n),x=t.dataArea.y+(d+(f-c)*n),y=t.dataArea.x+(p-(g-u)*n),m=t.dataArea.y+(f-(v-d)*n);i.push(" C "),i.push(b.toString()),i.push(","),i.push(x.toString()),i.push(" "),i.push(y.toString()),i.push(","),i.push(m.toString()),i.push(" "),i.push((t.dataArea.x+p).toString()),i.push(","),i.push((t.dataArea.y+f).toString())}i.push('"></path>')}At(t,i,e,s,r){const h=(e/2).toString();t.lineList.forEach((e=>{e.pointList.length<=1||e.pointList.forEach((a=>{i.push("<circle "),0===s&&i.push('class="line-dot" '),1===s&&i.push('class="line-dot line-interface-dot" '),2===s&&i.push('class="line-dot line-event-dot" '),!0===r&&(i.push('data-category-index="'+a.categoryIndex.toString()+'" '),i.push('data-series-index="'+e.seriesIndex.toString()+'" '),i.push('data-value-index="'+a.valueIndex.toString()+'" ')),i.push('fill="'+e.color+'" ');let n=t.dataArea.x+a.locationPixel,l=t.dataArea.y+a.lengthPixel;i.push('cx="'+n.toString()+'" cy="'+l.toString()+'" '),i.push('r="'+h+'" '),i.push("></circle>")}))}))}St(t,i){const e=t.options;if(!1===e.label.show)return;let s=0;"start"===e.label.location&&(s=1),"end"===e.label.location&&(s=2),"outside"===e.label.location&&(s=3),"plus"===e.label.location&&(s=4),"minus"===e.label.location&&(s=5),5===s&&t.valueMin>0&&(s=1),4===s&&t.valueMax<0&&(s=1),!0===e.stack&&(s=0);const r="middle",h="auto",a="hanging",n="inside",l="outside",o=e.label.locationLimit+2*e.label.textGap,c=e.label.locationLimit+e.label.textGap,u=s,d=t.dataArea;for(let p=0;p<t.barList.length;p++){const f=t.barList[p];s=u;let g=d.x+f.locationPixel+f.locationSize/2,v=0,b=r,x=r,y=n,m=!1;if(4===s&&f.value>0&&(s=1),5===s&&f.value<0&&(s=1),f.lengthSize<o){let t=!1;if(!0===e.stack){if(!1===f.start&&!1===f.end)continue;t=!0}0!==s&&1!==s&&2!==s||(t=!0),4===s&&f.value>0&&(t=!0),5===s&&f.value<0&&(t=!0),!0===t&&(s=3,m=!0)}if(0===s&&(v=d.y+f.lengthPixel+f.lengthSize/2),f.value>0){if(1===s&&(v=d.y+f.lengthPixel+f.lengthSize-e.label.textGap,b=h),2===s&&(v=d.y+f.lengthPixel+e.label.textGap,b=a),3===s&&(v=d.y+f.lengthPixel-e.label.textGap,b=h,y=l,v<d.y+c)){if(!0===m)continue;v=d.y+f.lengthPixel+e.label.textGap,b=a,y=n}5===s&&(v=d.y+f.lengthPixel+f.lengthSize+e.label.textGap,b=a,y=l)}if(f.value<0){if(1===s&&(v=d.y+f.lengthPixel+e.label.textGap,b=a),2===s&&(v=d.y+f.lengthPixel+f.lengthSize-e.label.textGap,b=h),3===s&&(v=d.y+f.lengthPixel+f.lengthSize+e.label.textGap,b=a,y=l,v>d.y+d.height-c)){if(!0===m)continue;v=d.y+f.lengthPixel+f.lengthSize-e.label.textGap,b=h,y=n}4===s&&(v=d.y+f.lengthPixel-e.label.textGap,b=h,y=l)}const w=e.label.formatTextCallback(f.value,f.item,f.seriesIndex);let k="";0===s&&(k='data-label="'+p.toString()+'" '),i.push("<text "+k+'class="label-text '+y+'" x="'+g.toString()+'" y="'+v.toString()+'" dominant-baseline="'+b+'" text-anchor="'+x+'">'+w+"</text>")}}}class h{yt(t,i,e){const s=t.options,r=t.innerArea,h=t.valueAxisArea,a=t.categoryAxisArea,n=t.dataArea;r.x=s.padding,r.y=s.padding,r.width=i-2*s.padding,r.height=e-2*s.padding,!0===s.valueAxis.show&&!1===s.categoryAxis.show&&(h.x=r.x,h.y=r.y+r.height-s.valueAxis.size,h.width=r.width,h.height=s.valueAxis.size,n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height-s.valueAxis.size,a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height),!0===s.valueAxis.show&&!0===s.categoryAxis.show&&(!1===s.categoryAxis.switch&&(h.x=r.x+s.categoryAxis.size,h.y=r.y+r.height-s.valueAxis.size,h.width=r.width-s.categoryAxis.size,h.height=s.valueAxis.size,a.x=r.x,a.y=r.y,a.width=s.categoryAxis.size,a.height=r.height-s.valueAxis.size,n.x=r.x+s.categoryAxis.size,n.y=r.y,n.width=r.width-s.categoryAxis.size,n.height=r.height-s.valueAxis.size),!0===s.categoryAxis.switch&&(h.x=r.x,h.y=r.y+r.height-s.valueAxis.size,h.width=r.width-s.categoryAxis.size,h.height=s.valueAxis.size,a.x=r.x+r.width-s.categoryAxis.size,a.y=r.y,a.width=s.categoryAxis.size,a.height=r.height-s.valueAxis.size,n.x=r.x,n.y=r.y,n.width=r.width-s.categoryAxis.size,n.height=r.height-s.valueAxis.size)),!0===s.categoryAxis.show&&!1===s.valueAxis.show&&(!1===s.categoryAxis.switch&&(a.x=r.x,a.y=r.y,a.width=s.categoryAxis.size,a.height=r.height,n.x=r.x+s.categoryAxis.size,n.y=r.y,n.width=r.width-s.categoryAxis.size,n.height=r.height),!0===s.categoryAxis.switch&&(a.x=r.x+r.width-s.categoryAxis.size,a.y=r.y,a.width=s.categoryAxis.size,a.height=r.height,n.x=r.x,n.y=r.y,n.width=r.width-s.categoryAxis.size,n.height=r.height),h.x=n.x,h.y=n.y,h.width=n.width,h.height=n.height),!1===s.valueAxis.show&&!1===s.categoryAxis.show&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height,h.x=n.x,h.y=n.y,h.width=n.width,h.height=n.height,a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height);const l=Math.floor(a.height/t.dataList.length)*t.dataList.length;a.y+=a.height-l,a.height=l,n.y=a.y,n.height=l}createChartSvg(t,i,e){if(this.yt(t,i,e),t.createSegmentList(t.valueAxisArea.width),!0===t.checkBaseLine()&&t.createSegmentList(t.h.width),t.segmentList.forEach((i=>{i.pixel=t.valueAxisArea.width-i.pixel})),t.createCategoryList(t.categoryAxisArea.height),!1===t.hasData())return;t.createBarList(),t.createLineList();const s=[];this.wt(t,s),this.kt(t,s),this._t(t,s),this.Lt(t,s),this.zt(t,s),this.It(t,s),this.Mt(t,s),this.St(t,s);return s.join("")}_t(t,i){const e=t.options;if(!1===e.valueAxis.show)return;const s=t.valueAxisArea;if(!0===e.valueAxis.showLine){let t=s.x,e=s.x+s.width,r=s.y;i.push('<line class="value-axis-line" x1="'+t.toString()+'" y1="'+r.toString()+'" x2="'+e.toString()+'" y2="'+r.toString()+'"></line>')}let r=s.y;e.valueAxis.showNub&&(r+=e.valueAxis.nubSize),r+=e.valueAxis.textGap,!0===e.valueAxis.rotateText&&(r=s.y+e.valueAxis.textGap,e.valueAxis.showNub&&(r+=e.valueAxis.nubSize));let h=s.y,a=s.y+e.valueAxis.nubSize;t.segmentList.forEach((t=>{const n=s.x+t.pixel;let l=!0;0===t.value&&!1===e.valueAxis.showZero&&(l=!1),!1===e.valueAxis.showText&&(l=!1),!0===l&&(!0===e.valueAxis.rotateText&&i.push('<text class="value-axis-text" x="'+n.toString()+'" y="'+r.toString()+'" dominant-baseline="middle" text-anchor="end" transform="rotate(-90,'+n.toString()+","+r.toString()+')">'+t.valueText+"</text>"),!1===e.valueAxis.rotateText&&i.push('<text class="value-axis-text" x="'+n.toString()+'" y="'+r.toString()+'" dominant-baseline="hanging" text-anchor="middle">'+t.valueText+"</text>")),!0===e.valueAxis.showNub&&i.push('<line class="value-axis-nub" x1="'+n.toString()+'" y1="'+h.toString()+'" x2="'+n.toString()+'" y2="'+a.toString()+'"></line>')}))}wt(t,i){if(!1===t.options.guideLine.showValueAxis)return;const e=t.dataArea,s=t.valueAxisArea;let r=e.y,h=e.y+e.height;t.segmentList.forEach((t=>{const e=s.x+t.pixel;i.push('<line class="guide-line-value-axis" x1="'+e.toString()+'" y1="'+r.toString()+'" x2="'+e.toString()+'" y2="'+h.toString()+'"></line>')}))}It(t,i){let e=null;for(let i=0;i<t.segmentList.length;i++){const s=t.segmentList[i];if(0===s.value){e=s;break}}if(!e)return;const s=t.dataArea;let r=s.y,h=s.y+s.height;const a=s.x+e.pixel;i.push('<line class="guide-line-zero" x1="'+a.toString()+'" y1="'+r.toString()+'" x2="'+a.toString()+'" y2="'+h.toString()+'"></line>')}Lt(t,i){const e=t.options;if(!1===e.categoryAxis.show)return;const s=t.categoryAxisArea;if(!0===e.categoryAxis.showLine){let t=s.x+s.width,r=s.y,h=s.y+s.heig