realchart 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gauge.js +2 -2
- package/gauge.mjs +2 -2
- package/heatmap.js +1 -1
- package/heatmap.mjs +1 -1
- package/ie/gauge.ie.js +7 -0
- package/ie/heatmap.ie.js +7 -0
- package/ie/index.ie.js +7 -0
- package/ie/pictogram.ie.js +7 -0
- package/ie/realchart-style.ie.css +2306 -0
- package/ie/split.ie.js +7 -0
- package/ie/treemap.ie.js +7 -0
- package/ie/vector.ie.js +7 -0
- package/ie/wordcloud.ie.js +7 -0
- package/index.d.ts +223 -106
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +4 -13
- package/pictogram.js +2 -2
- package/pictogram.mjs +2 -2
- package/realchart-style.css +41 -40
- package/split.d.ts +1 -2
- package/split.js +2 -2
- package/split.mjs +2 -2
- package/treemap.js +1 -1
- package/treemap.mjs +1 -1
- package/vector.js +1 -1
- package/vector.mjs +1 -1
- package/wordcloud.js +2 -2
- package/wordcloud.mjs +2 -2
package/split.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealChart Split v1.4.
|
|
3
|
+
* RealChart Split v1.4.8
|
|
4
4
|
* Copyright (C) 2023-2025 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartSplit={},t.RealChart)}(this,(function(t,e){"use strict";function s(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var i=s(e);class r{constructor(t,e){this.row=t,this.col=e,this._axes=[]}sort(t,e){const s=e&&!t||!e&&t;this._axes.length>1&&(s?this._axes.sort(((t,e)=>{const s=t._posValue(),i=e._posValue();return s===i?s<0?e._index-t._index:s>0?t._index-e._index:t.row!==e.row?e.row-t.row:t.row<this.row?e._index-t._index:t._index-e._index:i-s})):this._axes.sort(((t,e)=>{const s=t._posValue(),i=e._posValue();return s===i?s<0?t._index-e._index:s>0?e._index-t._index:t.col!==e.col?t.col-t.col:t.col<this.col?t._index-e._index:e._index-t._index:s-i})))}}class n{constructor(t,e){this.chart=t,this.isX=e}rows(){return this._matrix.length}cols(){return this._matrix[0].length}_prepare(t,e,s,i){this._doPrepare(t,e,s),this._matrix.forEach((t=>{t.forEach((t=>t.sort(this.isX,i)))}))}get(t,e){return this._matrix[t][e]}getRow(t){return this._matrix[t]}getColumn(t){return this._matrix.map((e=>e[t]))}_buildTicks(t,e){const s=this.isX;this._matrix.forEach(((i,r)=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{!i.isBased()&&(e<2||s)&&i._buildTicks(t[s?i.options.col:i.options.row],e)}))}))})),this._matrix.forEach(((i,r)=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{i.isBased()&&(e<2||s)&&i._buildTicks(t[s?i.options.col:i.options.row],e)}))}))}))}_calcPoints(t,e){const s=this.isX;this._matrix.forEach((i=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{if(e<2||s){const r=s?i.options.col:i.options.row;i._calcPoints(t[r],e)}}))}))}))}}class o extends n{constructor(t){super(t,!0)}_doPrepare(t,e,s){const i=this._matrix=new Array(e+1);for(let t=0;t<i.length;t++){i[t]=[];for(let e=0;e<s;e++)i[t].push(new r(t,e))}t.forEach((t=>{var s,r;const n=t.options.position;let o=t.row;"opposite"===n?(o++,t._runPos=n):o<e-1&&"between"===n?(o++,t._runPos="normal"):t._runPos=n,null===(r=null===(s=i[o])||void 0===s?void 0:s[t.col])||void 0===r||r._axes.push(t)}))}}class h extends n{constructor(t){super(t,!1)}_doPrepare(t,e,s){const i=this._matrix=new Array(e);for(let t=0;t<i.length;t++){i[t]=[];for(let e=0;e<=s;e++)i[t].push(new r(t,e))}t.forEach((t=>{var e,r;const n=t.options.position;let o=t.col;"opposite"===n?(o++,t._runPos=n):t.col<s-1&&"between"===n?(o++,t._runPos="normal"):t._runPos=n,null===(r=null===(e=i[t.row])||void 0===e?void 0:e[o])||void 0===r||r._axes.push(t)}))}}class a extends e.Body{constructor(t){super(t.chart),this.pane=t}contains(t){return t.col===this.pane.col||t.row===this.pane.row}}a.defaults=e.extend(e.Body.defaults,{extended:!0,radius:void 0,centerX:void 0,centerY:void 0});class l extends e.Legend{constructor(t){super(t.chart),this.pane=t}_doPrepareRender(t){super._doPrepareRender(t),this._location="body"}_getLegendSources(){return this.options.visible?this.chart._getSeries().getLegendSources(this.pane.row,this.pane.col):[]}}class d extends e.ChartItem{constructor(t,e,s){super(t),this.row=e,this.col=s}_doInit(t){t.body=(this._body=new a(this)).init(),t.legend=(this._legend=new l(this)).init()}get body(){return this._body}get legend(){return this._legend}_prepareRender(){this._body._prepareRender(),this._legend._prepareRender()}}class c extends e.ChartItem{constructor(t){super(t),this._cols=1,this._rows=1,this._paneDic={},this._panes=[],this._xAxes=new o(t),this._yAxes=new h(t)}get count(){return this._rows*this._cols}get rowCount(){return this._rows}get colCount(){return this._cols}get paneCount(){return this._rows*this._cols}colSizes(){return this._colSizes}rowSizes(){return this._rowSizes}getPane(t,e){return this._panes[t][e]}getRow(t){return this._panes[t]}getColumn(t){return this._panes.map((e=>e[t]))}getAxisOf(t,e){var s,i;const r=this.chart,n=t.body;if(n){const o=n.pane;return e?r._getXAxes().get(t.options.xAxis)||this._xAxes.get(o.row,o.col)._axes[0]||(null===(s=r._getSeries().getPaneSeries(o.row,o.col)[0])||void 0===s?void 0:s._xAxisObj):r._getXAxes().get(t.options.yAxis)||this._yAxes.get(n.pane.row,n.pane.col)._axes[0]||(null===(i=r._getSeries().getPaneSeries(o.row,o.col)[0])||void 0===i?void 0:i._yAxisObj)}}isValidAxis(t){return t&&t.row<this._rows&&t.col<this._cols}_doLoadProp(t,e){return["panes","cols","rows"].indexOf(t)>=0||super._doLoadProp(t,e)}_doSetSimple(t){if(e.isArray(t)&&t.length>0){const s=e.maxv(1,+t[0]),i=e.maxv(1,e.pickNum(+t[1],s));return s>0&&i>0&&(this.$_parsePanes(s,i),this.visible=!0),!0}return super._doSetSimple(t)}_load(t){return super._load(t),e.isObject(t)&&(this.$_parsePanes(t.rows,t.cols),this._paneDic=this.$_loadPanes(t.panes)),this}_doPrepareRender(t){this._panes=this.$_collectPanes(t),this._panes.forEach((t=>t.forEach((t=>t._prepareRender()))))}_calcSizes(t,s){const i=t.length,r=new Array(i);let n=0;if(i>1){let o=s,h=0;for(n=0;n<i;n++){const s=t[n];e.isNumber(s)?o-=r[n]=Math.max(0,Math.min(o,s)):h+=s.size}if(h>0)for(n=0;n<i;n++){const s=t[n];e.isNumber(s)||(r[n]=o*s.size/h)}}else r[n]=s;return r}getXLens(t){return this._calcSizes(this._colSizes,t)}getYLens(t){return this._calcSizes(this._rowSizes,t)}measureAxes(t,e,s,i){const r=this.getXLens(s?e:t),n=this.getYLens(s?t:e);this._xAxes._buildTicks(r,i),this._yAxes._buildTicks(n,i),this.$_calcAxesPoints(r,n,i)}$_calcAxesPoints(t,e,s){this._xAxes._calcPoints(t,s),this._yAxes._calcPoints(e,s)}completeAxesPoints(t,e){this.$_calcAxesPoints(t,e,101)}getBodyAnnotation(t){for(const e in this._paneDic){const s=this._paneDic[e].body.getAnnotation(t);if(s)return s}}prepareRender(t,e){const s=this.chart.isInverted();this._prepareRender(),this._xAxes._prepare(t,this._rows,this._cols,s),this._yAxes._prepare(e,this._rows,this._cols,s)}$_parseSizes(t){let s;return s=e.isArray(t)&&t.length>0?t.slice(0):t>0?new Array(t).fill("*"):["*"],s.map((t=>{if(e.isString(t)){const s=t.trim();return{size:"*"===s?1:e.pickNum(parseFloat(s),1)}}return e.pickNum(+t,1)}))}$_parsePanes(t,e){this._colSizes=this.$_parseSizes(e),this._rowSizes=this.$_parseSizes(t),this._cols=this._colSizes.length,this._rows=this._rowSizes.length}$_loadPanes(t){const s=this.chart,i=this._op.extendBody?s._body._config:void 0,r={};if(t=e.isArray(t)?t:e.isObject(t)?[t]:null,e.isArray(t)&&t.forEach((t=>{const e=+t.row||0,n=+t.col||0;if(n>=0&&n<this._cols&&e>=0&&e<this._rows){const o=new d(s,e,n);let h=t;o.init(),!i||t&&t.body&&!1===t.body.extended||(t?(h=Object.assign({},t),t.body?!1!==t.body.extended&&(h.body=Object.assign({},i,t.body)):h.body=i):h={body:i}),o._load(h),r[e+","+n]=o}})),i)for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const n=t+","+e;if(!r[n]){const o=new d(s,t,e);o.init(),o._load({body:i}),r[n]=o}}return r}$_collectPanes(t){const e=[];for(let s=0;s<this._rows;s++){const i=[];for(let e=0;e<this._cols;e++){const r=this._paneDic[s+","+e]||new d(t,s,e)._initObject();i.push(r)}e.push(i)}return e}}c.defaults=e.extend(e.ChartItem.defaults,{visible:!1,extendBody:!0,gap:0});const _="http://www.w3.org/2000/svg",u=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},p=Array.isArray,g=function(t){return"string"==typeof t},m=Object.assign,f=Math.min,y=Math.max,w=Math.abs,v=function(t,e){return t=parseFloat(t),isNaN(t)?parseFloat(e):t};let b=0;class x{static destroy(t){return t&&t.destroy()}constructor(t){this.$_destroyed=!1,this.$_destroying=!1,t||(this.$_hash=String(b++))}destroy(){return this.$_destroyed||this.$_destroying||(this.$_destroying=!0,this._doDestroy(),this.$_destroyed=!0),null}_doDestroy(){}get destroying(){return this.$_destroying}get orphaned(){return this.$_destroying||this.$_destroyed}get hash(){return this.$_hash}isMe(t){return t===this.$_hash}toString(){return this.constructor.name}toBool(t){return"string"==typeof t?"true"===t:t}toNum(t,e=NaN){return t=parseFloat(t),isNaN(t)?e:t}}class A extends x{constructor(t,e,s,i=0){super(),this.removeDelay=0,this._pool=[],this._views=[],this._removes=[],this._owner=t,this._creator=e,this._styleName=s,this.removeDelay=i}_doDestroy(){this.freeAll(),this._owner=null,this._creator=null,super._doDestroy()}get isEmpty(){return 0===this._views.length}get count(){return this._views.length}get first(){return this._views[0]}get last(){return this._views[this._views.length-1]}get(t){return this._views[t]}getAll(){return this._views.slice()}pull(t){let e=this._views[t];return e||(e=this._pool.pop()||new this._creator(this._owner.doc,this._styleName),this._owner.add(e),this._views.push(e)),e}_internalItems(){return this._views}elementOf(t){for(let e of this._views)if(e.contains(t))return e}find(t){return this._views.find(t)}setRemoveDelay(t){return this.removeDelay=t,this}removeLater(t,e){const s=this._views.indexOf(t);s>=0&&(t.removeLater(e,(t=>{this._pool.push(t)})),this._views.splice(s,1))}$_create(t,e=-1,s=0){let i=this._pool.pop();return i||(i=new this._creator(t,this._styleName)),i}prepare(t,e,s){const i=this._owner.doc,r=this._owner,n=this._pool,o=this._views;for(;o.length>t;)n.push(o.pop().remove());for(;o.length<t;){const e=this.$_create(i);o.push(e),null==s||s(e,o.length-1,t),r.add(e)}return e&&this.forEach(e),this}borrow(){const t=this._pool.pop()||new this._creator(this._owner.doc,this._styleName);return this._owner.add(t),t}free(t,e=0){if(t){e>0?t.removeLater(e):t.remove(),this._pool.push(t);const s=this._views.indexOf(t);s>=0&&this._views.splice(s,1)}}freeAll(t,e=0){for(let s=(t=t||this._views).length-1;s>=0;s--)this.free(t[s],e)}freeHiddens(){const t=this._views;for(let e=t.length-1;e>=0;e--)!t[e].visible&&this.free(t[e],0)}freeFrom(t){const e=this._views;for(let s=e.length-1;s>=t;s--)this.free(e[s],0)}forEach(t){const e=this._views;for(let s=0,i=e.length;s<i;s++)t(e[s],s,i)}visit(t){const e=this._views.length;let s=0;for(;s<e&&!1!==t(this._views[s],s,e);s++);return s===e}sort(t){const e=this._views;return e.sort(t),e.forEach((t=>this._owner.appendDom(t.dom))),this}sortDom(t){const e=this._views.slice(0);return e.sort(t),e.forEach((t=>this._owner.appendDom(t.dom))),this}map(t){return this._views.map(t)}front(t){t.front(this._views)}back(t){t.back(this._views)}}const E=Object.freeze({x:0,y:0,width:0,height:0});const S={ko:{dateFormat:"yyyy.MM.dd",am:"오전",pm:"오후",notExistsDataField:"존재하지 않는 필드입니다: %1",notSpecifiedDataField:"하나 이상의 데이터필드가 설정돼야 합니다.",invalidFieldName:"잘못된 데이터필드 이름입니다: %1",invalidRowIndex:"잘못된 데이터행 index입니다: %1",invalidToIndex:"잘못된 'to' index입니다.: %1",requireSourceData:"원본 data가 반드시 지정돼야 합니다.",requireFilterName:"필터 이름이 반드시 지정돼야 합니다.",invalidDateFormat:"잘못된 시간 날짜 형식입니다: %1",invalidSizeValue:"잘못된 Size 값입니다: %1",invalidOuterDiv:"잘못된 외부 div 입니다: %1",dataMustSet:"데이터가 먼저 설정돼야 합니다.",requireTableName:"테이블모델의 이름이 지정돼야 합니다.",alreadyTableExists:"이미 존재하는 테이블모델입니다: %1"},en:{dateFormat:"M/d/yyyy",am:"AM",pm:"PM",notExistsDataField:"A data field is not exists: %1",notSpecifiedDataField:"At least one datafield must be set.",invalidFieldName:"Invalid field name: %1",invalidRowIndex:"Invalid row index: %1",invalidToIndex:"Invalid 'to' index: %1",requireSourceData:"A source data must be set.",requireFilterName:"A filter name must be set.",invalidDateFormat:"Invalid datetime format: %1",invalidSizeValue:"Invalid size value: %1",invalidOuterDiv:"Invalid outer div element: %1",dataMustSet:"A data must be set first.",requireTableName:"The name of table model is required.",alreadyTableExists:"A table model is already exists: %1"}};let C="ko",N=S[C]||S[C="ko"];const k=void 0;function D(t){return t+"px"}function L(t){return null==t||Number.isNaN(t)||""===t}const T={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",fontStyle:"font-style",padding:"padding",margin:"margin"},B=function(t){const e=T[t];if(!e){let e=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return T[t]=e,e}return e};class M{static clearChildren(t){let e;for(;e=t.lastChild;)t.removeChild(e)}static remove(t){const e=t&&t.parentElement;return e&&e.removeChild(t),null}static htmlEncode(t){return document.createElement("a").appendChild(document.createTextNode(t)).parentNode.innerHTML}static setAttrs(t,e){for(const s in e)t.setAttribute(s,e[s])}static setImportantStyle(t,e,s){t.setProperty(e,s,"important")}static getPadding(t){const e=getComputedStyle(t);return{left:parseFloat(e.paddingLeft)||0,right:parseFloat(e.paddingRight)||0,top:parseFloat(e.paddingTop)||0,bottom:parseFloat(e.paddingBottom)||0}}static hasFill(t){const e=window.getComputedStyle(t).fill;return e&&"none"!==e}static setVisible(t,e,s=""){return t.style.display=e?s:"none",e}static setClipPath(t,e){t.setAttribute("clip-path",`url(#${e instanceof SVGClipPathElement?e.id:e})`)}static createClipRect(t,e){const s=t.createElementNS(_,"clipPath");return s.id=e,s.append(t.createElementNS(_,"rect")),s}static setRect(t,e){return this.setBounds(t,e.x,e.y,e.width,e.height)}static setBounds(t,e,s,i,r){return t.setAttribute("x",e),t.setAttribute("y",s),t.setAttribute("width",i),t.setAttribute("height",r),t}}const $=(new Date).getTime();"undefined"==typeof window||Element.prototype.animate||(Element.prototype.animate=function(t){});class R{static log(...t){this.LOGGING&&console.log(...t)}static warn(...t){this.LOGGING&&console.warn(...t)}static now(){return+new Date}static parseDate(t,e){const s=new Date(t);return isNaN(s.getTime())?e||new Date:s}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static dateOfYear(t){var e=t.getMonth(),s=t.getDate(),i=[0,31,59,90,120,151,181,212,243,273,304,334][e]+s;return e>1&&R.isLeapYear(t.getFullYear())&&i++,i}static incMonth(t,e){const s=t.getDate();return t.setDate(1),t.setMonth(t.getMonth()+e),t.setDate(f(s,R.month_days[R.isLeapYear(t.getFullYear())?1:0][t.getMonth()])),t}static minDate(t,e){return null!==t?t:null!==e?e:t.getTime()<e.getTime()?t:e}static maxDate(t,e){return null!==t?e:null!==e||t.getTime()>e.getTime()?t:e}static weekOfMonth(t,e,s){const i=t.getMonth(),r=t.getFullYear(),n=new Date(r,i,1).getDay(),o=new Date(r,i+1,0).getDate(),h=t.getDate()+n-1,a=e+Math.ceil((o+n-7)/7),l=e+Math.floor(h/7);return s||l<2+e?l:l===a?e+5:l}static weekOfYear(t,e){const s=t.getFullYear(),i=new Date(s,0,1).getDay(),r=this.dateOfYear(t)+i-1;return e+Math.floor(r/7)}static isObject(t){return t&&"object"==typeof t&&!p(t)}static isValidObject(t){if(this.isObject(t))for(let e in t)if(t.hasOwnProperty(e))return!0}static copyObject(t){if(t&&"object"==typeof t&&!p(t))return m({},t)}static checkArray(t){return p(t)?t:void 0}static makeArray(t,e=!1){return null!=t?p(t)?t:[t]:e?[]:void 0}static makeNumArray(t){return p(t)?t.map((t=>+t)):null!=t?[+t]:[]}static getIntArray(t,e=0){const s=[];for(let i=e,r=e+t;i<r;i++)s.push(i);return s}static isValueArray(t){if(p(t)){for(let e=t.length-1;e>=0;e--)if(null!=t[e]&&"object"==typeof t[e])return!1;return!0}return!1}static toArray(t){return p(t)?t:null!=t?[t]:null}static copyArray(t){return p(t)?t.slice(0):null!=t?[t]:void 0}static push(t,e){if(e&&e.length>0)for(let s=0,i=e.length;s<i;s++)t.push(e[s])}static isDefined(t){return null!=t}static isNotDefined(t){return null==t}static isNumber(t){return"number"==typeof t}static canNumber(t){return!isNaN(t)&&!isNaN(parseFloat(t))}static isValidNum(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}static getNumber(t,e=0){const s=parseFloat(t);return isFinite(s)?s:e}static toNumber(t,e=0){return isNaN(t)||null===t||""===t?e:+t}static compareText(t,e,s=!1){return t=t||"",e=e||"",s&&(t=t.toLocaleLowerCase(),e=e.toLocaleLowerCase()),t>e?1:t<e?-1:0}static getTimeF(){return(new Date).getTime()/1e3}static getTimer(){return(new Date).getTime()-$}static isWhiteSpace(t){return!t||!t.trim()}static pad(t,e,s){return e=y(e||2,1),s=s||"0",new Array(e-String(t).length+1).join(s)+t}static pad16(t,e,s){return e=y(e||2,1),s=s||"0",new Array(e-t.toString(16).length+1).join(s)+t.toString(16)}static pick(...t){const e=t.length;let s;for(let i=0;i<e;i++)if(s=t[i],null!=s)return s}static toStr(t){return Number.isNaN(t)||null==t?"":String(t)}static equalNumbers(t,e){return isNaN(t)==isNaN(e)&&!isNaN(t)&&t==e}static equalArrays(t,e){if(t===e)return!0;if(null==t||null==e)return!1;const s=t.length;if(s!=e.length)return!1;for(let i=0;i<s;++i)if(t[i]!==e[i])return!1;return!0}static parseTuples(t){if(p(t)){const e=[];let s=-1/0;return t.forEach(((i,r)=>{p(i)?!isNaN(i[0])&&!isNaN(i[1])&&i[0]>s&&(e.push([+i[0],+i[1]]),s=i[0]):isNaN(i)||r!==t.length-1||e.push([1/0,+i])})),e.length>0?e:void 0}if(!isNaN(t))return[[1/0,+t]]}static isEmpty(t){if(t)for(let e in t)return!1;return!0}static isNotEmpty(t){if(t)for(let e in t)return!0;return!1}static setter(t){return"set"+t[0].toUpperCase()+t.slice(1)}static deepClone(t){if(t instanceof Date)return new Date(t);if(null==t||"object"!=typeof t)return t;{const e=p(t)?[]:{};for(let s of Object.keys(t))e[s]=R.deepClone(t[s]);return e}}static getArray(t,e){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static getNumArray(t,e=0){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static dedupe(t,e){for(let s=(t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0))).length-1;s>0;s--)t[s]===t[s-1]&&t.splice(s,1);return t}static sortNum(t){return t.sort(((t,e)=>t-e))}static logElapsed(t,e){const s=+new Date;e(),R.log(t,+new Date-s+"ms")}static clamp(t,e,s){return y(e,f(s,t))}static makeIntArray(t,e){const s=new Array(y(0,e-t));for(let i=t;i<e;i++)s[i-t]=i;return s}static shuffle(t){for(let e=t.length;e;){const s=Math.floor(Math.random()*e),i=t[--e];t[e]=t[s],t[s]=i}return t}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static isValidDate(t){return t.getTime()==t.getTime()}static asFunction(t){return"function"==typeof t?t:void 0}static getFieldProp(t){const e=t.indexOf(".");if(e>=0)return{field:t.substring(0,e),props:t.substring(e+1).split(".")}}static startsWith(t,e){if(t&&e)return 0===t.indexOf(e)}static endsWith(t,e){if(t&&e)return t.indexOf(e,-t.length)===t.length-e.length}static scaleNumber(t,e,s){const i=w(t);if(i>=1e3){let r=e.length;for(;r>0;){const n=Math.pow(1e3,r--);if(n<=Math.pow(10,Math.log(i)*Math.LOG10E)&&(s||10*i%n==0))return{value:t/n,symbol:e[r]}}}}static jitter(t,e){return t+(2*Math.random()-1)*e}static randomLike(t){return(2654435761*(123456789^t)>>>16)/65536}}var P;R.LOGGING=!1,R.week_days=["일","월","화","수","목","금","토"],R.long_week_days=["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],R.month_days=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]],R.uniqueKey=function(){let t=Math.random().toString(36).substring(2,9)+"-",e=0;return function(){return"rr-chart-"+t+e++}}(),function(t){t.Developer="developer",t.Evaluation="evaluation",t.Limited="limited",t.Enterprise="enterprise"}(P||(P={}));const z="$ProductVersion";class O extends x{constructor(t,e,s){super(),this._inited=!1,this._testing=!1,this._dirty=!0,this._toAnimation=0,this._invalidateLock=!1,this._lockDirty=!1,this._cssVars={},this._wSave=NaN,this._hSave=NaN,this.loaded=!1,this._windowResizeHandler=t=>{this._domResized()},this._domResizeHandler=t=>{this._domResized()},this._clickHandler=t=>{this._pointerHandler&&this._pointerHandler.handleClick(this.toOffset(t))},this._dblClickHandler=t=>{this._pointerHandler&&this._pointerHandler.handleDblClick(this.toOffset(t))},this._touchMoveHandler=t=>{},this._pointerDownHandler=t=>{this._pointerHandler&&this._pointerHandler.handleDown(this.toOffset(t))},this._pointerMoveHandler=t=>{this._pointerHandler&&this._pointerHandler.handleMove(this.toOffset(t))},this._pointerUpHandler=t=>{this._pointerHandler&&this._pointerHandler.handleUp(this.toOffset(t))},this._pointerCancelHandler=t=>{},this._pointerLeaveHandler=t=>{this._pointerHandler&&this._pointerHandler.handleLeave(this.toOffset(t))},this._keyPressHandler=t=>{},this._wheelHandler=t=>{},!t&&e instanceof HTMLDivElement&&(t=e.ownerDocument),this._initControl(t||document,e,s||O.CLASS_NAME),"undefined"!=typeof window&&window.ResizeObserver&&(this._resizeObserver=new ResizeObserver(this._domResizeHandler)),this._resigterEventHandlers(this._dom),this._inited=!0,this.invalidate(!0)}_doDestroy(){this._requestTimer&&(window.requestAnimationFrame?cancelAnimationFrame(this._requestTimer):clearTimeout(this._requestTimer)),this._unresigterEventHandlers(this._dom),M.remove(this._dom),this._dom=null,this._container=null}isInited(){return this._inited}isTesting(){return this._testing}doc(){return this._dom.ownerDocument}dom(){return this._dom}svg(){return this._svg}width(){return this._container.offsetWidth}height(){return this._container.offsetHeight}contentWidth(){return this.width()-this._padding.left-this._padding.right}contentHeight(){return this.height()-this._padding.top-this._padding.bottom}contentRight(){return this.width()-this._padding.right}clipContainer(){return this._defs}setData(t,e,s){L(e)?(this._root.dom.removeAttribute("data-"+t),s&&this._dom.removeAttribute("data-"+t)):(this._root.dom.setAttribute("data-"+t,e),s&&this._dom.setAttribute("data-"+t,e))}clearDefs(){M.clearChildren(this._defs)}$_clearDefs(t){const e=this._defs.children||[];for(let s=e.length-1;s>=0;s--)e[s].hasAttribute(t)&&e[s].remove()}clearAssetDefs(){this.$_clearDefs(H.ASSET_KEY)}clearTemporaryDefs(){this.$_clearDefs(H.TEMP_KEY)}appendDom(t){return t&&this._htmlRoot.append(t),t}addElement(t){return t&&this._root.add(t)}setPointerHandler(t){this._pointerHandler=t}invalidate(t=!1){t||!this._invalidateLock&&!this._dirty&&this._inited?(this._dirty=!0,this._requestTimer||this._testing||this.$_requestRender()):this._invalidateLock&&(this._lockDirty=!0)}invalidateLayout(t=!1){this.invalidate(t)}setLock(){this._invalidateLock=!0}releaseLock(t=!0){this._invalidateLock&&(this._invalidateLock=!1),this._lockDirty&&t&&this.invalidate(),this._lockDirty=!1}lock(t){this.setLock();try{t(this)}finally{this.releaseLock()}}silentLock(t){this.setLock();try{t(this)}finally{this.releaseLock(!1)}}setResizeDelay(t){this._resizeDelay=t}getBounds(){return this._bounds}setAnimation(t){this._toAnimation=t||0}fling(t,e){}getCssVar(t){let e=this._cssVars[t];return t in this._cssVars?this._cssVars[t]:(e=getComputedStyle(this._root.dom).getPropertyValue(t),this._cssVars[t]=e,e)}clipBounds(t=NaN,e=NaN,s=NaN,i=NaN,r=0){const n=new F(this.doc(),t,e,s,i,r,r);return this._defs.appendChild(n.dom),n}clipCircle(){const t=new G(this.doc());return this._defs.appendChild(t.dom),t}addDef(t){this._defs.appendChild(t)}removeDef(t){if(g(t))for(const e in this._defs.children)if(e instanceof Element&&e.id===t){t=e;break}t instanceof Element&&this._defs.removeChild(t)}containerToElement(t,e,s){const i=this._container.getBoundingClientRect(),r=t.getBounds();return{x:e-r.x+i.x,y:s-r.y+i.y}}svgToElement(t,e,s){const i=this._svg.getBoundingClientRect(),r=t.getBounds();return{x:e-r.left+i.left,y:s-r.top+i.top}}elementToSvg(t,e,s){const i=this._svg.getBoundingClientRect(),r=t.getBounds();return{x:e+r.left-i.left,y:s+r.top-i.top}}_setTesting(){this._testing=!0,H.TESTING=!0}_setSize(t,e){isNaN(t)||(this._container.style.width=t+"px"),isNaN(e)||(this._container.style.height=e+"px")}$_addListener(t,e,s,i){i?t.addEventListener(e,s,{passive:!0}):t.addEventListener(e,s)}_resigterEventHandlers(t){var e;window.addEventListener("resize",this._windowResizeHandler),null===(e=this._resizeObserver)||void 0===e||e.observe(t),this.$_addListener(t,"click",this._clickHandler),this.$_addListener(t,"dblclick",this._dblClickHandler),this.$_addListener(t,"touchmove",this._touchMoveHandler,!0),this.$_addListener(t,"pointerdown",this._pointerDownHandler),this.$_addListener(t,"pointermove",this._pointerMoveHandler),this.$_addListener(t,"pointerup",this._pointerUpHandler),this.$_addListener(t,"pointercancel",this._pointerCancelHandler),this.$_addListener(t,"pointerleave",this._pointerLeaveHandler),this.$_addListener(t,"keypress",this._keyPressHandler),this.$_addListener(t,"wheel",this._wheelHandler,!0)}_unresigterEventHandlers(t){var e,s;window.removeEventListener("resize",this._windowResizeHandler),null===(e=this._resizeObserver)||void 0===e||e.unobserve(t),null===(s=this._resizeObserver)||void 0===s||s.disconnect(),t.removeEventListener("click",this._clickHandler),t.removeEventListener("dblclick",this._dblClickHandler),t.removeEventListener("touchmove",this._touchMoveHandler),t.removeEventListener("pointerdown",this._pointerDownHandler),t.removeEventListener("pointermove",this._pointerMoveHandler),t.removeEventListener("pointerup",this._pointerUpHandler),t.removeEventListener("pointercancel",this._pointerCancelHandler),t.removeEventListener("pointerleave",this._pointerLeaveHandler),t.removeEventListener("keypress",this._keyPressHandler),t.removeEventListener("wheel",this._wheelHandler)}_prepareRenderers(t){}_initControl(t,e,s){if(this._inited)return;e instanceof HTMLDivElement?this._container=e:this._container=t.getElementById(e),this._container instanceof HTMLDivElement||((t,e)=>{throw new Error(((t,e)=>t.replace("%1",e))(t,e))})(N.invalidOuterDiv,e);const i=this._container.ownerDocument,r=this._dom=i.createElement("div");m(r.style,{position:"relative",width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden","-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0, 0, 0, 0)"}),r.className=s,this._container.appendChild(r);const n=this._svg=i.createElementNS(_,"svg");n.classList.add("rct-svg"),n.style.setProperty("overflow","visible","important"),n.setAttribute("width","100%"),n.setAttribute("height","100%");const o=i.createElement("desc");o.textContent="Created by RealChart v"+z,n.appendChild(o);const h=this._defs=i.createElementNS(_,"defs");this._initDefs(i,h),n.appendChild(h),r.appendChild(n),this._root=new V(this),n.appendChild(this._root._dom),this._htmlRoot=i.createElement("div"),r.appendChild(this._htmlRoot),m(this._htmlRoot.style,{position:"absolute"})}_initDefs(t,e){let s=t.createElementNS(_,"filter");s.setAttribute("id",O.SHADOW_FILTER);const i=t.createElementNS(_,"feGaussianBlur");i.setAttribute("stdDeviation","1.5"),i.setAttribute("in","SourceAlpha"),s.appendChild(i);const r=t.createElementNS(_,"feOffset");r.setAttribute("dx","1"),r.setAttribute("dy","1"),r.setAttribute("result","offsetblur"),s.appendChild(r);const n=t.createElementNS(_,"feFlood");n.setAttribute("flood-color","#000"),s.appendChild(n);const o=t.createElementNS(_,"feComposite");o.setAttribute("in2","offsetblur"),o.setAttribute("operator","in"),s.appendChild(o);const h=t.createElementNS(_,"feMerge"),a=t.createElementNS(_,"feMergeNode"),l=t.createElementNS(_,"feMergeNode");l.setAttribute("in","SourceGraphic"),h.appendChild(a),h.appendChild(l),s.appendChild(h),e.appendChild(s)}_render(){this.$_render()}$_requestRender(){this.orphaned||(window.requestAnimationFrame?this._requestTimer=window.requestAnimationFrame((()=>this.$_render())):this._requestTimer=setTimeout((()=>{this.$_render()}),0))}updateNow(){this.$_render()}$_render(){if(!this.orphaned)if(this._bounds=this._dom.getBoundingClientRect(),+new Date<=this._toAnimation)this.$_requestRender();else{R.LOGGING&&console.time("render chart");try{this._doBeforeRender();const t=this._dom.getBoundingClientRect(),e=this._svg.getBoundingClientRect(),s=this._svg.clientWidth,i=this._svg.clientHeight;m(this._htmlRoot.style,{left:D(e.left-t.left),top:D(e.top-t.top)});const r=this._container.firstElementChild;r.removeAttribute("style"),m(r.style,{position:"relative",width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden","-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0, 0, 0, 0)"}),this._doRenderBackground(r,this._root,s,i);const n=this._padding=M.getPadding(this._root.dom);this._doRender({x:n.left,y:n.top,width:s-n.left-n.right,height:i-n.top-n.bottom})}finally{this.loaded=!0,this._dirty=!1,this._requestTimer=null,this._doAfterRender(),R.LOGGING&&console.timeEnd("render chart")}}}_doBeforeRender(){}_doAfterRender(){}_doRenderBackground(t,e,s,i){}_domResized(){const t=this.width(),e=this.height(),s=this._resizeDelay;t===this._wSave&&e===this._hSave||(this._wSave=t,this._hSave=e,this._resizeTimer&&clearTimeout(this._resizeTimer),s>0?this._resizeTimer=setTimeout((()=>{this.invalidateLayout(),this._resizeTimer=null}),s):this.invalidateLayout())}toOffset(t){const e=this._container.getBoundingClientRect();return t.pointX=t.clientX-e.left,t.pointY=t.clientY-e.top,t}setPointerCapture(t){this._dom.setPointerCapture(t.pointerId)}releasePointerCapture(t){this._dom.releasePointerCapture(t.pointerId)}}O.CLASS_NAME="rct-control",O.SHADOW_FILTER="rr-chart-shadow-filter",O._animatable=!0;class H extends x{constructor(t,e,s=k){super(),this._visible=!0,this._scaleX=1,this._scaleY=1,this._rotation=0,this._styles={},this._styleDirty=!1,this._dom=t.createElementNS(_,s||"g"),(this._styleName=e||"")&&this.setAttr("class",this._styleName)}_doDestroy(){this.remove()}get doc(){return this._dom.ownerDocument}get dom(){return this._dom}get parent(){return this._parent}get control(){return this._parent&&this._parent.control}get x(){return this._x}set x(t){t!==this._x&&(this._x=t,this.setAttr("x",this._x))}get tx(){return this._tx}get y(){return this._y}set y(t){t!==this._y&&(this._y=t,this.setAttr("y",this._y))}get ty(){return this._ty}get width(){return this._width}set width(t){t!==this._width&&(this._width=t,isNaN(t)?this.removeAttr("width"):this.setAttr("width",t))}get height(){return this._height}set height(t){t!==this._height&&(this._height=t,isNaN(t)?this.removeAttr("height"):this.setAttr("height",t))}get tright(){return this._tx+this._dom.getBBox().width}get tbottom(){return this._ty+this._dom.getBBox().height}get visible(){return this._visible}set visible(t){this.setVis(t)}setVis(t){return t!==this._visible&&(this._visible=t,this._dom&&(this._dom.style.display=t?"":"none")),this._visible}get rotation(){return this._rotation}set rotation(t){t!=this._rotation&&(this._rotation=t,this._updateTransform())}setRotation(t,e,s){return t===this._originX&&e===this._originY&&s===this._rotation||(this._originX=t,this._originY=e,this._rotation=s,this._updateTransform()),this}getStyle(t){return window.getComputedStyle(this._dom).getPropertyValue(t)}hasStyle(t){return this.dom.classList.contains(t)}add(t){return t&&t._parent!==this&&(t._parent=this,this._dom.appendChild(t._dom),t._doAttached(this)),t}insertChild(t,e){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,e._dom),t._doAttached(this)),t}insertAfter(t,e){return t&&t._parent!==this&&(t._parent=this,e._dom.nextSibling?this._dom.insertBefore(t._dom,e._dom.nextSibling):this._dom.appendChild(t._dom),t._doAttached(this)),t}insertFirst(t){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,this._dom.firstChild),t._doAttached(this)),t}appendElement(t,e){const s=t.createElementNS(_,e);return this._dom.appendChild(s),s}insertElement(t,e,s){const i=t.createElementNS(_,e);return this._dom.insertBefore(i,s),i}remove(){return this._parent&&(this._parent._dom.removeChild(this._dom),this._parent=null,this._doDetached(this)),this}getAttr(t){return this._dom.getAttribute(t)}removeAttr(t){return this._dom.removeAttribute(t),this}setAttr(t,e){return this._dom.setAttribute(t,e),this}setAttrEx(t,e){return L(e)?this._dom.removeAttribute(t):this._dom.setAttribute(t,e),this}setAttrs(t){for(let e in t)this._dom.setAttribute(e,t[e]);return this}unsetAttr(t){return this._dom.removeAttribute(t),this}getBounds(){return this._dom.getBoundingClientRect()}setBounds(t,e,s,i){return this.trans(t,e),this.resize(s,i),this}setRect(t){return this.trans(t.x,t.y),this.resize(t.width,t.height),this}getRect(){return{x:this._tx,y:this._ty,width:this.width,height:this.height}}getSize(){return{width:this.width,height:this.height}}getBBox(){return this._dom.getBBox()}getBBoxEx(){const t=this._dom.getBBox();return t.x+=this._tx,t.y+=this._ty,t}inflateBBox(t,e){const s=this._dom.getBBox();return s.x+=this._tx,s.y+=this._ty,s.x-=t,s.width+=2*t,s.y-=e,s.height+=2*e,s}controlToElement(t,e){return this.control.containerToElement(this,t,e)}svgToElement(t,e){return this.control.svgToElement(this,t,e)}elementToSvg(t,e){return this.control.elementToSvg(this,t,e)}move(t,e){return this.x=t,this.y=e,this}setPos(t,e){this._x=t,this._y=e}setPosY(t){this._y=t}isDomAnimating(){return!!this._dom.getAnimations&&this._dom.getAnimations().length>0}rotate(t){return t!==this._rotation&&(this._rotation=t,this._updateTransform()),this}internalRotate(t){this._rotation=t}scale(t,e=NaN){return e=isNaN(e)?t:e,this._scaleX===t&&this._scaleY===e||(this._scaleX=t,this._scaleY=e,this._updateTransform()),this}trans(t,e){return t=R.isValidNum(t)?t:this._tx,e=R.isValidNum(e)?e:this._ty,t===this._tx&&e===this._ty||(this._tx=t,this._ty=e,this._updateTransform()),this}transp(t){return this.trans(t.x,t.y)}transEx(t,e,s=0,i=!0){if(t=R.isValidNum(t)?t:this._tx,e=R.isValidNum(e)?e:this._ty,t!==this._tx||e!==this._ty){if(s>0){const r=this._dom.animate([{transform:`translate(${this._tx||0}px,${this._ty||0}px)`},{transform:`translate(${t}px,${e}px)`}],{duration:s,fill:"none"});i&&(null==r||r.addEventListener("finish",(()=>{var t;return null===(t=this.control)||void 0===t?void 0:t.invalidateLayout()})))}this._tx=t,this._ty=e,this._updateTransform()}return this}transEx2(t,e,s=0,i=!0){const r=R.isValidNum(t)?t:this._tx,n=R.isValidNum(e)?e:this._ty;if(r===this._tx&&n===this._ty)return this;if(s>0){const t=this._rotation||0,e=`translate(${this._tx||0}px, ${this._ty||0}px)`+(t?` rotate(${t}deg)`:""),o=`translate(${r}px, ${n}px)`+(t?` rotate(${t}deg)`:"");this._dom.style.transformOrigin=`${this._originX||0}px ${this._originY||0}px`;const h=this._dom.animate([{transform:e},{transform:o}],{duration:s,fill:"none"});i&&h.addEventListener("finish",(()=>{var t;this._dom.style.transformOrigin="",null===(t=this.control)||void 0===t||t.invalidateLayout()}))}return this._tx=r,this._ty=n,this._updateTransform(),this}transX(t){return t!==this._tx&&R.isValidNum(t)&&(this._tx=t,this._updateTransform()),this}transY(t){return t!==this._ty&&R.isValidNum(t)&&(this._ty=t,this._updateTransform()),this}shiftY(t){return this.transY(this._ty+t)}resize(t,e,s=!0){let i=!1;return t!==this._width&&(this._width=Math.max(0,t),s&&this.setAttrEx("width",this._width),i=!0),e!==this._height&&(this._height=Math.max(0,e),s&&this.setAttrEx("height",this._height),i=!0),i}appendDom(t){return t&&this._dom.appendChild(t),t}insertDom(t,e){return t&&this._dom.insertBefore(t,e),t}clearDom(){const t=this._dom;let e;for(;e=t.lastChild;)t.removeChild(e)}containsClass(t){return this._dom.classList.contains(t)}addClass(t){return this._dom.classList.add(...t.split(" ").filter((t=>t.length>0))),this}removeClass(t){return this._dom.classList.remove(t),this}saveStyles(){this._saveStyle=this._dom.getAttribute("style")||"",this._saveClass=this._dom.getAttribute("class")}restoreStyles(){void 0!==this._saveStyle&&(this._dom.setAttribute("style",this._saveStyle),this._dom.style.display=this._visible?"":"none",delete this._saveStyle),this._saveClass&&(this._dom.setAttribute("class",this._saveClass),delete this._saveClass)}internalClearStyles(){const t=this.dom.style;for(let e in this._styles)t.removeProperty(B(e));this._styles={}}clearStyles(){const t=this.dom.style;let e=!1;for(let s in this._styles)t.removeProperty(B(s)),e=!0;return this._styles={},e&&(this._styleDirty=!0),e}clearStyle(t){let e=!1;if(t){const s=this.dom.style;for(let i of t)i in this._styles&&(s.removeProperty(B(i)),delete this._styles[i],e=!0);e&&(this._styleDirty=!0)}return e}internalSetStyles(t){if(t){const e=this.dom.style;for(let s in t)e[s]=this._styles[s]=t[s]}}internalImportantStylesOrClass(t){if(g(t))t&&this._dom.classList.add(t);else if(u(t)){const e=this.dom.style;for(let s in t)e.setProperty(B(s),this._styles[s]=t[s],"important")}}setStyles(t){let e=!1;if(t){const s=this.dom.style;for(let i in t){const r=t[i];this._styles[i]!==r&&(this._styles[i]=r,"rx"==i&&this._dom.setAttribute(i,r),s[i]=r,e=!0)}e&&(this._styleDirty=!0)}return e}resetStyles(t){const e=this.clearStyles();return this.setStyles(t)||e}_resetClass(){this._styleName?this.setAttr("class",this._styleName):this.unsetAttr("class")}clearStyleAndClass(){this.clearStyles(),this._resetClass()}internalClearStyleAndClass(){this.internalClearStyles(),this._resetClass()}setStyleOrClass(t){g(t)?(this._resetClass(),t&&this.addClass(t)):this.resetStyles(t)}internalSetStyleOrClass(t){g(t)?t&&this.addClass(t):this.internalSetStyles(t)}addStyleOrClass(t){g(t)?t&&this.addClass(t):u(t)&&this.setStyles(t)}setClass(t){this.setAttr("class",t)}setStyle(t,e){let s=!1;return e!==this._styles[t]&&(s=this._styleDirty=!0,this._styles[t]=e,this.dom.style[t]=e),s}internalSetStyle(t,e){e!==this._styles[t]&&(this._styles[t]=e,this.dom.style[t]=e)}setColor(t){this.dom.style.fill=this.dom.style.stroke=this._styles.fill=this._styles.stroke=t}setFill(t){this.dom.style.fill=this._styles.fill=t}setStroke(t){this.dom.style.stroke=this._styles.stroke=t}setTransparent(t){this.dom.style.setProperty("fill","transparent",t?"important":""),this.dom.style.setProperty("stroke","none",t?"important":"")}textAlign(){return this._styles.textAlign}setData(t,e){var s,i;null==e?this.dom.removeAttribute("data-"+t):this.dom.setAttribute("data-"+t,(i="",void 0!==(s=e)?s:i))}unsetData(t){this.dom.removeAttribute("data-"+t)}setBoolData(t,e){e?this.dom.setAttribute("data-"+t,""):this.dom.removeAttribute("data-"+t)}getData(t){return this.dom.getAttribute("data-"+t)}hasData(t){return null!=this.getData(t)}removeLater(t,e){if(this._parent)if(t>0){const s=this._dom.animate([{},{opacity:0}],{duration:t,fill:"none"});null==s||s.addEventListener("finish",(()=>{this.remove(),null==e||e(this)}))}else this.remove();return this}hide(t){if(this._parent)if(t>0){const e=this._dom.animate([{},{opacity:0}],{duration:t,fill:"none"});null==e||e.addEventListener("finish",(()=>{delete this.hiding,this.setVis(!1)})),this.hiding=!0}else this.setVis(!1);return this}clipRect(t,e,s,i,r=0){const n=this.control.clipBounds(t,e,s,i,r);return this.setClip(n),n}setClip(t){t?this.setAttr("clip-path","url(#"+(t.id||t)+")"):this.unsetAttr("clip-path")}setTemporary(){return this.setAttr(H.TEMP_KEY,1),this}setCursor(t){this._dom.style.cursor=t}ignorePointer(){this._dom.style.pointerEvents="none"}contains(t){return this._dom.contains(t)}front(t,e){if(!this.parent)return;const s=this.parent._dom,i=this._dom,r=t.length;if(e){const n=e.sort(((e,s)=>t.indexOf(e)-t.indexOf(s)))[e.length-1];this!==n&&(i.remove(),n===t[r-1]?s.appendChild(i):s.insertBefore(i,t[t.indexOf(n)+1].dom))}else r>1&&i!==s.lastElementChild&&(i.remove(),s.appendChild(i))}back(t){if(!this.parent)return;if(t.length>1){const e=t.indexOf(this);this._dom.remove(),e<t.length-1?this.parent.dom.insertBefore(this._dom,t[e+1].dom):this.parent.dom.appendChild(this._dom)}}invalidate(){var t;null===(t=this.control)||void 0===t||t.invalidateLayout()}sort(t){t.forEach((t=>this._dom.appendChild(t._dom)))}getParent(t){let e=this._parent;for(;e;){if(e instanceof t)return e;e=e._parent}}_testing(){return H.TESTING}_doAttached(t){}_doDetached(t){}_updateTransform(){this._dom.setAttribute("transform",this.getTransform())}getTransform(){const t=this._dom;let e=this._tx,s=this._ty,i=[];(R.isValidNum(e)||R.isValidNum(s))&&(e=e||0,s=s||0,i.push("translate("+e+","+s+")")),this._rotation&&i.push("rotate("+this._rotation+" "+R.pick(this._originX,t.getAttribute("x"),0)+" "+R.pick(this._originY,t.getAttribute("y")||0)+")"),R.isNotEmpty(this._matrix)&&i.push("matrix("+this._matrix.join(",")+")");const r=R.getNumber(this._scaleX,1),n=R.getNumber(this._scaleY,1);return 1===r&&1===n||i.push("scale("+r+" "+n+")"),i.length?i.join(" "):""}}H.DEBUGGING=!1,H.TESTING=!1,H.ASSET_KEY="_asset_",H.TEMP_KEY="_temp_";class V extends H{constructor(t){super(t.doc(),"rct-root"),this._control=t}get control(){return this._control}}class I extends H{constructor(t){super(t,k,"clipPath");const e=this._id=R.uniqueKey()+"-";this.setAttr("id",e)}get id(){return this._id}}class F extends I{constructor(t,e=NaN,s=NaN,i=NaN,r=NaN,n=0,o=0){super(t);const h=this._rect=new H(t,null,"rect");h.setAttr("fill","none"),n>0&&h.setAttr("rx",String(n)),o>0&&h.setAttr("ry",String(o)),isNaN(e)||h.setBounds(e,s,i,r),this.add(h)}setBounds(t,e,s,i){return this._rect.x=t,this._rect.y=e,this._rect.resize(s,i),this}resize(t,e,s){return this._rect.resize(t,e)}get x(){return this._rect.x}set x(t){this._rect.x=t}get y(){return this._rect.y}set y(t){this._rect.y=t}get width(){return this._rect.width}set width(t){this._rect.width=t}get height(){return this._rect.height}set height(t){this._rect.height=t}}class G extends I{constructor(t){super(t),this.add(this._circle=new H(t,null,"circle"))}setCircle(t,e,s){this._circle.setAttrs({cx:t,cy:e,r:s})}}class j extends H{static create(t,e,s,i,r,n,o=0){return new j(t,e,{x:s,y:i,width:r,height:n,r:o})}constructor(t,e=k,s=k){super(t,e,"rect"),this.rect=s}get rect(){return this._rect&&{...this._rect}}set rect(t){if(t!==this._rect&&(this._rect=t&&{...t},t)){this.setRect(t);let e=t.rx||t.r,s=t.ry||t.r;e>0&&this.dom.setAttribute("rx",String(e)),s>0&&this.dom.setAttribute("rx",String(s))}}resizeRect(t,e){const s=this.getStyle("border-radius");return this.resize(t,e),s&&this.dom.setAttribute("rx",s),this}setBounds(t,e,s,i,r=0){return this.rect={x:t,y:e,width:s,height:i,r:r},this}setBox(t,e,s,i){this.rect=i<0?{x:t,y:e+i,width:s,height:-i}:{x:t,y:e,width:s,height:i}}setRadius(t){t>0&&(this._rect&&(this._rect.rx=this._rect.ry=t),this.dom.setAttribute("rx",String(t)),this.dom.setAttribute("ry",String(t)))}}class Y{static isBright(t){return new Y(t).isBright()}static getContrast(t,e,s){return new Y(t).getContrast(e,s)}static interpolate(t,e,s){const i=new Y(t),r=new Y(e),n=1-s,o=Math.round(i.r*s+r.r*n),h=Math.round(i.g*s+r.g*n),a=Math.round(i.b*s+r.b*n),l=i.a*s+r.a*(1-s);return l<1?`rgba(${o},${h},${a},${l})`:`rgb(${o},${h},${a})`}constructor(t){this.r=0,this.g=0,this.b=0,this.a=1,(t=t&&t.trim())&&(R.startsWith(t,"rgb(")&&R.endsWith(t,")")?this.$_parseRgb(t.substring(4,t.length-1)):R.startsWith(t,"rgba(")&&R.endsWith(t,")")?this.$_parseRgb(t.substring(5,t.length-1)):R.startsWith(t,"#")&&this.$_parseNumber(t.substr(1)))}get rgba(){return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}isBright(){return.299*this.r+.587*this.g+.114*this.b>140}getContrast(t,e){return this.isBright()?t||"#000000":e||"#FFFFFF"}brighten(t,e=null){return(e=e||new Y(null)).r=Math.ceil(this.r+(255-this.r)*t),e.g=Math.ceil(this.g+(255-this.g)*t),e.b=Math.ceil(this.b+(255-this.b)*t),e.a=this.a,e}toString(){return this.rgba}$_parseRgb(t){const e=t.split(/\,\s*/);e.length>=3&&(this.r=+e[0],this.g=+e[1],this.b=+e[2],e.length>=4?this.a=+e[3]:this.a=1)}$_parseNumber(t){const e=t.length;let s;e>6?(s=parseInt(t.substr(0,6),16),this.a=parseInt(t.substring(6),16)/255):e>0&&(3===e&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),s=parseInt(t,16)),this.r=(16711680&s)>>16,this.g=(65280&s)>>8,this.b=255&s}}var X,W,q;Y.BLACK="#000",Y.WHITE="#fff",function(t){t.START="start",t.MIDDLE="middle",t.END="end"}(X||(X={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(W||(W={})),function(t){t.TRUNCATE="truncate",t.WRAP="wrap",t.ELLIPSIS="ellipsis"}(q||(q={}));class U extends H{constructor(t,e=void 0){super(t,e,"text"),this._layout=W.TOP,this._overflow=q.WRAP,this._dirty=!0,this._text="",this.anchor=X.MIDDLE}get text(){return this._text}set text(t){(t=t||"")!==this._text&&(this._dirty=!0,this.dom.textContent=this._text=t,this.layoutText())}get anchor(){return this.getAttr("text-anchor")}set anchor(t){t!==this.anchor&&this.setAttr("text-anchor",t)}get layout(){return this._layout}set layout(t){t!==this._layout&&(this._layout=t,this.layoutText())}get overflow(){return this._overflow}set overflow(t){t!==this._overflow&&(this._overflow=t,this.layoutText())}get opacity(){return this.getAttr("fill-opacity")}set opacity(t){this.setAttr("fill-opacity",t)}getAscent(t){return.72*t}layoutText(t){const e=this.getBBox(),s=this.getAscent(isNaN(t)?e.height:t);let i;switch(this._layout){case W.MIDDLE:i=Math.floor(s/2);break;case W.BOTTOM:i=0;break;default:i=Math.ceil(s)}this.y=i}isFitIn(t){return this.calcWidth()>=t}calcWidth(){const t=this._text.length;return t&&this.dom.getSubStringLength(0,t)}calcRangeWidth(t=0,e=Number.MAX_SAFE_INTEGER){return t=y(0,t),(e=f(this._text.length,e))>t?this.dom.getSubStringLength(t,e-t):0}truncate(t,e){let s=this._text;if(!s)return;const i=this.dom;let r,n=0,o=s.length;do{r=Math.ceil((n+o)/2);i.getSubStringLength(0,r)>t?o=r-1:n=r}while(n<o);for(this.text=s.substring(0,n)+"…";n>0&&this.calcWidth()>t;)this.text=s.substring(0,--n)+"…"}setContrast(t,e,s){return this.setStyleOrClass(Y.isBright(getComputedStyle(t).fill)?e:s),this}clearDom(){super.clearDom(),this._dirty=!0}setStyles(t){const e=super.setStyles(t);return e&&this.layoutText(),e}setStyle(t,e){let s=super.setStyle(t,e);return s&&this.layoutText(),s}getBBox(){return(this._dirty||this._styleDirty)&&(this._bounds=this.dom.getBBox(),this._dirty=this._styleDirty=!1),this._bounds}getBBoundsTest(){return(this._dirty||this._styleDirty)&&(this._bounds={x:this.x,y:this.y,width:100,height:30},this._dirty=this._styleDirty=!1),this._bounds}stain(){this._dirty=!0}}class K{static create(t,e,s,i){return isNaN(s)?isNaN(e)?new K(t,t,t,t):new K(t,t,e,e):new K(t,e,s,i)}static createFrom(t){const e=t.split(/\s*[\s,]+\s*/g);return this.create.call(null,...e.map((t=>+t)))}constructor(t=0,e=0,s=0,i=0){this.top=t,this.bottom=e,this.left=s,this.right=i}clone(){return new K(this.top,this.bottom,this.left,this.right)}applyPadding(t){return this.left=v(t.paddingLeft,0),this.right=v(t.paddingRight,0),this.top=v(t.paddingTop,0),this.bottom=v(t.paddingBottom,0),this}applyMargin(t){return this.left=v(t.marginLeft,0),this.right=v(t.marginRight,0),this.top=v(t.marginTop,0),this.bottom=v(t.marginBottom,0),this}shrink(t){return{x:t.x+this.left,y:t.y+this.top,width:t.width-this.left-this.right,height:t.height-this.top-this.bottom}}}K.Empty=Object.freeze(new K),K.Temp=new K;class Z extends H{constructor(t,e=k){super(t,e,"g"),this._doInitChildren(t)}setAttr(t,e){return Z.IGNORE_ATTRS.hasOwnProperty(t)||super.setAttr(t,e),this}_doInitChildren(t){}}Z.IGNORE_ATTRS={width:"",height:""};class J extends H{constructor(t,e=k){super(t,e,"g"),H.DEBUGGING&&(this.add(this._debugRect=new j(t,"rct-debug")),this._debugRect.setAttr("pointerEvents","none"))}chart(){return this.model.chart}get model(){return this._model}_prepareStyleOrClass(t){this.setStyleOrClass(t._style)}setModel(t){t!==this.model&&(this._model=t,this.options=t._op)}measure(t,e,s,i,r){this._prepareStyleOrClass(e),this.setModel(e);const n=this._doMeasure(t,this.model,s,i,r);return this.mw=n.width,this.mh=n.height,n}layout(t){return this._doLayout(t),H.DEBUGGING?(this._debugRect||this.insertFirst(this._debugRect=new j(this.doc,"rct-debug")),this.width>1&&this.height>1&&this._debugRect.setRect(this._getDebugRect())):this._debugRect&&(this._debugRect.remove(),this._debugRect=null),this}resizeByMeasured(){return this.resize(this.mw,this.mh),this}_getDebugRect(){return{x:0,y:0,width:this.width,height:this.height}}_doMeasure(t,e,s,i,r){return{width:s,height:i}}_doLayout(t){}_invalidate(){var t;null===(t=this.control)||void 0===t||t.invalidateLayout()}}class Q extends J{constructor(t,e,s){super(t,e),this._margins=new K,this._paddings=new K,this.add(this._background=new j(t,s))}_getDebugRect(){return this._margins.shrink(super._getDebugRect())}measure(t,e,s,i,r){this._prepareStyleOrClass(e),this.setModel(e),this._setBackgroundStyle(this._background);let n=getComputedStyle(this._background.dom);const o=this._paddings;o.applyPadding(n);const h=this._doMeasure(t,e,s,i,r);if(h.width+=o.left+o.right,h.height+=o.top+o.bottom,this._marginable()){const t=this._margins;n=getComputedStyle(this.dom),t.applyMargin(n),this.mw=h.width+=t.left+t.right,this.mh=h.height+=t.top+t.bottom}return this.mw=h.width,this.mh=h.height,h}layout(t){if(super.layout(t),this._marginable()){const t=this._margins;this._background.setBounds(t.left+this._getBackOffset(),t.top,this.width-t.left-t.right,this.height-t.top-t.bottom)}else this._resetBackBounds()&&this._background.setBounds(0,0,this.width,this.height);return this}_marginable(){return!0}_resetBackBounds(){return!0}_getBackOffset(){return 0}_deflatePaddings(t){const e=this._paddings;t.width-=e.left+e.right,t.height-=e.top+e.bottom}}class tt extends J{constructor(t){super(t,"rct-legend-item"),this.add(this._back=new j(t)),this._back.setFill("transparent"),this._back.setStroke("none"),this.add(this._label=new U(t,"rct-legend-item-label")),this._label.anchor=X.START}setMarker(t){t!==this._marker&&(this._marker&&this._marker.remove(),this.insertFirst(this._marker=t))}_doMeasure(t,e,s,i,r){var n,o;const h=e.source;this._label.setBoolData("hidden",!h.visible),this._marker.setBoolData("hidden",!h.visible),this._label.setBoolData("empty",null===(n=h.isEmpty)||void 0===n?void 0:n.call(h)),this._marker.setBoolData("empty",null===(o=h.isEmpty)||void 0===o?void 0:o.call(h)),this._label.text=e.text()||"…";const a=this._rMarker=this._marker.setVis(e.legend.options.markerVisible)?this._marker.getBBox():E,l={width:(d=this._label.getBBox()).width,height:d.height};var d;return this._gap=v(e.legend.options.markerGap,0),{width:a.width+this._gap+l.width,height:y(a.height,l.height)}}_doLayout(t){const e=this._rMarker,s=v(t,e.width);this._back.setBounds(0,0,this.width,this.height),this._marker.visible&&this._marker.trans((s-e.width)/2,(this.height-e.height)/2),this._label.trans(s+this._gap,(this.height-this._label.getBBox().height)/2)}}class et extends Q{constructor(t){super(t,et.LEGEND_CLASS,"rct-legend-background"),this._itemViews=new A(this,tt)}legendByDom(t){const e=this._itemViews.elementOf(t);return e&&e.model}legendOfSeries(t){return this._itemViews.find((e=>e.model.source===t))}_setBackgroundStyle(t){t.setStyleOrClass(this.model.options.backgroundStyle)}_doMeasure(t,e,s,i,r){const n=e.options,o=e.items(),h=this._vertical="vertical"===e.getLayout();return this._ipr=v(n.itemsPerLine,Number.MAX_SAFE_INTEGER),this._gap="body"!==e._location?v(n.gap,0):0,h?i=e.getMaxHeight(i):s=e.getMaxWidth(s),this.$_prepareItems(t,o),this.$_measure(t,e,h,this._ipr,s,i)}_doLayout(){const t=this.model.options,e=this._rowViews,s=t.useTextColor,i=this._sizes,r=t.itemsAlign,n=t.lineGap||0,o=t.itemGap||0,h=this._margins,a=this._paddings,l=this._vertical,d=h.left+a.left,c=h.top+a.top;let _,u=d,p=c;this._itemViews.forEach((t=>{const e=t.model.source,i=e.legendColor(),r=e.legendStroke();t._marker.setColor(i),r&&t._marker.setStroke(r),s&&e.visible?t._label.setFill(i):t._label.setFill("")})),e.forEach(((t,e)=>{l?(t.forEach((t=>{t.mw=i[e],t.resizeByMeasured().layout(this._wMarkers[e])})),p=c,"center"!==r&&"end"!==r||(_=t.map((t=>t.height)).reduce(((t,e)=>t+e))+o*(t.length-1)+h.top+h.bottom+a.top+a.bottom,p+="center"===r?(this.height-_)/2:this.height-_),t.forEach((t=>{t.trans(u,p),p+=t.height+o})),u+=i[e]+n):(t.forEach((t=>{t.resizeByMeasured().layout(NaN)})),u=d,"center"!==r&&"end"!==r||(_=t.map((t=>t.width)).reduce(((t,e)=>t+e))+o*(t.length-1)+h.left+h.right+a.left+a.right,u+="center"===r?(this.width-_)/2:this.width-_),t.forEach((t=>{t.trans(u,p),u+=t.width+o})),p+=i[e]+n)}))}$_prepareItems(t,e){this._itemViews.prepare(e.length)}$_measure(t,e,s,i,r,n){const o=e.options,h=e.items(),a=this._itemViews,l=o.itemGap||0,d=o.lineGap||0,c=e.getMarkerSize(),_=a.count,u=this._rowViews=[],p=this._sizes=[];let g,m,f,w;a.forEach(((e,s)=>{e.setMarker(h[s].source.legendMarker(t,c)),e.measure(t,h[s],r,n,1)}));let v=0,b=0;if(s){for(;v<_;)w=a.get(v),b%i==0?(u.push(f=[w]),m=w.mh,b++,v++):(m+=l+w.mh,m<=n?(f.push(w),b++,v++):b=0);this._wMarkers=[],g=m=0,u.forEach(((t,e)=>{let s=0,i=0,r=0;t.forEach((t=>{i+=t.mh,s=y(s,t.mw),r=y(r,t._rMarker.width),t._col=e})),i+=l*(t.length-1),m=y(m,i),g+=s,p.push(s),this._wMarkers.push(r)})),g+=d*(u.length-1)}else{for(;v<_;)w=a.get(v),b%i==0?(u.push(f=[w]),g=w.mw,b++,v++):(g+=l+w.mw,g<=r?(f.push(w),b++,v++):b=0);g=m=0,u.forEach((t=>{let e=0,s=0;t.forEach((t=>{e+=t.mw,s=y(s,t.mh)})),e+=l*(t.length-1),g=y(g,e),m+=s,p.push(s)})),m+=d*(u.length-1)}return{width:g,height:m}}}et.LEGEND_CLASS="rct-legend";class st extends e.SectionView{constructor(){super(...arguments),this.views=[],this._gap=0}isEmpty(){return 0===this.views.length}prepare(t,s,i,r){const n=this.views,o=[];for(this.isX=i,r._axes.forEach((t=>{t.checkVisible()&&s.isValidAxis(t)&&o.push(t)}));n.length<o.length;){const s=new e.AxisView(t);this.add(s),n.push(s)}for(;n.length>o.length;)n.pop().remove();if(n.forEach(((t,e)=>{t.setModel(o[e])})),this.axes=o,this.setVis(n.length>0)){const t=n[0].model;this._gap=t.chart.getAxesGap()}}prepareGuides(t,e,s){const i=this.views,r=this.axes;i.forEach(((s,i)=>{const n=r[i];e.forEach((e=>{e.forEach((e=>{e.isConnected(n)&&s.setVis(this.visible)&&(s.prepareGuides(t,e.row,e.col,e._guideContainer,e._frontGuideContainer),n._isHorz||(e._axes||(e._axes=[]),e._axes.push(n)))}))}))})),e.forEach((e=>{e.forEach((e=>{e._axes&&(e._gridRowContainer.addAll(t,e._axes),e._axes=[])}))}))}checkHeights(t,e,s){return this.views.length>0?this.$_checkHeights(this.views,t,e,s):0}$_checkHeights(t,e,s,i){let r=0;return t&&(t.forEach((t=>{r+=t.checkHeight(e,s,i)})),r+=(this.views.length-1)*this._gap),r}checkWidths(t,e,s){return this.views.length>0?this.$_checkWidths(this.views,t,e,s):0}$_checkWidths(t,e,s,i){let r=0;return t&&(t.forEach((t=>{r+=t.checkWidth(e,s,i)})),r+=(this.views.length-1)*this._gap),r}getScrollView(t){var e;for(const s of this.views)if(null===(e=s._scrollView)||void 0===e?void 0:e.contains(t))return s._scrollView}setMargins(t,e,s,i){this.views.forEach((r=>r.setMargins(t,e,s,i)))}_setInverted(t){super._setInverted(t),this.isHorz=t&&!this.isX||!t&&this.isX}_doMeasure(t,e,s,i,r){const n=this.axes;if(this.isHorz){let e=0;return this.views.forEach(((o,h)=>{e+=o.measure(t,n[h],s,i,r).height})),{width:s,height:e}}{let e=0;return this.views.forEach(((o,h)=>{e+=o.measure(t,n[h],s,i,r).width})),{width:e,height:i}}}_doLayout(t){const e=this.views,s=this.width,i=this.height,r=e.length;let n=0,o=r-1;if(this.isHorz){let t,h,a=0;for(;n<r;n++){const t=e[n];if(t.model._posValue()<1)break;t.trans(0,a),a+=t.mh}for(t=a,a=i;o>=0;o--){const t=e[o];if(t.model._posValue()>-1)break;a-=t.mh,t.trans(0,a)}h=a;const l=h-t;let d=0;for(let t=n;t<=o;t++)d+=e[t].mh;t+=(l-d)/2;for(let s=n;s<=o;s++){const i=e[s];i.trans(0,t),t+=i.mh}e.forEach((t=>{t.resize(s,t.mh),t.model._calcPoints(s,999),t.layout()}))}else{let t,h,a=0;for(;n<r;n++){const t=e[n];if(t.model._posValue()>-1)break;t.trans(a,0),a+=t.mw}for(t=a,a=s;o>=0;o--){const t=e[o];if(t.model._posValue()<1)break;a-=t.mw,t.trans(a,0)}h=a;const l=h-t;let d=0;for(let t=n;t<=o;t++)d+=e[t].mw;t+=(l-d)/2;for(let s=n;s<=o;s++){const i=e[s];i.trans(t,0),t+=i.mw}e.forEach((t=>{t.resize(t.mw,i),t.model._calcPoints(i,999),t.layout()}))}}}class it extends e.SectionView{constructor(t,e){super(t,"rct-axis-container"),this.isX=e,this.sections=[]}prepare(t,e,s,i,r){const n=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<n.length;){const e=new st(t);this.add(e),this.sections.push(e)}for(;this.sections.length>n.length;)this.sections.pop().remove();this.sections.forEach(((s,r)=>{this.isX?(s.row=i,s.col=r):(s.col=i,s.row=r),s.prepare(t,e,this.isX,n[r])})),this._setInverted(r)}prepareGuides(t,e,s,i){const r=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<r.length;){const e=new st(t);this.add(e),this.sections.push(e)}for(;this.sections.length>r.length;)this.sections.pop().remove();this.sections.forEach(((r,n)=>{this.isX?(r.row=i,r.col=n):(r.col=i,r.row=n),r.prepareGuides(t,e,s)}))}checkWidths(t,e,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,r)=>i+r.checkWidths(t,e,s)),0):this.sections.reduce(((i,r)=>Math.max(i,r.checkWidths(t,e,s))),0):0}checkHeights(t,e,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,r)=>Math.max(i,r.checkHeights(t,e,s))),0):this.sections.reduce(((i,r)=>i+r.checkHeights(t,e,s)),0):0}_setInverted(t){super._setInverted(t),this._isHorz=t&&!this.isX||!t&&this.isX}_doMeasure(t,s,i,r,n){let o=0,h=0;return this._isHorz?this.sections.forEach((o=>{h=e.maxv(h,o.measure(t,s,i,r,n).height)})):this.sections.forEach((h=>{o=e.maxv(o,h.measure(t,s,i,r,n).width)})),{width:o,height:h}}_doLayout(t){this._isHorz?this.height>0&&this.sections.forEach(((e,s)=>{e.resize(t[2*(s+1)]-t[2*(s+1)-1],this.height),e.trans(t[2*s+1]-t[1],0),e.layout()})):this.width>0&&this.sections.forEach(((e,s)=>{e.resize(this.width,t[2*(s+1)]-t[2*(s+1)-1]),e.trans(0,this.height-(t[2*(s+1)]-t[1])),e.layout()}))}}class rt extends e.BodyView{constructor(t,e){super(t,e),this.row=0,this.col=0,this.add(this._legendView=new et(t))}getCol(){return this.col}getRow(){return this.row}getTooltipPos(){return{x:this.parent.parent.tx+this.tx,y:this.parent.parent.ty+this.ty}}prepareRender(t,s){const i=s.chart,r=s.depth.visible,n=this.row,o=this.col,h=i._split.getPane(n,o).body;this._animatable=e.RcControl._animatable&&i.animatable(),this._prepareSeries(t,s,i._getSeries().getPaneSeries(n,o),r),this._prepareGauges(t,i,i._getGauges().getPaneVisibles(n,o)),this._prepareAnnotations(t,h.getAnnotations().concat(i._getAnnotations().getPaneVisibles(n,o)))}_doMeasure(t,e,s,i,r){return this._legendView.setVis(e.pane.legend.visible)&&this._legendView.measure(t,e.pane.legend,s,i,r),super._doMeasure(t,e,s,i,r)}_doLayout(){super._doLayout();const t=this._legendView;if(t.visible){this._seriesViews.forEach((e=>{if(e.needDecoreateLegend()){const s=t.legendOfSeries(e.model);s&&e.decoreateLegend(s)}}));const e=t.model.options,s=e.align,i=e.verticalAlign;let r=0,n=0,o=+e.offsetX||0;switch(s){case"right":r+=this.width-t.mw-o;break;case"center":r+=(this.width-t.mw)/2+o;break;default:r+=o}switch(o=+e.offsetY||0,i){case"bottom":n+=this.height-t.mh-o;break;case"middle":n+=(this.height-t.mh)/2+o;break;default:n+=o}t.trans(r,n).resize(t.mw,t.mh),t.layout()}}}class nt extends e.PaneContainer{constructor(t,e){super(t,nt.STYLE_NAME),this._bodies=[],this._xContainers=[],this._yContainers=[],this._owner=e}get bodies(){return this._bodies}bodyViewOf(t){return this._bodies.find((e=>e.contains(t)))}prepare(t,e){e.chart,this.$_init(t),this._model=e,this.$_prepareBodies(t,e)}measure(t,e,s,i,r){const n=e.chart,o=this._inverted=e.chart.isInverted(),h=e._xAxes,a=e._yAxes,l=s,d=i;this.$_prepareAxes(t,h,!0,o),this.$_prepareAxes(t,a,!1,o),e.measureAxes(s,i,o,r),o?(s-=this._xContainers.reduce(((e,r)=>e+r.checkWidths(t,s,i)),0),i-=this._yContainers.reduce(((e,r)=>e+r.checkHeights(t,s,i)),0)):(i-=this._xContainers.reduce(((e,r)=>e+r.checkHeights(t,s,i)),0),s-=this._yContainers.reduce(((e,r)=>e+r.checkWidths(t,s,i)),0)),e.measureAxes(s,i,o,r),this._xContainers.forEach((e=>e.measure(t,n,s,i,r))),this._yContainers.forEach((e=>e.measure(t,n,s,i,r))),s=l,i=d,o?(s-=this._xContainers.reduce(((t,e)=>t+e.mw),0),i-=this._yContainers.reduce(((t,e)=>t+e.mh),0)):(i-=this._xContainers.reduce(((t,e)=>t+e.mh),0),s-=this._yContainers.reduce(((t,e)=>t+e.mw),0)),r++,e.measureAxes(s,i,o,r),this.$_prepareAxisGuides(t,h,!0),this.$_prepareAxisGuides(t,a,!1),this._xContainers.forEach((e=>{e.measure(t,n,s,i,r)})),this._yContainers.forEach((e=>{e.measure(t,n,s,i,r)}));const c=e.getXLens(o?i:s),_=e.getYLens(o?s:i);e.completeAxesPoints(c,_)}layout(){const t=this._model,e=this.width,s=this.height;this._back.resize(e,s),this.$_calcExtents(t,e,s),this.$_layoutAxes(t,!0,e,s),this.$_layoutAxes(t,!1,e,s),this.$_layoutBodies(t,e,s)}seriesByDom(t){for(const e of this._bodies){const s=e.seriesByDom(t);if(s)return s}}getSeries(t){for(const e of this.bodies){const s=e.findSeries(t);if(s)return s}}legendByDom(t){for(const e of this.bodies){const s=e._legendView.legendByDom(t);if(s)return s}}$_init(t){this._back||(this.add(this._back=new e.RectElement(t)),this._back.setStyles({fill:"none"}),this.add(this._bodyContainer=new e.LayerElement(t,void 0)),this.add(this._axisContainer=new e.LayerElement(t,void 0)))}$_prepareBodies(t,e){e.chart;const s=e.paneCount,i=e.rowCount,r=e.colCount,n=this._bodies,o=this._bodyMap=[];for(;n.length<s;){const e=new rt(t,this._owner);this._bodyContainer.add(e),n.push(e)}for(;n.length>s;)n.pop().remove();for(let t=0;t<i;t++){const e=[];for(let s=0;s<r;s++){const i=n[t*r+s];e.push(i),i.row=t,i.col=s}o.push(e)}n.forEach((s=>{s.prepareRender(t,e.getPane(s.row,s.col).body),s.prepareGuideContainers(),s._gridRowContainer.prepare()}))}$_prepareAxes(t,e,s,i){const r=this._model.chart,n=s?this._xContainers:this._yContainers,o=s?e.rows():e.cols();for(;n.length<o;){const e=new it(t,s);this._axisContainer.add(e),n.push(e)}for(;n.length>o;)n.pop().remove();n.forEach(((s,n)=>{s.prepare(t,r,e,n,i)}))}$_prepareAxisGuides(t,e,s){(s?this._xContainers:this._yContainers).forEach(((s,i)=>{s.prepareGuides(t,this._bodyMap,e,i)}))}$_calc(t,e,s,i){const r=s.length,n=new Array(2*(r+1)),o=e-t.reduce(((t,e)=>t+e[i]),0),h=this._model._calcSizes(s,o);let a=0,l=0;for(l=0;l<r;l++)n[2*l]=a,n[2*l+1]=a+=t[l][i],a+=h[l];return n[2*l]=a,n[2*l+1]=a+t[l][i],n}$_calcExtents(t,e,s){this._inverted?(this._rowPoints=this.$_calc(this._xContainers,e,t.rowSizes(),"mw"),this._colPoints=this.$_calc(this._yContainers,s,t.colSizes(),"mh")):(this._rowPoints=this.$_calc(this._xContainers,s,t.rowSizes(),"mh"),this._colPoints=this.$_calc(this._yContainers,e,t.colSizes(),"mw"))}$_layoutAxes(t,e,s,i){const r=this.control._padding,n=this._rowPoints,o=this._colPoints,h=e?this._xContainers:this._yContainers;if(this._inverted)if(e){const t=o[1],e=o[o.length-2]-t;h.forEach(((t,s)=>{t.resize(t.mw,e),t.trans(n[2*s],i-o[o.length-2]),t.layout(o)}))}else{const t=n[1],e=n[n.length-2]-t;h.forEach(((s,h)=>{const a=s.sections;for(let t=0,e=a.length;t<e;t++){const s=a[t],i=0===t?r.left:0,o=t===e-1?r.right:0;let h=0,l=0;e>1&&(h=n[2*t+1]-n[2*t],l=n[2*(t+1)+1]-n[2*(t+1)],0===t?a[t+1].isEmpty()?l=n[2*(t+1)]-n[2*(t+1)-1]:l/=2:t===e-1?a[t-1].isEmpty()?h=n[2*(t-1)]-n[2*(t-1)-1]:h/=2:(a[t-1].isEmpty()?h=n[2*(t-1)]-n[2*(t-1)-1]:h/=2,a[t+1].isEmpty()?l=n[2*(t+1)]-n[2*(t+1)-1]:l/=2)),s.setMargins(i,h,l,o)}s.resize(e,s.mh),s.trans(t,i-o[2*h+1]),s.layout(n)}))}else if(e){const t=o[1];s=o[o.length-2]-t,h.forEach(((e,a)=>{const l=e.sections;for(let t=0,e=l.length;t<e;t++){const s=l[t],i=0===a?r.left:0,d=a===h.length-1?r.right:0;let c=0,_=0;e>1&&(c=o[2*t+1]-o[2*t],_=o[2*(t+1)+1]-o[2*(t+1)],0===t?l[t+1].isEmpty()?_=o[2*(t+1)]-o[2*(t+1)-1]:_/=2:t===e-1?l[t-1].isEmpty()?c=o[2*(t-1)]-o[2*(t-1)-1]:c/=2:(l[t-1].isEmpty()?c=o[2*(t-1)]-o[2*(t-1)-1]:c/=2,l[t+1].isEmpty()?_=o[2*(t+1)]-n[2*(t+1)-1]:_/=2)),s.setMargins(i,c,_,d)}e.resize(s,e.mh),e.trans(t,i-n[2*a+1]),e.layout(o)}))}else{const t=n[n.length-2],e=t-n[1];h.forEach(((s,r)=>{s.resize(s.mw,e),s.trans(o[2*r],i-t),s.layout(n)}))}}$_layoutBodies(t,e,s){const i=t.rowCount,r=t.colCount,n=this._rowPoints,o=this._colPoints,h=this._bodies;if(this._inverted)for(let e=0;e<i;e++){const s=n[2*(e+1)-1],i=n[2*(e+1)];for(let n=0;n<r;n++){const a=h[e*r+n],l=o[2*n+1],d=o[2*(n+1)];a.measure(this.doc,t.getPane(e,n).body,i-s,d-l,1),a.resize(i-s,d-l),a.trans(s,this.height-d),a.layout()}}else for(let e=0;e<i;e++){const i=n[2*(e+1)-1],a=n[2*(e+1)];for(let n=0;n<r;n++){const l=h[e*r+n],d=o[2*(n+1)-1],c=o[2*(n+1)];l.measure(this.doc,t.getPane(e,n).body,c-d,a-i,1),l.resize(c-d,a-i),l.trans(d,s-a),l.layout()}}}}function ot(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.ChartObject.registerSplitClass(c),t.ChartView.registerPaneClass(nt))}nt.STYLE_NAME="rct-panes",ot(i),t.Split=c,t.default=ot,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartSplit={},e.RealChart)}(this,(function(e,t){"use strict";function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var i=s(t);class o{constructor(e,t){this.row=e,this.col=t,this._axes=[]}sort(e,t){const s=t&&!e||!t&&e;this._axes.length>1&&(s?this._axes.sort(((e,t)=>{const s=e._posValue(),i=t._posValue();return s===i?s<0?t._index-e._index:s>0?e._index-t._index:e.row!==t.row?t.row-e.row:e.row<this.row?t._index-e._index:e._index-t._index:i-s})):this._axes.sort(((e,t)=>{const s=e._posValue(),i=t._posValue();return s===i?s<0?e._index-t._index:s>0?t._index-e._index:e.col!==t.col?e.col-e.col:e.col<this.col?e._index-t._index:t._index-e._index:s-i})))}}class r{constructor(e,t){this.chart=e,this.isX=t}rows(){return this._matrix.length}cols(){return this._matrix[0].length}_prepare(e,t,s,i){this._doPrepare(e,t,s),this._matrix.forEach((e=>{e.forEach((e=>e.sort(this.isX,i)))}))}get(e,t){return this._matrix[e][t]}getRow(e){return this._matrix[e]}getColumn(e){return this._matrix.map((t=>t[e]))}_buildTicks(e,t){const s=this.isX;this._matrix.forEach(((i,o)=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{!i.isBased()&&(t<2||s)&&i._buildTicks(e[s?i.options.col:i.options.row],t)}))}))})),this._matrix.forEach(((i,o)=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{i.isBased()&&(t<2||s)&&i._buildTicks(e[s?i.options.col:i.options.row],t)}))}))}))}_calcPoints(e,t){const s=this.isX;this._matrix.forEach((i=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{if(t<2||s){const o=s?i.options.col:i.options.row;i._calcPoints(e[o],t)}}))}))}))}}class n extends r{constructor(e){super(e,!0)}_doPrepare(e,t,s){const i=this._matrix=new Array(t+1);for(let e=0;e<i.length;e++){i[e]=[];for(let t=0;t<s;t++)i[e].push(new o(e,t))}e.forEach((e=>{var s,o;const r=e.options.position;let n=e.row;"opposite"===r?(n++,e._runPos=r):n<t-1&&"between"===r?(n++,e._runPos="normal"):e._runPos=r,null===(o=null===(s=i[n])||void 0===s?void 0:s[e.col])||void 0===o||o._axes.push(e)}))}}class h extends r{constructor(e){super(e,!1)}_doPrepare(e,t,s){const i=this._matrix=new Array(t);for(let e=0;e<i.length;e++){i[e]=[];for(let t=0;t<=s;t++)i[e].push(new o(e,t))}e.forEach((e=>{var t,o;const r=e.options.position;let n=e.col;"opposite"===r?(n++,e._runPos=r):e.col<s-1&&"between"===r?(n++,e._runPos="normal"):e._runPos=r,null===(o=null===(t=i[e.row])||void 0===t?void 0:t[n])||void 0===o||o._axes.push(e)}))}}class a extends t.Body{constructor(e){super(e.chart),this.pane=e}contains(e){return e.col===this.pane.col||e.row===this.pane.row}}a.defaults=t.extend(t.Body.defaults,{extended:!0,radius:void 0,centerX:void 0,centerY:void 0});class c extends t.Legend{constructor(e){super(e.chart),this.pane=e}_doPrepareRender(e){super._doPrepareRender(e),this._location="body"}_getLegendSources(){return this.options.visible?this.chart._getSeries().getLegendSources(this.pane.row,this.pane.col):[]}}class l extends t.ChartItem{constructor(e,t,s){super(e),this.row=t,this.col=s}_doInit(e){e.body=(this._body=new a(this)).init(),e.legend=(this._legend=new c(this)).init()}get body(){return this._body}get legend(){return this._legend}_prepareRender(){this._body._prepareRender(),this._legend._prepareRender()}}class _ extends t.ChartItem{constructor(e){super(e),this._cols=1,this._rows=1,this._paneDic={},this._panes=[],this._xAxes=new n(e),this._yAxes=new h(e)}get count(){return this._rows*this._cols}get rowCount(){return this._rows}get colCount(){return this._cols}get paneCount(){return this._rows*this._cols}colSizes(){return this._colSizes}rowSizes(){return this._rowSizes}getPane(e,t){return this._panes[e][t]}getRow(e){return this._panes[e]}getColumn(e){return this._panes.map((t=>t[e]))}getAxisOf(e,t){var s,i;const o=this.chart,r=e.body;if(r){const n=r.pane;return t?o._getXAxes().get(e.options.xAxis)||this._xAxes.get(n.row,n.col)._axes[0]||(null===(s=o._getSeries().getPaneSeries(n.row,n.col)[0])||void 0===s?void 0:s._xAxisObj):o._getXAxes().get(e.options.yAxis)||this._yAxes.get(r.pane.row,r.pane.col)._axes[0]||(null===(i=o._getSeries().getPaneSeries(n.row,n.col)[0])||void 0===i?void 0:i._yAxisObj)}}isValidAxis(e){return e&&e.row<this._rows&&e.col<this._cols}_doLoadProp(e,t){return["panes","cols","rows"].indexOf(e)>=0||super._doLoadProp(e,t)}_doSetSimple(e){if(t.isArray(e)&&e.length>0){const s=t.maxv(1,+e[0]),i=t.maxv(1,t.pickNum(+e[1],s));return s>0&&i>0&&(this.$_parsePanes(s,i),this.visible=!0),!0}return super._doSetSimple(e)}_load(e){return super._load(e),t.isObject(e)&&(this.$_parsePanes(e.rows,e.cols),this._paneDic=this.$_loadPanes(e.panes)),this}_doPrepareRender(e){this._panes=this.$_collectPanes(e),this._panes.forEach((e=>e.forEach((e=>e._prepareRender()))))}_calcSizes(e,s){const i=e.length,o=new Array(i);let r=0;if(i>1){let n=s,h=0;for(r=0;r<i;r++){const s=e[r];t.isNumber(s)?n-=o[r]=Math.max(0,Math.min(n,s)):h+=s.size}if(h>0)for(r=0;r<i;r++){const s=e[r];t.isNumber(s)||(o[r]=n*s.size/h)}}else o[r]=s;return o}getXLens(e){return this._calcSizes(this._colSizes,e)}getYLens(e){return this._calcSizes(this._rowSizes,e)}measureAxes(e,t,s,i){const o=this.getXLens(s?t:e),r=this.getYLens(s?e:t);this._xAxes._buildTicks(o,i),this._yAxes._buildTicks(r,i),this.$_calcAxesPoints(o,r,i)}$_calcAxesPoints(e,t,s){this._xAxes._calcPoints(e,s),this._yAxes._calcPoints(t,s)}completeAxesPoints(e,t){this.$_calcAxesPoints(e,t,101)}getBodyAnnotation(e){for(const t in this._paneDic){const s=this._paneDic[t].body.getAnnotation(e);if(s)return s}}prepareRender(e,t){const s=this.chart.isInverted();this._prepareRender(),this._xAxes._prepare(e,this._rows,this._cols,s),this._yAxes._prepare(t,this._rows,this._cols,s)}$_parseSizes(e){let s;return s=t.isArray(e)&&e.length>0?e.slice(0):e>0?new Array(e).fill("*"):["*"],s.map((e=>{if(t.isString(e)){const s=e.trim();return{size:"*"===s?1:t.pickNum(parseFloat(s),1)}}return t.pickNum(+e,1)}))}$_parsePanes(e,t){this._colSizes=this.$_parseSizes(t),this._rowSizes=this.$_parseSizes(e),this._cols=this._colSizes.length,this._rows=this._rowSizes.length}$_loadPanes(e){const s=this.chart,i=this._op.extendBody?s._body._config:void 0,o={};if(e=t.isArray(e)?e:t.isObject(e)?[e]:null,t.isArray(e)&&e.forEach((e=>{const t=+e.row||0,r=+e.col||0;if(r>=0&&r<this._cols&&t>=0&&t<this._rows){const n=new l(s,t,r);let h=e;n.init(),!i||e&&e.body&&!1===e.body.extended||(e?(h=Object.assign({},e),e.body?!1!==e.body.extended&&(h.body=Object.assign({},i,e.body)):h.body=i):h={body:i}),n._load(h),o[t+","+r]=n}})),i)for(let e=0;e<this._rows;e++)for(let t=0;t<this._cols;t++){const r=e+","+t;if(!o[r]){const n=new l(s,e,t);n.init(),n._load({body:i}),o[r]=n}}return o}$_collectPanes(e){const t=[];for(let s=0;s<this._rows;s++){const i=[];for(let t=0;t<this._cols;t++){const o=this._paneDic[s+","+t]||new l(e,s,t)._initObject();i.push(o)}t.push(i)}return t}}_.defaults=t.extend(t.ChartItem.defaults,{visible:!1,extendBody:!0,gap:0});class d extends t.SectionView{constructor(){super(...arguments),this.views=[],this._gap=0}isEmpty(){return 0===this.views.length}prepare(e,s,i,o){const r=this.views,n=[];for(this.isX=i,o._axes.forEach((e=>{e.checkVisible()&&s.isValidAxis(e)&&n.push(e)}));r.length<n.length;){const s=new t.AxisView(e);this.add(s),r.push(s)}for(;r.length>n.length;)r.pop().remove();if(r.forEach(((e,t)=>{e.setModel(n[t])})),this.axes=n,this.setVis(r.length>0)){const e=r[0].model;this._gap=e.chart.getAxesGap()}}prepareGuides(e,t,s){const i=this.views,o=this.axes;i.forEach(((s,i)=>{const r=o[i];t.forEach((t=>{t.forEach((t=>{t.isConnected(r)&&s.setVis(this.visible)&&(s.prepareGuides(e,t.row,t.col,t._guideContainer,t._frontGuideContainer),r._isHorz||(t._axes||(t._axes=[]),t._axes.push(r)))}))}))})),t.forEach((t=>{t.forEach((t=>{t._axes&&(t._gridRowContainer.addAll(e,t._axes),t._axes=[])}))}))}checkHeights(e,t,s){return this.views.length>0?this.$_checkHeights(this.views,e,t,s):0}$_checkHeights(e,t,s,i){let o=0;return e&&(e.forEach((e=>{o+=e.checkHeight(t,s,i)})),o+=(this.views.length-1)*this._gap),o}checkWidths(e,t,s){return this.views.length>0?this.$_checkWidths(this.views,e,t,s):0}$_checkWidths(e,t,s,i){let o=0;return e&&(e.forEach((e=>{o+=e.checkWidth(t,s,i)})),o+=(this.views.length-1)*this._gap),o}getScrollView(e){var t;for(const s of this.views)if(null===(t=s._scrollView)||void 0===t?void 0:t.contains(e))return s._scrollView}setMargins(e,t,s,i){this.views.forEach((o=>o.setMargins(e,t,s,i)))}_setInverted(e){super._setInverted(e),this.isHorz=e&&!this.isX||!e&&this.isX}_doMeasure(e,t,s,i,o){const r=this.axes;if(this.isHorz){let t=0;return this.views.forEach(((n,h)=>{t+=n.measure(e,r[h],s,i,o).height})),{width:s,height:t}}{let t=0;return this.views.forEach(((n,h)=>{t+=n.measure(e,r[h],s,i,o).width})),{width:t,height:i}}}_doLayout(e){const t=this.views,s=this.width,i=this.height,o=t.length;let r=0,n=o-1;if(this.isHorz){let e,h,a=0;for(;r<o;r++){const e=t[r];if(e.model._posValue()<1)break;e.trans(0,a),a+=e.mh}for(e=a,a=i;n>=0;n--){const e=t[n];if(e.model._posValue()>-1)break;a-=e.mh,e.trans(0,a)}h=a;const c=h-e;let l=0;for(let e=r;e<=n;e++)l+=t[e].mh;e+=(c-l)/2;for(let s=r;s<=n;s++){const i=t[s];i.trans(0,e),e+=i.mh}t.forEach((e=>{e.resize(s,e.mh),e.model._calcPoints(s,999),e.layout()}))}else{let e,h,a=0;for(;r<o;r++){const e=t[r];if(e.model._posValue()>-1)break;e.trans(a,0),a+=e.mw}for(e=a,a=s;n>=0;n--){const e=t[n];if(e.model._posValue()<1)break;a-=e.mw,e.trans(a,0)}h=a;const c=h-e;let l=0;for(let e=r;e<=n;e++)l+=t[e].mw;e+=(c-l)/2;for(let s=r;s<=n;s++){const i=t[s];i.trans(e,0),e+=i.mw}t.forEach((e=>{e.resize(e.mw,i),e.model._calcPoints(i,999),e.layout()}))}}}class u extends t.SectionView{constructor(e,t){super(e,"rct-axis-container"),this.isX=t,this.sections=[]}prepare(e,t,s,i,o){const r=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<r.length;){const t=new d(e);this.add(t),this.sections.push(t)}for(;this.sections.length>r.length;)this.sections.pop().remove();this.sections.forEach(((s,o)=>{this.isX?(s.row=i,s.col=o):(s.col=i,s.row=o),s.prepare(e,t,this.isX,r[o])})),this._setInverted(o)}prepareGuides(e,t,s,i){const o=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<o.length;){const t=new d(e);this.add(t),this.sections.push(t)}for(;this.sections.length>o.length;)this.sections.pop().remove();this.sections.forEach(((o,r)=>{this.isX?(o.row=i,o.col=r):(o.col=i,o.row=r),o.prepareGuides(e,t,s)}))}checkWidths(e,t,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,o)=>i+o.checkWidths(e,t,s)),0):this.sections.reduce(((i,o)=>Math.max(i,o.checkWidths(e,t,s))),0):0}checkHeights(e,t,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,o)=>Math.max(i,o.checkHeights(e,t,s))),0):this.sections.reduce(((i,o)=>i+o.checkHeights(e,t,s)),0):0}_setInverted(e){super._setInverted(e),this._isHorz=e&&!this.isX||!e&&this.isX}_doMeasure(e,s,i,o,r){let n=0,h=0;return this._isHorz?this.sections.forEach((n=>{h=t.maxv(h,n.measure(e,s,i,o,r).height)})):this.sections.forEach((h=>{n=t.maxv(n,h.measure(e,s,i,o,r).width)})),{width:n,height:h}}_doLayout(e){this._isHorz?this.height>0&&this.sections.forEach(((t,s)=>{t.resize(e[2*(s+1)]-e[2*(s+1)-1],this.height),t.trans(e[2*s+1]-e[1],0),t.layout()})):this.width>0&&this.sections.forEach(((t,s)=>{t.resize(this.width,e[2*(s+1)]-e[2*(s+1)-1]),t.trans(0,this.height-(e[2*(s+1)]-e[1])),t.layout()}))}}class p extends t.BodyView{constructor(e,s){super(e,s),this.row=0,this.col=0,this.add(this._legendView=new t.LegendView(e))}getCol(){return this.col}getRow(){return this.row}getTooltipPos(){return{x:this.parent.parent.tx+this.tx,y:this.parent.parent.ty+this.ty}}prepareRender(e,s){const i=s.chart,o=s.depth.visible,r=this.row,n=this.col,h=i._split.getPane(r,n).body;this._animatable=t.RcControl._animatable&&i.animatable(),this._prepareSeries(e,s,i._getSeries().getPaneSeries(r,n),o),this._prepareGauges(e,i,i._getGauges().getPaneVisibles(r,n)),this._prepareAnnotations(e,h.getAnnotations().concat(i._getAnnotations().getPaneVisibles(r,n)))}_doMeasure(e,t,s,i,o){return this._legendView.setVis(t.pane.legend.visible)&&this._legendView.measure(e,t.pane.legend,s,i,o),super._doMeasure(e,t,s,i,o)}_doLayout(){super._doLayout();const e=this._legendView;if(e.visible){this._seriesViews.forEach((t=>{if(t.needDecoreateLegend()){const s=e.legendOfSeries(t.model);s&&t.decoreateLegend(s)}}));const t=e.model.options,s=t.align,i=t.verticalAlign;let o=0,r=0,n=+t.offsetX||0;switch(s){case"right":o+=this.width-e.mw-n;break;case"center":o+=(this.width-e.mw)/2+n;break;default:o+=n}switch(n=+t.offsetY||0,i){case"bottom":r+=this.height-e.mh-n;break;case"middle":r+=(this.height-e.mh)/2+n;break;default:r+=n}e.trans(o,r).resize(e.mw,e.mh),e.layout()}}}class g extends t.PaneContainer{constructor(e,t){super(e,g.STYLE_NAME),this._bodies=[],this._xContainers=[],this._yContainers=[],this._owner=t}get bodies(){return this._bodies}bodyViewOf(e){return this._bodies.find((t=>t.contains(e)))}prepare(e,t){t.chart,this.$_init(e),this._model=t,this.$_prepareBodies(e,t)}measure(e,t,s,i,o){const r=t.chart,n=this._inverted=t.chart.isInverted(),h=t._xAxes,a=t._yAxes,c=s,l=i;this.$_prepareAxes(e,h,!0,n),this.$_prepareAxes(e,a,!1,n),t.measureAxes(s,i,n,o),n?(s-=this._xContainers.reduce(((t,o)=>t+o.checkWidths(e,s,i)),0),i-=this._yContainers.reduce(((t,o)=>t+o.checkHeights(e,s,i)),0)):(i-=this._xContainers.reduce(((t,o)=>t+o.checkHeights(e,s,i)),0),s-=this._yContainers.reduce(((t,o)=>t+o.checkWidths(e,s,i)),0)),t.measureAxes(s,i,n,o),this._xContainers.forEach((t=>t.measure(e,r,s,i,o))),this._yContainers.forEach((t=>t.measure(e,r,s,i,o))),s=c,i=l,n?(s-=this._xContainers.reduce(((e,t)=>e+t.mw),0),i-=this._yContainers.reduce(((e,t)=>e+t.mh),0)):(i-=this._xContainers.reduce(((e,t)=>e+t.mh),0),s-=this._yContainers.reduce(((e,t)=>e+t.mw),0)),o++,t.measureAxes(s,i,n,o),this.$_prepareAxisGuides(e,h,!0),this.$_prepareAxisGuides(e,a,!1),this._xContainers.forEach((t=>{t.measure(e,r,s,i,o)})),this._yContainers.forEach((t=>{t.measure(e,r,s,i,o)}));const _=t.getXLens(n?i:s),d=t.getYLens(n?s:i);t.completeAxesPoints(_,d)}layout(){const e=this._model,t=this.width,s=this.height;this._back.resize(t,s),this.$_calcExtents(e,t,s),this.$_layoutAxes(e,!0,t,s),this.$_layoutAxes(e,!1,t,s),this.$_layoutBodies(e,t,s)}seriesByDom(e){for(const t of this._bodies){const s=t.seriesByDom(e);if(s)return s}}getSeries(e){for(const t of this.bodies){const s=t.findSeries(e);if(s)return s}}legendByDom(e){for(const t of this.bodies){const s=t._legendView.legendByDom(e);if(s)return s}}$_init(e){this._back||(this.add(this._back=new t.RectElement(e)),this._back.setStyles({fill:"none"}),this.add(this._bodyContainer=new t.LayerElement(e,void 0)),this.add(this._axisContainer=new t.LayerElement(e,void 0)))}$_prepareBodies(e,t){t.chart;const s=t.paneCount,i=t.rowCount,o=t.colCount,r=this._bodies,n=this._bodyMap=[];for(;r.length<s;){const t=new p(e,this._owner);this._bodyContainer.add(t),r.push(t)}for(;r.length>s;)r.pop().remove();for(let e=0;e<i;e++){const t=[];for(let s=0;s<o;s++){const i=r[e*o+s];t.push(i),i.row=e,i.col=s}n.push(t)}r.forEach((s=>{s.prepareRender(e,t.getPane(s.row,s.col).body),s.prepareGuideContainers(),s._gridRowContainer.prepare()}))}$_prepareAxes(e,t,s,i){const o=this._model.chart,r=s?this._xContainers:this._yContainers,n=s?t.rows():t.cols();for(;r.length<n;){const t=new u(e,s);this._axisContainer.add(t),r.push(t)}for(;r.length>n;)r.pop().remove();r.forEach(((s,r)=>{s.prepare(e,o,t,r,i)}))}$_prepareAxisGuides(e,t,s){(s?this._xContainers:this._yContainers).forEach(((s,i)=>{s.prepareGuides(e,this._bodyMap,t,i)}))}$_calc(e,t,s,i){const o=s.length,r=new Array(2*(o+1)),n=t-e.reduce(((e,t)=>e+t[i]),0),h=this._model._calcSizes(s,n);let a=0,c=0;for(c=0;c<o;c++)r[2*c]=a,r[2*c+1]=a+=e[c][i],a+=h[c];return r[2*c]=a,r[2*c+1]=a+e[c][i],r}$_calcExtents(e,t,s){this._inverted?(this._rowPoints=this.$_calc(this._xContainers,t,e.rowSizes(),"mw"),this._colPoints=this.$_calc(this._yContainers,s,e.colSizes(),"mh")):(this._rowPoints=this.$_calc(this._xContainers,s,e.rowSizes(),"mh"),this._colPoints=this.$_calc(this._yContainers,t,e.colSizes(),"mw"))}$_layoutAxes(e,t,s,i){const o=this.control._padding,r=this._rowPoints,n=this._colPoints,h=t?this._xContainers:this._yContainers;if(this._inverted)if(t){const e=n[1],t=n[n.length-2]-e;h.forEach(((e,s)=>{e.resize(e.mw,t),e.trans(r[2*s],i-n[n.length-2]),e.layout(n)}))}else{const e=r[1],t=r[r.length-2]-e;h.forEach(((s,h)=>{const a=s.sections;for(let e=0,t=a.length;e<t;e++){const s=a[e],i=0===e?o.left:0,n=e===t-1?o.right:0;let h=0,c=0;t>1&&(h=r[2*e+1]-r[2*e],c=r[2*(e+1)+1]-r[2*(e+1)],0===e?a[e+1].isEmpty()?c=r[2*(e+1)]-r[2*(e+1)-1]:c/=2:e===t-1?a[e-1].isEmpty()?h=r[2*(e-1)]-r[2*(e-1)-1]:h/=2:(a[e-1].isEmpty()?h=r[2*(e-1)]-r[2*(e-1)-1]:h/=2,a[e+1].isEmpty()?c=r[2*(e+1)]-r[2*(e+1)-1]:c/=2)),s.setMargins(i,h,c,n)}s.resize(t,s.mh),s.trans(e,i-n[2*h+1]),s.layout(r)}))}else if(t){const e=n[1];s=n[n.length-2]-e,h.forEach(((t,a)=>{const c=t.sections;for(let e=0,t=c.length;e<t;e++){const s=c[e],i=0===a?o.left:0,l=a===h.length-1?o.right:0;let _=0,d=0;t>1&&(_=n[2*e+1]-n[2*e],d=n[2*(e+1)+1]-n[2*(e+1)],0===e?c[e+1].isEmpty()?d=n[2*(e+1)]-n[2*(e+1)-1]:d/=2:e===t-1?c[e-1].isEmpty()?_=n[2*(e-1)]-n[2*(e-1)-1]:_/=2:(c[e-1].isEmpty()?_=n[2*(e-1)]-n[2*(e-1)-1]:_/=2,c[e+1].isEmpty()?d=n[2*(e+1)]-r[2*(e+1)-1]:d/=2)),s.setMargins(i,_,d,l)}t.resize(s,t.mh),t.trans(e,i-r[2*a+1]),t.layout(n)}))}else{const e=r[r.length-2],t=e-r[1];h.forEach(((s,o)=>{s.resize(s.mw,t),s.trans(n[2*o],i-e),s.layout(r)}))}}$_layoutBodies(e,t,s){const i=e.rowCount,o=e.colCount,r=this._rowPoints,n=this._colPoints,h=this._bodies;if(this._inverted)for(let t=0;t<i;t++){const s=r[2*(t+1)-1],i=r[2*(t+1)];for(let r=0;r<o;r++){const a=h[t*o+r],c=n[2*r+1],l=n[2*(r+1)];a.measure(this.doc,e.getPane(t,r).body,i-s,l-c,1),a.resize(i-s,l-c),a.trans(s,this.height-l),a.layout()}}else for(let t=0;t<i;t++){const i=r[2*(t+1)-1],a=r[2*(t+1)];for(let r=0;r<o;r++){const c=h[t*o+r],l=n[2*(r+1)-1],_=n[2*(r+1)];c.measure(this.doc,e.getPane(t,r).body,_-l,a-i,1),c.resize(_-l,a-i),c.trans(l,s-a),c.layout()}}}}function f(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.ChartObject.registerSplitClass(_),e.ChartView.registerPaneClass(g))}g.STYLE_NAME="rct-panes",f(i),e.Split=_,e.default=f,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/split.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealChart Split v1.4.
|
|
3
|
+
* RealChart Split v1.4.8
|
|
4
4
|
* Copyright (C) 2023-2025 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
|
-
import{extend as t,Body as e,ChartItem as s,isArray as i,maxv as r,pickNum as n,isObject as o,isNumber as h,isString as a,Legend as l,PaneContainer as d,RectElement as c,LayerElement as _,SectionView as u,BodyView as p,RcControl as g,AxisView as m}from"./index.mjs";class f{constructor(t,e){this.row=t,this.col=e,this._axes=[]}sort(t,e){const s=e&&!t||!e&&t;this._axes.length>1&&(s?this._axes.sort(((t,e)=>{const s=t._posValue(),i=e._posValue();return s===i?s<0?e._index-t._index:s>0?t._index-e._index:t.row!==e.row?e.row-t.row:t.row<this.row?e._index-t._index:t._index-e._index:i-s})):this._axes.sort(((t,e)=>{const s=t._posValue(),i=e._posValue();return s===i?s<0?t._index-e._index:s>0?e._index-t._index:t.col!==e.col?t.col-t.col:t.col<this.col?t._index-e._index:e._index-t._index:s-i})))}}class y{constructor(t,e){this.chart=t,this.isX=e}rows(){return this._matrix.length}cols(){return this._matrix[0].length}_prepare(t,e,s,i){this._doPrepare(t,e,s),this._matrix.forEach((t=>{t.forEach((t=>t.sort(this.isX,i)))}))}get(t,e){return this._matrix[t][e]}getRow(t){return this._matrix[t]}getColumn(t){return this._matrix.map((e=>e[t]))}_buildTicks(t,e){const s=this.isX;this._matrix.forEach(((i,r)=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{!i.isBased()&&(e<2||s)&&i._buildTicks(t[s?i.options.col:i.options.row],e)}))}))})),this._matrix.forEach(((i,r)=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{i.isBased()&&(e<2||s)&&i._buildTicks(t[s?i.options.col:i.options.row],e)}))}))}))}_calcPoints(t,e){const s=this.isX;this._matrix.forEach((i=>{i.forEach(((i,r)=>{i._axes.forEach((i=>{if(e<2||s){const r=s?i.options.col:i.options.row;i._calcPoints(t[r],e)}}))}))}))}}class w extends y{constructor(t){super(t,!0)}_doPrepare(t,e,s){const i=this._matrix=new Array(e+1);for(let t=0;t<i.length;t++){i[t]=[];for(let e=0;e<s;e++)i[t].push(new f(t,e))}t.forEach((t=>{var s,r;const n=t.options.position;let o=t.row;"opposite"===n?(o++,t._runPos=n):o<e-1&&"between"===n?(o++,t._runPos="normal"):t._runPos=n,null===(r=null===(s=i[o])||void 0===s?void 0:s[t.col])||void 0===r||r._axes.push(t)}))}}class v extends y{constructor(t){super(t,!1)}_doPrepare(t,e,s){const i=this._matrix=new Array(e);for(let t=0;t<i.length;t++){i[t]=[];for(let e=0;e<=s;e++)i[t].push(new f(t,e))}t.forEach((t=>{var e,r;const n=t.options.position;let o=t.col;"opposite"===n?(o++,t._runPos=n):t.col<s-1&&"between"===n?(o++,t._runPos="normal"):t._runPos=n,null===(r=null===(e=i[t.row])||void 0===e?void 0:e[o])||void 0===r||r._axes.push(t)}))}}class b extends e{constructor(t){super(t.chart),this.pane=t}contains(t){return t.col===this.pane.col||t.row===this.pane.row}}b.defaults=t(e.defaults,{extended:!0,radius:void 0,centerX:void 0,centerY:void 0});class x extends l{constructor(t){super(t.chart),this.pane=t}_doPrepareRender(t){super._doPrepareRender(t),this._location="body"}_getLegendSources(){return this.options.visible?this.chart._getSeries().getLegendSources(this.pane.row,this.pane.col):[]}}class A extends s{constructor(t,e,s){super(t),this.row=e,this.col=s}_doInit(t){t.body=(this._body=new b(this)).init(),t.legend=(this._legend=new x(this)).init()}get body(){return this._body}get legend(){return this._legend}_prepareRender(){this._body._prepareRender(),this._legend._prepareRender()}}class E extends s{constructor(t){super(t),this._cols=1,this._rows=1,this._paneDic={},this._panes=[],this._xAxes=new w(t),this._yAxes=new v(t)}get count(){return this._rows*this._cols}get rowCount(){return this._rows}get colCount(){return this._cols}get paneCount(){return this._rows*this._cols}colSizes(){return this._colSizes}rowSizes(){return this._rowSizes}getPane(t,e){return this._panes[t][e]}getRow(t){return this._panes[t]}getColumn(t){return this._panes.map((e=>e[t]))}getAxisOf(t,e){var s,i;const r=this.chart,n=t.body;if(n){const o=n.pane;return e?r._getXAxes().get(t.options.xAxis)||this._xAxes.get(o.row,o.col)._axes[0]||(null===(s=r._getSeries().getPaneSeries(o.row,o.col)[0])||void 0===s?void 0:s._xAxisObj):r._getXAxes().get(t.options.yAxis)||this._yAxes.get(n.pane.row,n.pane.col)._axes[0]||(null===(i=r._getSeries().getPaneSeries(o.row,o.col)[0])||void 0===i?void 0:i._yAxisObj)}}isValidAxis(t){return t&&t.row<this._rows&&t.col<this._cols}_doLoadProp(t,e){return["panes","cols","rows"].indexOf(t)>=0||super._doLoadProp(t,e)}_doSetSimple(t){if(i(t)&&t.length>0){const e=r(1,+t[0]),s=r(1,n(+t[1],e));return e>0&&s>0&&(this.$_parsePanes(e,s),this.visible=!0),!0}return super._doSetSimple(t)}_load(t){return super._load(t),o(t)&&(this.$_parsePanes(t.rows,t.cols),this._paneDic=this.$_loadPanes(t.panes)),this}_doPrepareRender(t){this._panes=this.$_collectPanes(t),this._panes.forEach((t=>t.forEach((t=>t._prepareRender()))))}_calcSizes(t,e){const s=t.length,i=new Array(s);let r=0;if(s>1){let n=e,o=0;for(r=0;r<s;r++){const e=t[r];h(e)?n-=i[r]=Math.max(0,Math.min(n,e)):o+=e.size}if(o>0)for(r=0;r<s;r++){const e=t[r];h(e)||(i[r]=n*e.size/o)}}else i[r]=e;return i}getXLens(t){return this._calcSizes(this._colSizes,t)}getYLens(t){return this._calcSizes(this._rowSizes,t)}measureAxes(t,e,s,i){const r=this.getXLens(s?e:t),n=this.getYLens(s?t:e);this._xAxes._buildTicks(r,i),this._yAxes._buildTicks(n,i),this.$_calcAxesPoints(r,n,i)}$_calcAxesPoints(t,e,s){this._xAxes._calcPoints(t,s),this._yAxes._calcPoints(e,s)}completeAxesPoints(t,e){this.$_calcAxesPoints(t,e,101)}getBodyAnnotation(t){for(const e in this._paneDic){const s=this._paneDic[e].body.getAnnotation(t);if(s)return s}}prepareRender(t,e){const s=this.chart.isInverted();this._prepareRender(),this._xAxes._prepare(t,this._rows,this._cols,s),this._yAxes._prepare(e,this._rows,this._cols,s)}$_parseSizes(t){let e;return e=i(t)&&t.length>0?t.slice(0):t>0?new Array(t).fill("*"):["*"],e.map((t=>{if(a(t)){const e=t.trim();return{size:"*"===e?1:n(parseFloat(e),1)}}return n(+t,1)}))}$_parsePanes(t,e){this._colSizes=this.$_parseSizes(e),this._rowSizes=this.$_parseSizes(t),this._cols=this._colSizes.length,this._rows=this._rowSizes.length}$_loadPanes(t){const e=this.chart,s=this._op.extendBody?e._body._config:void 0,r={};if(t=i(t)?t:o(t)?[t]:null,i(t)&&t.forEach((t=>{const i=+t.row||0,n=+t.col||0;if(n>=0&&n<this._cols&&i>=0&&i<this._rows){const o=new A(e,i,n);let h=t;o.init(),!s||t&&t.body&&!1===t.body.extended||(t?(h=Object.assign({},t),t.body?!1!==t.body.extended&&(h.body=Object.assign({},s,t.body)):h.body=s):h={body:s}),o._load(h),r[i+","+n]=o}})),s)for(let t=0;t<this._rows;t++)for(let i=0;i<this._cols;i++){const n=t+","+i;if(!r[n]){const o=new A(e,t,i);o.init(),o._load({body:s}),r[n]=o}}return r}$_collectPanes(t){const e=[];for(let s=0;s<this._rows;s++){const i=[];for(let e=0;e<this._cols;e++){const r=this._paneDic[s+","+e]||new A(t,s,e)._initObject();i.push(r)}e.push(i)}return e}}E.defaults=t(s.defaults,{visible:!1,extendBody:!0,gap:0});const S="http://www.w3.org/2000/svg",C=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},N=Array.isArray,k=function(t){return"string"==typeof t},D=Object.assign,L=Math.min,T=Math.max,B=Math.abs,M=function(t,e){return t=parseFloat(t),isNaN(t)?parseFloat(e):t};let $=0;class R{static destroy(t){return t&&t.destroy()}constructor(t){this.$_destroyed=!1,this.$_destroying=!1,t||(this.$_hash=String($++))}destroy(){return this.$_destroyed||this.$_destroying||(this.$_destroying=!0,this._doDestroy(),this.$_destroyed=!0),null}_doDestroy(){}get destroying(){return this.$_destroying}get orphaned(){return this.$_destroying||this.$_destroyed}get hash(){return this.$_hash}isMe(t){return t===this.$_hash}toString(){return this.constructor.name}toBool(t){return"string"==typeof t?"true"===t:t}toNum(t,e=NaN){return t=parseFloat(t),isNaN(t)?e:t}}class P extends R{constructor(t,e,s,i=0){super(),this.removeDelay=0,this._pool=[],this._views=[],this._removes=[],this._owner=t,this._creator=e,this._styleName=s,this.removeDelay=i}_doDestroy(){this.freeAll(),this._owner=null,this._creator=null,super._doDestroy()}get isEmpty(){return 0===this._views.length}get count(){return this._views.length}get first(){return this._views[0]}get last(){return this._views[this._views.length-1]}get(t){return this._views[t]}getAll(){return this._views.slice()}pull(t){let e=this._views[t];return e||(e=this._pool.pop()||new this._creator(this._owner.doc,this._styleName),this._owner.add(e),this._views.push(e)),e}_internalItems(){return this._views}elementOf(t){for(let e of this._views)if(e.contains(t))return e}find(t){return this._views.find(t)}setRemoveDelay(t){return this.removeDelay=t,this}removeLater(t,e){const s=this._views.indexOf(t);s>=0&&(t.removeLater(e,(t=>{this._pool.push(t)})),this._views.splice(s,1))}$_create(t,e=-1,s=0){let i=this._pool.pop();return i||(i=new this._creator(t,this._styleName)),i}prepare(t,e,s){const i=this._owner.doc,r=this._owner,n=this._pool,o=this._views;for(;o.length>t;)n.push(o.pop().remove());for(;o.length<t;){const e=this.$_create(i);o.push(e),null==s||s(e,o.length-1,t),r.add(e)}return e&&this.forEach(e),this}borrow(){const t=this._pool.pop()||new this._creator(this._owner.doc,this._styleName);return this._owner.add(t),t}free(t,e=0){if(t){e>0?t.removeLater(e):t.remove(),this._pool.push(t);const s=this._views.indexOf(t);s>=0&&this._views.splice(s,1)}}freeAll(t,e=0){for(let s=(t=t||this._views).length-1;s>=0;s--)this.free(t[s],e)}freeHiddens(){const t=this._views;for(let e=t.length-1;e>=0;e--)!t[e].visible&&this.free(t[e],0)}freeFrom(t){const e=this._views;for(let s=e.length-1;s>=t;s--)this.free(e[s],0)}forEach(t){const e=this._views;for(let s=0,i=e.length;s<i;s++)t(e[s],s,i)}visit(t){const e=this._views.length;let s=0;for(;s<e&&!1!==t(this._views[s],s,e);s++);return s===e}sort(t){const e=this._views;return e.sort(t),e.forEach((t=>this._owner.appendDom(t.dom))),this}sortDom(t){const e=this._views.slice(0);return e.sort(t),e.forEach((t=>this._owner.appendDom(t.dom))),this}map(t){return this._views.map(t)}front(t){t.front(this._views)}back(t){t.back(this._views)}}const z=Object.freeze({x:0,y:0,width:0,height:0});const O={ko:{dateFormat:"yyyy.MM.dd",am:"오전",pm:"오후",notExistsDataField:"존재하지 않는 필드입니다: %1",notSpecifiedDataField:"하나 이상의 데이터필드가 설정돼야 합니다.",invalidFieldName:"잘못된 데이터필드 이름입니다: %1",invalidRowIndex:"잘못된 데이터행 index입니다: %1",invalidToIndex:"잘못된 'to' index입니다.: %1",requireSourceData:"원본 data가 반드시 지정돼야 합니다.",requireFilterName:"필터 이름이 반드시 지정돼야 합니다.",invalidDateFormat:"잘못된 시간 날짜 형식입니다: %1",invalidSizeValue:"잘못된 Size 값입니다: %1",invalidOuterDiv:"잘못된 외부 div 입니다: %1",dataMustSet:"데이터가 먼저 설정돼야 합니다.",requireTableName:"테이블모델의 이름이 지정돼야 합니다.",alreadyTableExists:"이미 존재하는 테이블모델입니다: %1"},en:{dateFormat:"M/d/yyyy",am:"AM",pm:"PM",notExistsDataField:"A data field is not exists: %1",notSpecifiedDataField:"At least one datafield must be set.",invalidFieldName:"Invalid field name: %1",invalidRowIndex:"Invalid row index: %1",invalidToIndex:"Invalid 'to' index: %1",requireSourceData:"A source data must be set.",requireFilterName:"A filter name must be set.",invalidDateFormat:"Invalid datetime format: %1",invalidSizeValue:"Invalid size value: %1",invalidOuterDiv:"Invalid outer div element: %1",dataMustSet:"A data must be set first.",requireTableName:"The name of table model is required.",alreadyTableExists:"A table model is already exists: %1"}};let H="ko",V=O[H]||O[H="ko"];const I=void 0;function F(t){return t+"px"}function G(t){return null==t||Number.isNaN(t)||""===t}const Y={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",fontStyle:"font-style",padding:"padding",margin:"margin"},X=function(t){const e=Y[t];if(!e){let e=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return Y[t]=e,e}return e};class W{static clearChildren(t){let e;for(;e=t.lastChild;)t.removeChild(e)}static remove(t){const e=t&&t.parentElement;return e&&e.removeChild(t),null}static htmlEncode(t){return document.createElement("a").appendChild(document.createTextNode(t)).parentNode.innerHTML}static setAttrs(t,e){for(const s in e)t.setAttribute(s,e[s])}static setImportantStyle(t,e,s){t.setProperty(e,s,"important")}static getPadding(t){const e=getComputedStyle(t);return{left:parseFloat(e.paddingLeft)||0,right:parseFloat(e.paddingRight)||0,top:parseFloat(e.paddingTop)||0,bottom:parseFloat(e.paddingBottom)||0}}static hasFill(t){const e=window.getComputedStyle(t).fill;return e&&"none"!==e}static setVisible(t,e,s=""){return t.style.display=e?s:"none",e}static setClipPath(t,e){t.setAttribute("clip-path",`url(#${e instanceof SVGClipPathElement?e.id:e})`)}static createClipRect(t,e){const s=t.createElementNS(S,"clipPath");return s.id=e,s.append(t.createElementNS(S,"rect")),s}static setRect(t,e){return this.setBounds(t,e.x,e.y,e.width,e.height)}static setBounds(t,e,s,i,r){return t.setAttribute("x",e),t.setAttribute("y",s),t.setAttribute("width",i),t.setAttribute("height",r),t}}const j=(new Date).getTime();"undefined"==typeof window||Element.prototype.animate||(Element.prototype.animate=function(t){});class q{static log(...t){this.LOGGING&&console.log(...t)}static warn(...t){this.LOGGING&&console.warn(...t)}static now(){return+new Date}static parseDate(t,e){const s=new Date(t);return isNaN(s.getTime())?e||new Date:s}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static dateOfYear(t){var e=t.getMonth(),s=t.getDate(),i=[0,31,59,90,120,151,181,212,243,273,304,334][e]+s;return e>1&&q.isLeapYear(t.getFullYear())&&i++,i}static incMonth(t,e){const s=t.getDate();return t.setDate(1),t.setMonth(t.getMonth()+e),t.setDate(L(s,q.month_days[q.isLeapYear(t.getFullYear())?1:0][t.getMonth()])),t}static minDate(t,e){return null!==t?t:null!==e?e:t.getTime()<e.getTime()?t:e}static maxDate(t,e){return null!==t?e:null!==e||t.getTime()>e.getTime()?t:e}static weekOfMonth(t,e,s){const i=t.getMonth(),r=t.getFullYear(),n=new Date(r,i,1).getDay(),o=new Date(r,i+1,0).getDate(),h=t.getDate()+n-1,a=e+Math.ceil((o+n-7)/7),l=e+Math.floor(h/7);return s||l<2+e?l:l===a?e+5:l}static weekOfYear(t,e){const s=t.getFullYear(),i=new Date(s,0,1).getDay(),r=this.dateOfYear(t)+i-1;return e+Math.floor(r/7)}static isObject(t){return t&&"object"==typeof t&&!N(t)}static isValidObject(t){if(this.isObject(t))for(let e in t)if(t.hasOwnProperty(e))return!0}static copyObject(t){if(t&&"object"==typeof t&&!N(t))return D({},t)}static checkArray(t){return N(t)?t:void 0}static makeArray(t,e=!1){return null!=t?N(t)?t:[t]:e?[]:void 0}static makeNumArray(t){return N(t)?t.map((t=>+t)):null!=t?[+t]:[]}static getIntArray(t,e=0){const s=[];for(let i=e,r=e+t;i<r;i++)s.push(i);return s}static isValueArray(t){if(N(t)){for(let e=t.length-1;e>=0;e--)if(null!=t[e]&&"object"==typeof t[e])return!1;return!0}return!1}static toArray(t){return N(t)?t:null!=t?[t]:null}static copyArray(t){return N(t)?t.slice(0):null!=t?[t]:void 0}static push(t,e){if(e&&e.length>0)for(let s=0,i=e.length;s<i;s++)t.push(e[s])}static isDefined(t){return null!=t}static isNotDefined(t){return null==t}static isNumber(t){return"number"==typeof t}static canNumber(t){return!isNaN(t)&&!isNaN(parseFloat(t))}static isValidNum(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}static getNumber(t,e=0){const s=parseFloat(t);return isFinite(s)?s:e}static toNumber(t,e=0){return isNaN(t)||null===t||""===t?e:+t}static compareText(t,e,s=!1){return t=t||"",e=e||"",s&&(t=t.toLocaleLowerCase(),e=e.toLocaleLowerCase()),t>e?1:t<e?-1:0}static getTimeF(){return(new Date).getTime()/1e3}static getTimer(){return(new Date).getTime()-j}static isWhiteSpace(t){return!t||!t.trim()}static pad(t,e,s){return e=T(e||2,1),s=s||"0",new Array(e-String(t).length+1).join(s)+t}static pad16(t,e,s){return e=T(e||2,1),s=s||"0",new Array(e-t.toString(16).length+1).join(s)+t.toString(16)}static pick(...t){const e=t.length;let s;for(let i=0;i<e;i++)if(s=t[i],null!=s)return s}static toStr(t){return Number.isNaN(t)||null==t?"":String(t)}static equalNumbers(t,e){return isNaN(t)==isNaN(e)&&!isNaN(t)&&t==e}static equalArrays(t,e){if(t===e)return!0;if(null==t||null==e)return!1;const s=t.length;if(s!=e.length)return!1;for(let i=0;i<s;++i)if(t[i]!==e[i])return!1;return!0}static parseTuples(t){if(N(t)){const e=[];let s=-1/0;return t.forEach(((i,r)=>{N(i)?!isNaN(i[0])&&!isNaN(i[1])&&i[0]>s&&(e.push([+i[0],+i[1]]),s=i[0]):isNaN(i)||r!==t.length-1||e.push([1/0,+i])})),e.length>0?e:void 0}if(!isNaN(t))return[[1/0,+t]]}static isEmpty(t){if(t)for(let e in t)return!1;return!0}static isNotEmpty(t){if(t)for(let e in t)return!0;return!1}static setter(t){return"set"+t[0].toUpperCase()+t.slice(1)}static deepClone(t){if(t instanceof Date)return new Date(t);if(null==t||"object"!=typeof t)return t;{const e=N(t)?[]:{};for(let s of Object.keys(t))e[s]=q.deepClone(t[s]);return e}}static getArray(t,e){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static getNumArray(t,e=0){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static dedupe(t,e){for(let s=(t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0))).length-1;s>0;s--)t[s]===t[s-1]&&t.splice(s,1);return t}static sortNum(t){return t.sort(((t,e)=>t-e))}static logElapsed(t,e){const s=+new Date;e(),q.log(t,+new Date-s+"ms")}static clamp(t,e,s){return T(e,L(s,t))}static makeIntArray(t,e){const s=new Array(T(0,e-t));for(let i=t;i<e;i++)s[i-t]=i;return s}static shuffle(t){for(let e=t.length;e;){const s=Math.floor(Math.random()*e),i=t[--e];t[e]=t[s],t[s]=i}return t}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static isValidDate(t){return t.getTime()==t.getTime()}static asFunction(t){return"function"==typeof t?t:void 0}static getFieldProp(t){const e=t.indexOf(".");if(e>=0)return{field:t.substring(0,e),props:t.substring(e+1).split(".")}}static startsWith(t,e){if(t&&e)return 0===t.indexOf(e)}static endsWith(t,e){if(t&&e)return t.indexOf(e,-t.length)===t.length-e.length}static scaleNumber(t,e,s){const i=B(t);if(i>=1e3){let r=e.length;for(;r>0;){const n=Math.pow(1e3,r--);if(n<=Math.pow(10,Math.log(i)*Math.LOG10E)&&(s||10*i%n==0))return{value:t/n,symbol:e[r]}}}}static jitter(t,e){return t+(2*Math.random()-1)*e}static randomLike(t){return(2654435761*(123456789^t)>>>16)/65536}}var U;q.LOGGING=!1,q.week_days=["일","월","화","수","목","금","토"],q.long_week_days=["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],q.month_days=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]],q.uniqueKey=function(){let t=Math.random().toString(36).substring(2,9)+"-",e=0;return function(){return"rr-chart-"+t+e++}}(),function(t){t.Developer="developer",t.Evaluation="evaluation",t.Limited="limited",t.Enterprise="enterprise"}(U||(U={}));const K="$ProductVersion";class Z extends R{constructor(t,e,s){super(),this._inited=!1,this._testing=!1,this._dirty=!0,this._toAnimation=0,this._invalidateLock=!1,this._lockDirty=!1,this._cssVars={},this._wSave=NaN,this._hSave=NaN,this.loaded=!1,this._windowResizeHandler=t=>{this._domResized()},this._domResizeHandler=t=>{this._domResized()},this._clickHandler=t=>{this._pointerHandler&&this._pointerHandler.handleClick(this.toOffset(t))},this._dblClickHandler=t=>{this._pointerHandler&&this._pointerHandler.handleDblClick(this.toOffset(t))},this._touchMoveHandler=t=>{},this._pointerDownHandler=t=>{this._pointerHandler&&this._pointerHandler.handleDown(this.toOffset(t))},this._pointerMoveHandler=t=>{this._pointerHandler&&this._pointerHandler.handleMove(this.toOffset(t))},this._pointerUpHandler=t=>{this._pointerHandler&&this._pointerHandler.handleUp(this.toOffset(t))},this._pointerCancelHandler=t=>{},this._pointerLeaveHandler=t=>{this._pointerHandler&&this._pointerHandler.handleLeave(this.toOffset(t))},this._keyPressHandler=t=>{},this._wheelHandler=t=>{},!t&&e instanceof HTMLDivElement&&(t=e.ownerDocument),this._initControl(t||document,e,s||Z.CLASS_NAME),"undefined"!=typeof window&&window.ResizeObserver&&(this._resizeObserver=new ResizeObserver(this._domResizeHandler)),this._resigterEventHandlers(this._dom),this._inited=!0,this.invalidate(!0)}_doDestroy(){this._requestTimer&&(window.requestAnimationFrame?cancelAnimationFrame(this._requestTimer):clearTimeout(this._requestTimer)),this._unresigterEventHandlers(this._dom),W.remove(this._dom),this._dom=null,this._container=null}isInited(){return this._inited}isTesting(){return this._testing}doc(){return this._dom.ownerDocument}dom(){return this._dom}svg(){return this._svg}width(){return this._container.offsetWidth}height(){return this._container.offsetHeight}contentWidth(){return this.width()-this._padding.left-this._padding.right}contentHeight(){return this.height()-this._padding.top-this._padding.bottom}contentRight(){return this.width()-this._padding.right}clipContainer(){return this._defs}setData(t,e,s){G(e)?(this._root.dom.removeAttribute("data-"+t),s&&this._dom.removeAttribute("data-"+t)):(this._root.dom.setAttribute("data-"+t,e),s&&this._dom.setAttribute("data-"+t,e))}clearDefs(){W.clearChildren(this._defs)}$_clearDefs(t){const e=this._defs.children||[];for(let s=e.length-1;s>=0;s--)e[s].hasAttribute(t)&&e[s].remove()}clearAssetDefs(){this.$_clearDefs(J.ASSET_KEY)}clearTemporaryDefs(){this.$_clearDefs(J.TEMP_KEY)}appendDom(t){return t&&this._htmlRoot.append(t),t}addElement(t){return t&&this._root.add(t)}setPointerHandler(t){this._pointerHandler=t}invalidate(t=!1){t||!this._invalidateLock&&!this._dirty&&this._inited?(this._dirty=!0,this._requestTimer||this._testing||this.$_requestRender()):this._invalidateLock&&(this._lockDirty=!0)}invalidateLayout(t=!1){this.invalidate(t)}setLock(){this._invalidateLock=!0}releaseLock(t=!0){this._invalidateLock&&(this._invalidateLock=!1),this._lockDirty&&t&&this.invalidate(),this._lockDirty=!1}lock(t){this.setLock();try{t(this)}finally{this.releaseLock()}}silentLock(t){this.setLock();try{t(this)}finally{this.releaseLock(!1)}}setResizeDelay(t){this._resizeDelay=t}getBounds(){return this._bounds}setAnimation(t){this._toAnimation=t||0}fling(t,e){}getCssVar(t){let e=this._cssVars[t];return t in this._cssVars?this._cssVars[t]:(e=getComputedStyle(this._root.dom).getPropertyValue(t),this._cssVars[t]=e,e)}clipBounds(t=NaN,e=NaN,s=NaN,i=NaN,r=0){const n=new et(this.doc(),t,e,s,i,r,r);return this._defs.appendChild(n.dom),n}clipCircle(){const t=new st(this.doc());return this._defs.appendChild(t.dom),t}addDef(t){this._defs.appendChild(t)}removeDef(t){if(k(t))for(const e in this._defs.children)if(e instanceof Element&&e.id===t){t=e;break}t instanceof Element&&this._defs.removeChild(t)}containerToElement(t,e,s){const i=this._container.getBoundingClientRect(),r=t.getBounds();return{x:e-r.x+i.x,y:s-r.y+i.y}}svgToElement(t,e,s){const i=this._svg.getBoundingClientRect(),r=t.getBounds();return{x:e-r.left+i.left,y:s-r.top+i.top}}elementToSvg(t,e,s){const i=this._svg.getBoundingClientRect(),r=t.getBounds();return{x:e+r.left-i.left,y:s+r.top-i.top}}_setTesting(){this._testing=!0,J.TESTING=!0}_setSize(t,e){isNaN(t)||(this._container.style.width=t+"px"),isNaN(e)||(this._container.style.height=e+"px")}$_addListener(t,e,s,i){i?t.addEventListener(e,s,{passive:!0}):t.addEventListener(e,s)}_resigterEventHandlers(t){var e;window.addEventListener("resize",this._windowResizeHandler),null===(e=this._resizeObserver)||void 0===e||e.observe(t),this.$_addListener(t,"click",this._clickHandler),this.$_addListener(t,"dblclick",this._dblClickHandler),this.$_addListener(t,"touchmove",this._touchMoveHandler,!0),this.$_addListener(t,"pointerdown",this._pointerDownHandler),this.$_addListener(t,"pointermove",this._pointerMoveHandler),this.$_addListener(t,"pointerup",this._pointerUpHandler),this.$_addListener(t,"pointercancel",this._pointerCancelHandler),this.$_addListener(t,"pointerleave",this._pointerLeaveHandler),this.$_addListener(t,"keypress",this._keyPressHandler),this.$_addListener(t,"wheel",this._wheelHandler,!0)}_unresigterEventHandlers(t){var e,s;window.removeEventListener("resize",this._windowResizeHandler),null===(e=this._resizeObserver)||void 0===e||e.unobserve(t),null===(s=this._resizeObserver)||void 0===s||s.disconnect(),t.removeEventListener("click",this._clickHandler),t.removeEventListener("dblclick",this._dblClickHandler),t.removeEventListener("touchmove",this._touchMoveHandler),t.removeEventListener("pointerdown",this._pointerDownHandler),t.removeEventListener("pointermove",this._pointerMoveHandler),t.removeEventListener("pointerup",this._pointerUpHandler),t.removeEventListener("pointercancel",this._pointerCancelHandler),t.removeEventListener("pointerleave",this._pointerLeaveHandler),t.removeEventListener("keypress",this._keyPressHandler),t.removeEventListener("wheel",this._wheelHandler)}_prepareRenderers(t){}_initControl(t,e,s){if(this._inited)return;e instanceof HTMLDivElement?this._container=e:this._container=t.getElementById(e),this._container instanceof HTMLDivElement||((t,e)=>{throw new Error(((t,e)=>t.replace("%1",e))(t,e))})(V.invalidOuterDiv,e);const i=this._container.ownerDocument,r=this._dom=i.createElement("div");D(r.style,{position:"relative",width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden","-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0, 0, 0, 0)"}),r.className=s,this._container.appendChild(r);const n=this._svg=i.createElementNS(S,"svg");n.classList.add("rct-svg"),n.style.setProperty("overflow","visible","important"),n.setAttribute("width","100%"),n.setAttribute("height","100%");const o=i.createElement("desc");o.textContent="Created by RealChart v"+K,n.appendChild(o);const h=this._defs=i.createElementNS(S,"defs");this._initDefs(i,h),n.appendChild(h),r.appendChild(n),this._root=new Q(this),n.appendChild(this._root._dom),this._htmlRoot=i.createElement("div"),r.appendChild(this._htmlRoot),D(this._htmlRoot.style,{position:"absolute"})}_initDefs(t,e){let s=t.createElementNS(S,"filter");s.setAttribute("id",Z.SHADOW_FILTER);const i=t.createElementNS(S,"feGaussianBlur");i.setAttribute("stdDeviation","1.5"),i.setAttribute("in","SourceAlpha"),s.appendChild(i);const r=t.createElementNS(S,"feOffset");r.setAttribute("dx","1"),r.setAttribute("dy","1"),r.setAttribute("result","offsetblur"),s.appendChild(r);const n=t.createElementNS(S,"feFlood");n.setAttribute("flood-color","#000"),s.appendChild(n);const o=t.createElementNS(S,"feComposite");o.setAttribute("in2","offsetblur"),o.setAttribute("operator","in"),s.appendChild(o);const h=t.createElementNS(S,"feMerge"),a=t.createElementNS(S,"feMergeNode"),l=t.createElementNS(S,"feMergeNode");l.setAttribute("in","SourceGraphic"),h.appendChild(a),h.appendChild(l),s.appendChild(h),e.appendChild(s)}_render(){this.$_render()}$_requestRender(){this.orphaned||(window.requestAnimationFrame?this._requestTimer=window.requestAnimationFrame((()=>this.$_render())):this._requestTimer=setTimeout((()=>{this.$_render()}),0))}updateNow(){this.$_render()}$_render(){if(!this.orphaned)if(this._bounds=this._dom.getBoundingClientRect(),+new Date<=this._toAnimation)this.$_requestRender();else{q.LOGGING&&console.time("render chart");try{this._doBeforeRender();const t=this._dom.getBoundingClientRect(),e=this._svg.getBoundingClientRect(),s=this._svg.clientWidth,i=this._svg.clientHeight;D(this._htmlRoot.style,{left:F(e.left-t.left),top:F(e.top-t.top)});const r=this._container.firstElementChild;r.removeAttribute("style"),D(r.style,{position:"relative",width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden","-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0, 0, 0, 0)"}),this._doRenderBackground(r,this._root,s,i);const n=this._padding=W.getPadding(this._root.dom);this._doRender({x:n.left,y:n.top,width:s-n.left-n.right,height:i-n.top-n.bottom})}finally{this.loaded=!0,this._dirty=!1,this._requestTimer=null,this._doAfterRender(),q.LOGGING&&console.timeEnd("render chart")}}}_doBeforeRender(){}_doAfterRender(){}_doRenderBackground(t,e,s,i){}_domResized(){const t=this.width(),e=this.height(),s=this._resizeDelay;t===this._wSave&&e===this._hSave||(this._wSave=t,this._hSave=e,this._resizeTimer&&clearTimeout(this._resizeTimer),s>0?this._resizeTimer=setTimeout((()=>{this.invalidateLayout(),this._resizeTimer=null}),s):this.invalidateLayout())}toOffset(t){const e=this._container.getBoundingClientRect();return t.pointX=t.clientX-e.left,t.pointY=t.clientY-e.top,t}setPointerCapture(t){this._dom.setPointerCapture(t.pointerId)}releasePointerCapture(t){this._dom.releasePointerCapture(t.pointerId)}}Z.CLASS_NAME="rct-control",Z.SHADOW_FILTER="rr-chart-shadow-filter",Z._animatable=!0;class J extends R{constructor(t,e,s=I){super(),this._visible=!0,this._scaleX=1,this._scaleY=1,this._rotation=0,this._styles={},this._styleDirty=!1,this._dom=t.createElementNS(S,s||"g"),(this._styleName=e||"")&&this.setAttr("class",this._styleName)}_doDestroy(){this.remove()}get doc(){return this._dom.ownerDocument}get dom(){return this._dom}get parent(){return this._parent}get control(){return this._parent&&this._parent.control}get x(){return this._x}set x(t){t!==this._x&&(this._x=t,this.setAttr("x",this._x))}get tx(){return this._tx}get y(){return this._y}set y(t){t!==this._y&&(this._y=t,this.setAttr("y",this._y))}get ty(){return this._ty}get width(){return this._width}set width(t){t!==this._width&&(this._width=t,isNaN(t)?this.removeAttr("width"):this.setAttr("width",t))}get height(){return this._height}set height(t){t!==this._height&&(this._height=t,isNaN(t)?this.removeAttr("height"):this.setAttr("height",t))}get tright(){return this._tx+this._dom.getBBox().width}get tbottom(){return this._ty+this._dom.getBBox().height}get visible(){return this._visible}set visible(t){this.setVis(t)}setVis(t){return t!==this._visible&&(this._visible=t,this._dom&&(this._dom.style.display=t?"":"none")),this._visible}get rotation(){return this._rotation}set rotation(t){t!=this._rotation&&(this._rotation=t,this._updateTransform())}setRotation(t,e,s){return t===this._originX&&e===this._originY&&s===this._rotation||(this._originX=t,this._originY=e,this._rotation=s,this._updateTransform()),this}getStyle(t){return window.getComputedStyle(this._dom).getPropertyValue(t)}hasStyle(t){return this.dom.classList.contains(t)}add(t){return t&&t._parent!==this&&(t._parent=this,this._dom.appendChild(t._dom),t._doAttached(this)),t}insertChild(t,e){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,e._dom),t._doAttached(this)),t}insertAfter(t,e){return t&&t._parent!==this&&(t._parent=this,e._dom.nextSibling?this._dom.insertBefore(t._dom,e._dom.nextSibling):this._dom.appendChild(t._dom),t._doAttached(this)),t}insertFirst(t){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,this._dom.firstChild),t._doAttached(this)),t}appendElement(t,e){const s=t.createElementNS(S,e);return this._dom.appendChild(s),s}insertElement(t,e,s){const i=t.createElementNS(S,e);return this._dom.insertBefore(i,s),i}remove(){return this._parent&&(this._parent._dom.removeChild(this._dom),this._parent=null,this._doDetached(this)),this}getAttr(t){return this._dom.getAttribute(t)}removeAttr(t){return this._dom.removeAttribute(t),this}setAttr(t,e){return this._dom.setAttribute(t,e),this}setAttrEx(t,e){return G(e)?this._dom.removeAttribute(t):this._dom.setAttribute(t,e),this}setAttrs(t){for(let e in t)this._dom.setAttribute(e,t[e]);return this}unsetAttr(t){return this._dom.removeAttribute(t),this}getBounds(){return this._dom.getBoundingClientRect()}setBounds(t,e,s,i){return this.trans(t,e),this.resize(s,i),this}setRect(t){return this.trans(t.x,t.y),this.resize(t.width,t.height),this}getRect(){return{x:this._tx,y:this._ty,width:this.width,height:this.height}}getSize(){return{width:this.width,height:this.height}}getBBox(){return this._dom.getBBox()}getBBoxEx(){const t=this._dom.getBBox();return t.x+=this._tx,t.y+=this._ty,t}inflateBBox(t,e){const s=this._dom.getBBox();return s.x+=this._tx,s.y+=this._ty,s.x-=t,s.width+=2*t,s.y-=e,s.height+=2*e,s}controlToElement(t,e){return this.control.containerToElement(this,t,e)}svgToElement(t,e){return this.control.svgToElement(this,t,e)}elementToSvg(t,e){return this.control.elementToSvg(this,t,e)}move(t,e){return this.x=t,this.y=e,this}setPos(t,e){this._x=t,this._y=e}setPosY(t){this._y=t}isDomAnimating(){return!!this._dom.getAnimations&&this._dom.getAnimations().length>0}rotate(t){return t!==this._rotation&&(this._rotation=t,this._updateTransform()),this}internalRotate(t){this._rotation=t}scale(t,e=NaN){return e=isNaN(e)?t:e,this._scaleX===t&&this._scaleY===e||(this._scaleX=t,this._scaleY=e,this._updateTransform()),this}trans(t,e){return t=q.isValidNum(t)?t:this._tx,e=q.isValidNum(e)?e:this._ty,t===this._tx&&e===this._ty||(this._tx=t,this._ty=e,this._updateTransform()),this}transp(t){return this.trans(t.x,t.y)}transEx(t,e,s=0,i=!0){if(t=q.isValidNum(t)?t:this._tx,e=q.isValidNum(e)?e:this._ty,t!==this._tx||e!==this._ty){if(s>0){const r=this._dom.animate([{transform:`translate(${this._tx||0}px,${this._ty||0}px)`},{transform:`translate(${t}px,${e}px)`}],{duration:s,fill:"none"});i&&(null==r||r.addEventListener("finish",(()=>{var t;return null===(t=this.control)||void 0===t?void 0:t.invalidateLayout()})))}this._tx=t,this._ty=e,this._updateTransform()}return this}transEx2(t,e,s=0,i=!0){const r=q.isValidNum(t)?t:this._tx,n=q.isValidNum(e)?e:this._ty;if(r===this._tx&&n===this._ty)return this;if(s>0){const t=this._rotation||0,e=`translate(${this._tx||0}px, ${this._ty||0}px)`+(t?` rotate(${t}deg)`:""),o=`translate(${r}px, ${n}px)`+(t?` rotate(${t}deg)`:"");this._dom.style.transformOrigin=`${this._originX||0}px ${this._originY||0}px`;const h=this._dom.animate([{transform:e},{transform:o}],{duration:s,fill:"none"});i&&h.addEventListener("finish",(()=>{var t;this._dom.style.transformOrigin="",null===(t=this.control)||void 0===t||t.invalidateLayout()}))}return this._tx=r,this._ty=n,this._updateTransform(),this}transX(t){return t!==this._tx&&q.isValidNum(t)&&(this._tx=t,this._updateTransform()),this}transY(t){return t!==this._ty&&q.isValidNum(t)&&(this._ty=t,this._updateTransform()),this}shiftY(t){return this.transY(this._ty+t)}resize(t,e,s=!0){let i=!1;return t!==this._width&&(this._width=Math.max(0,t),s&&this.setAttrEx("width",this._width),i=!0),e!==this._height&&(this._height=Math.max(0,e),s&&this.setAttrEx("height",this._height),i=!0),i}appendDom(t){return t&&this._dom.appendChild(t),t}insertDom(t,e){return t&&this._dom.insertBefore(t,e),t}clearDom(){const t=this._dom;let e;for(;e=t.lastChild;)t.removeChild(e)}containsClass(t){return this._dom.classList.contains(t)}addClass(t){return this._dom.classList.add(...t.split(" ").filter((t=>t.length>0))),this}removeClass(t){return this._dom.classList.remove(t),this}saveStyles(){this._saveStyle=this._dom.getAttribute("style")||"",this._saveClass=this._dom.getAttribute("class")}restoreStyles(){void 0!==this._saveStyle&&(this._dom.setAttribute("style",this._saveStyle),this._dom.style.display=this._visible?"":"none",delete this._saveStyle),this._saveClass&&(this._dom.setAttribute("class",this._saveClass),delete this._saveClass)}internalClearStyles(){const t=this.dom.style;for(let e in this._styles)t.removeProperty(X(e));this._styles={}}clearStyles(){const t=this.dom.style;let e=!1;for(let s in this._styles)t.removeProperty(X(s)),e=!0;return this._styles={},e&&(this._styleDirty=!0),e}clearStyle(t){let e=!1;if(t){const s=this.dom.style;for(let i of t)i in this._styles&&(s.removeProperty(X(i)),delete this._styles[i],e=!0);e&&(this._styleDirty=!0)}return e}internalSetStyles(t){if(t){const e=this.dom.style;for(let s in t)e[s]=this._styles[s]=t[s]}}internalImportantStylesOrClass(t){if(k(t))t&&this._dom.classList.add(t);else if(C(t)){const e=this.dom.style;for(let s in t)e.setProperty(X(s),this._styles[s]=t[s],"important")}}setStyles(t){let e=!1;if(t){const s=this.dom.style;for(let i in t){const r=t[i];this._styles[i]!==r&&(this._styles[i]=r,"rx"==i&&this._dom.setAttribute(i,r),s[i]=r,e=!0)}e&&(this._styleDirty=!0)}return e}resetStyles(t){const e=this.clearStyles();return this.setStyles(t)||e}_resetClass(){this._styleName?this.setAttr("class",this._styleName):this.unsetAttr("class")}clearStyleAndClass(){this.clearStyles(),this._resetClass()}internalClearStyleAndClass(){this.internalClearStyles(),this._resetClass()}setStyleOrClass(t){k(t)?(this._resetClass(),t&&this.addClass(t)):this.resetStyles(t)}internalSetStyleOrClass(t){k(t)?t&&this.addClass(t):this.internalSetStyles(t)}addStyleOrClass(t){k(t)?t&&this.addClass(t):C(t)&&this.setStyles(t)}setClass(t){this.setAttr("class",t)}setStyle(t,e){let s=!1;return e!==this._styles[t]&&(s=this._styleDirty=!0,this._styles[t]=e,this.dom.style[t]=e),s}internalSetStyle(t,e){e!==this._styles[t]&&(this._styles[t]=e,this.dom.style[t]=e)}setColor(t){this.dom.style.fill=this.dom.style.stroke=this._styles.fill=this._styles.stroke=t}setFill(t){this.dom.style.fill=this._styles.fill=t}setStroke(t){this.dom.style.stroke=this._styles.stroke=t}setTransparent(t){this.dom.style.setProperty("fill","transparent",t?"important":""),this.dom.style.setProperty("stroke","none",t?"important":"")}textAlign(){return this._styles.textAlign}setData(t,e){var s,i;null==e?this.dom.removeAttribute("data-"+t):this.dom.setAttribute("data-"+t,(i="",void 0!==(s=e)?s:i))}unsetData(t){this.dom.removeAttribute("data-"+t)}setBoolData(t,e){e?this.dom.setAttribute("data-"+t,""):this.dom.removeAttribute("data-"+t)}getData(t){return this.dom.getAttribute("data-"+t)}hasData(t){return null!=this.getData(t)}removeLater(t,e){if(this._parent)if(t>0){const s=this._dom.animate([{},{opacity:0}],{duration:t,fill:"none"});null==s||s.addEventListener("finish",(()=>{this.remove(),null==e||e(this)}))}else this.remove();return this}hide(t){if(this._parent)if(t>0){const e=this._dom.animate([{},{opacity:0}],{duration:t,fill:"none"});null==e||e.addEventListener("finish",(()=>{delete this.hiding,this.setVis(!1)})),this.hiding=!0}else this.setVis(!1);return this}clipRect(t,e,s,i,r=0){const n=this.control.clipBounds(t,e,s,i,r);return this.setClip(n),n}setClip(t){t?this.setAttr("clip-path","url(#"+(t.id||t)+")"):this.unsetAttr("clip-path")}setTemporary(){return this.setAttr(J.TEMP_KEY,1),this}setCursor(t){this._dom.style.cursor=t}ignorePointer(){this._dom.style.pointerEvents="none"}contains(t){return this._dom.contains(t)}front(t,e){if(!this.parent)return;const s=this.parent._dom,i=this._dom,r=t.length;if(e){const n=e.sort(((e,s)=>t.indexOf(e)-t.indexOf(s)))[e.length-1];this!==n&&(i.remove(),n===t[r-1]?s.appendChild(i):s.insertBefore(i,t[t.indexOf(n)+1].dom))}else r>1&&i!==s.lastElementChild&&(i.remove(),s.appendChild(i))}back(t){if(!this.parent)return;if(t.length>1){const e=t.indexOf(this);this._dom.remove(),e<t.length-1?this.parent.dom.insertBefore(this._dom,t[e+1].dom):this.parent.dom.appendChild(this._dom)}}invalidate(){var t;null===(t=this.control)||void 0===t||t.invalidateLayout()}sort(t){t.forEach((t=>this._dom.appendChild(t._dom)))}getParent(t){let e=this._parent;for(;e;){if(e instanceof t)return e;e=e._parent}}_testing(){return J.TESTING}_doAttached(t){}_doDetached(t){}_updateTransform(){this._dom.setAttribute("transform",this.getTransform())}getTransform(){const t=this._dom;let e=this._tx,s=this._ty,i=[];(q.isValidNum(e)||q.isValidNum(s))&&(e=e||0,s=s||0,i.push("translate("+e+","+s+")")),this._rotation&&i.push("rotate("+this._rotation+" "+q.pick(this._originX,t.getAttribute("x"),0)+" "+q.pick(this._originY,t.getAttribute("y")||0)+")"),q.isNotEmpty(this._matrix)&&i.push("matrix("+this._matrix.join(",")+")");const r=q.getNumber(this._scaleX,1),n=q.getNumber(this._scaleY,1);return 1===r&&1===n||i.push("scale("+r+" "+n+")"),i.length?i.join(" "):""}}J.DEBUGGING=!1,J.TESTING=!1,J.ASSET_KEY="_asset_",J.TEMP_KEY="_temp_";class Q extends J{constructor(t){super(t.doc(),"rct-root"),this._control=t}get control(){return this._control}}class tt extends J{constructor(t){super(t,I,"clipPath");const e=this._id=q.uniqueKey()+"-";this.setAttr("id",e)}get id(){return this._id}}class et extends tt{constructor(t,e=NaN,s=NaN,i=NaN,r=NaN,n=0,o=0){super(t);const h=this._rect=new J(t,null,"rect");h.setAttr("fill","none"),n>0&&h.setAttr("rx",String(n)),o>0&&h.setAttr("ry",String(o)),isNaN(e)||h.setBounds(e,s,i,r),this.add(h)}setBounds(t,e,s,i){return this._rect.x=t,this._rect.y=e,this._rect.resize(s,i),this}resize(t,e,s){return this._rect.resize(t,e)}get x(){return this._rect.x}set x(t){this._rect.x=t}get y(){return this._rect.y}set y(t){this._rect.y=t}get width(){return this._rect.width}set width(t){this._rect.width=t}get height(){return this._rect.height}set height(t){this._rect.height=t}}class st extends tt{constructor(t){super(t),this.add(this._circle=new J(t,null,"circle"))}setCircle(t,e,s){this._circle.setAttrs({cx:t,cy:e,r:s})}}class it extends J{static create(t,e,s,i,r,n,o=0){return new it(t,e,{x:s,y:i,width:r,height:n,r:o})}constructor(t,e=I,s=I){super(t,e,"rect"),this.rect=s}get rect(){return this._rect&&{...this._rect}}set rect(t){if(t!==this._rect&&(this._rect=t&&{...t},t)){this.setRect(t);let e=t.rx||t.r,s=t.ry||t.r;e>0&&this.dom.setAttribute("rx",String(e)),s>0&&this.dom.setAttribute("rx",String(s))}}resizeRect(t,e){const s=this.getStyle("border-radius");return this.resize(t,e),s&&this.dom.setAttribute("rx",s),this}setBounds(t,e,s,i,r=0){return this.rect={x:t,y:e,width:s,height:i,r:r},this}setBox(t,e,s,i){this.rect=i<0?{x:t,y:e+i,width:s,height:-i}:{x:t,y:e,width:s,height:i}}setRadius(t){t>0&&(this._rect&&(this._rect.rx=this._rect.ry=t),this.dom.setAttribute("rx",String(t)),this.dom.setAttribute("ry",String(t)))}}class rt{static isBright(t){return new rt(t).isBright()}static getContrast(t,e,s){return new rt(t).getContrast(e,s)}static interpolate(t,e,s){const i=new rt(t),r=new rt(e),n=1-s,o=Math.round(i.r*s+r.r*n),h=Math.round(i.g*s+r.g*n),a=Math.round(i.b*s+r.b*n),l=i.a*s+r.a*(1-s);return l<1?`rgba(${o},${h},${a},${l})`:`rgb(${o},${h},${a})`}constructor(t){this.r=0,this.g=0,this.b=0,this.a=1,(t=t&&t.trim())&&(q.startsWith(t,"rgb(")&&q.endsWith(t,")")?this.$_parseRgb(t.substring(4,t.length-1)):q.startsWith(t,"rgba(")&&q.endsWith(t,")")?this.$_parseRgb(t.substring(5,t.length-1)):q.startsWith(t,"#")&&this.$_parseNumber(t.substr(1)))}get rgba(){return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}isBright(){return.299*this.r+.587*this.g+.114*this.b>140}getContrast(t,e){return this.isBright()?t||"#000000":e||"#FFFFFF"}brighten(t,e=null){return(e=e||new rt(null)).r=Math.ceil(this.r+(255-this.r)*t),e.g=Math.ceil(this.g+(255-this.g)*t),e.b=Math.ceil(this.b+(255-this.b)*t),e.a=this.a,e}toString(){return this.rgba}$_parseRgb(t){const e=t.split(/\,\s*/);e.length>=3&&(this.r=+e[0],this.g=+e[1],this.b=+e[2],e.length>=4?this.a=+e[3]:this.a=1)}$_parseNumber(t){const e=t.length;let s;e>6?(s=parseInt(t.substr(0,6),16),this.a=parseInt(t.substring(6),16)/255):e>0&&(3===e&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),s=parseInt(t,16)),this.r=(16711680&s)>>16,this.g=(65280&s)>>8,this.b=255&s}}var nt,ot,ht;rt.BLACK="#000",rt.WHITE="#fff",function(t){t.START="start",t.MIDDLE="middle",t.END="end"}(nt||(nt={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(ot||(ot={})),function(t){t.TRUNCATE="truncate",t.WRAP="wrap",t.ELLIPSIS="ellipsis"}(ht||(ht={}));class at extends J{constructor(t,e=void 0){super(t,e,"text"),this._layout=ot.TOP,this._overflow=ht.WRAP,this._dirty=!0,this._text="",this.anchor=nt.MIDDLE}get text(){return this._text}set text(t){(t=t||"")!==this._text&&(this._dirty=!0,this.dom.textContent=this._text=t,this.layoutText())}get anchor(){return this.getAttr("text-anchor")}set anchor(t){t!==this.anchor&&this.setAttr("text-anchor",t)}get layout(){return this._layout}set layout(t){t!==this._layout&&(this._layout=t,this.layoutText())}get overflow(){return this._overflow}set overflow(t){t!==this._overflow&&(this._overflow=t,this.layoutText())}get opacity(){return this.getAttr("fill-opacity")}set opacity(t){this.setAttr("fill-opacity",t)}getAscent(t){return.72*t}layoutText(t){const e=this.getBBox(),s=this.getAscent(isNaN(t)?e.height:t);let i;switch(this._layout){case ot.MIDDLE:i=Math.floor(s/2);break;case ot.BOTTOM:i=0;break;default:i=Math.ceil(s)}this.y=i}isFitIn(t){return this.calcWidth()>=t}calcWidth(){const t=this._text.length;return t&&this.dom.getSubStringLength(0,t)}calcRangeWidth(t=0,e=Number.MAX_SAFE_INTEGER){return t=T(0,t),(e=L(this._text.length,e))>t?this.dom.getSubStringLength(t,e-t):0}truncate(t,e){let s=this._text;if(!s)return;const i=this.dom;let r,n=0,o=s.length;do{r=Math.ceil((n+o)/2);i.getSubStringLength(0,r)>t?o=r-1:n=r}while(n<o);for(this.text=s.substring(0,n)+"…";n>0&&this.calcWidth()>t;)this.text=s.substring(0,--n)+"…"}setContrast(t,e,s){return this.setStyleOrClass(rt.isBright(getComputedStyle(t).fill)?e:s),this}clearDom(){super.clearDom(),this._dirty=!0}setStyles(t){const e=super.setStyles(t);return e&&this.layoutText(),e}setStyle(t,e){let s=super.setStyle(t,e);return s&&this.layoutText(),s}getBBox(){return(this._dirty||this._styleDirty)&&(this._bounds=this.dom.getBBox(),this._dirty=this._styleDirty=!1),this._bounds}getBBoundsTest(){return(this._dirty||this._styleDirty)&&(this._bounds={x:this.x,y:this.y,width:100,height:30},this._dirty=this._styleDirty=!1),this._bounds}stain(){this._dirty=!0}}class lt{static create(t,e,s,i){return isNaN(s)?isNaN(e)?new lt(t,t,t,t):new lt(t,t,e,e):new lt(t,e,s,i)}static createFrom(t){const e=t.split(/\s*[\s,]+\s*/g);return this.create.call(null,...e.map((t=>+t)))}constructor(t=0,e=0,s=0,i=0){this.top=t,this.bottom=e,this.left=s,this.right=i}clone(){return new lt(this.top,this.bottom,this.left,this.right)}applyPadding(t){return this.left=M(t.paddingLeft,0),this.right=M(t.paddingRight,0),this.top=M(t.paddingTop,0),this.bottom=M(t.paddingBottom,0),this}applyMargin(t){return this.left=M(t.marginLeft,0),this.right=M(t.marginRight,0),this.top=M(t.marginTop,0),this.bottom=M(t.marginBottom,0),this}shrink(t){return{x:t.x+this.left,y:t.y+this.top,width:t.width-this.left-this.right,height:t.height-this.top-this.bottom}}}lt.Empty=Object.freeze(new lt),lt.Temp=new lt;class dt extends J{constructor(t,e=I){super(t,e,"g"),this._doInitChildren(t)}setAttr(t,e){return dt.IGNORE_ATTRS.hasOwnProperty(t)||super.setAttr(t,e),this}_doInitChildren(t){}}dt.IGNORE_ATTRS={width:"",height:""};class ct extends J{constructor(t,e=I){super(t,e,"g"),J.DEBUGGING&&(this.add(this._debugRect=new it(t,"rct-debug")),this._debugRect.setAttr("pointerEvents","none"))}chart(){return this.model.chart}get model(){return this._model}_prepareStyleOrClass(t){this.setStyleOrClass(t._style)}setModel(t){t!==this.model&&(this._model=t,this.options=t._op)}measure(t,e,s,i,r){this._prepareStyleOrClass(e),this.setModel(e);const n=this._doMeasure(t,this.model,s,i,r);return this.mw=n.width,this.mh=n.height,n}layout(t){return this._doLayout(t),J.DEBUGGING?(this._debugRect||this.insertFirst(this._debugRect=new it(this.doc,"rct-debug")),this.width>1&&this.height>1&&this._debugRect.setRect(this._getDebugRect())):this._debugRect&&(this._debugRect.remove(),this._debugRect=null),this}resizeByMeasured(){return this.resize(this.mw,this.mh),this}_getDebugRect(){return{x:0,y:0,width:this.width,height:this.height}}_doMeasure(t,e,s,i,r){return{width:s,height:i}}_doLayout(t){}_invalidate(){var t;null===(t=this.control)||void 0===t||t.invalidateLayout()}}class _t extends ct{constructor(t,e,s){super(t,e),this._margins=new lt,this._paddings=new lt,this.add(this._background=new it(t,s))}_getDebugRect(){return this._margins.shrink(super._getDebugRect())}measure(t,e,s,i,r){this._prepareStyleOrClass(e),this.setModel(e),this._setBackgroundStyle(this._background);let n=getComputedStyle(this._background.dom);const o=this._paddings;o.applyPadding(n);const h=this._doMeasure(t,e,s,i,r);if(h.width+=o.left+o.right,h.height+=o.top+o.bottom,this._marginable()){const t=this._margins;n=getComputedStyle(this.dom),t.applyMargin(n),this.mw=h.width+=t.left+t.right,this.mh=h.height+=t.top+t.bottom}return this.mw=h.width,this.mh=h.height,h}layout(t){if(super.layout(t),this._marginable()){const t=this._margins;this._background.setBounds(t.left+this._getBackOffset(),t.top,this.width-t.left-t.right,this.height-t.top-t.bottom)}else this._resetBackBounds()&&this._background.setBounds(0,0,this.width,this.height);return this}_marginable(){return!0}_resetBackBounds(){return!0}_getBackOffset(){return 0}_deflatePaddings(t){const e=this._paddings;t.width-=e.left+e.right,t.height-=e.top+e.bottom}}class ut extends ct{constructor(t){super(t,"rct-legend-item"),this.add(this._back=new it(t)),this._back.setFill("transparent"),this._back.setStroke("none"),this.add(this._label=new at(t,"rct-legend-item-label")),this._label.anchor=nt.START}setMarker(t){t!==this._marker&&(this._marker&&this._marker.remove(),this.insertFirst(this._marker=t))}_doMeasure(t,e,s,i,r){var n,o;const h=e.source;this._label.setBoolData("hidden",!h.visible),this._marker.setBoolData("hidden",!h.visible),this._label.setBoolData("empty",null===(n=h.isEmpty)||void 0===n?void 0:n.call(h)),this._marker.setBoolData("empty",null===(o=h.isEmpty)||void 0===o?void 0:o.call(h)),this._label.text=e.text()||"…";const a=this._rMarker=this._marker.setVis(e.legend.options.markerVisible)?this._marker.getBBox():z,l={width:(d=this._label.getBBox()).width,height:d.height};var d;return this._gap=M(e.legend.options.markerGap,0),{width:a.width+this._gap+l.width,height:T(a.height,l.height)}}_doLayout(t){const e=this._rMarker,s=M(t,e.width);this._back.setBounds(0,0,this.width,this.height),this._marker.visible&&this._marker.trans((s-e.width)/2,(this.height-e.height)/2),this._label.trans(s+this._gap,(this.height-this._label.getBBox().height)/2)}}class pt extends _t{constructor(t){super(t,pt.LEGEND_CLASS,"rct-legend-background"),this._itemViews=new P(this,ut)}legendByDom(t){const e=this._itemViews.elementOf(t);return e&&e.model}legendOfSeries(t){return this._itemViews.find((e=>e.model.source===t))}_setBackgroundStyle(t){t.setStyleOrClass(this.model.options.backgroundStyle)}_doMeasure(t,e,s,i,r){const n=e.options,o=e.items(),h=this._vertical="vertical"===e.getLayout();return this._ipr=M(n.itemsPerLine,Number.MAX_SAFE_INTEGER),this._gap="body"!==e._location?M(n.gap,0):0,h?i=e.getMaxHeight(i):s=e.getMaxWidth(s),this.$_prepareItems(t,o),this.$_measure(t,e,h,this._ipr,s,i)}_doLayout(){const t=this.model.options,e=this._rowViews,s=t.useTextColor,i=this._sizes,r=t.itemsAlign,n=t.lineGap||0,o=t.itemGap||0,h=this._margins,a=this._paddings,l=this._vertical,d=h.left+a.left,c=h.top+a.top;let _,u=d,p=c;this._itemViews.forEach((t=>{const e=t.model.source,i=e.legendColor(),r=e.legendStroke();t._marker.setColor(i),r&&t._marker.setStroke(r),s&&e.visible?t._label.setFill(i):t._label.setFill("")})),e.forEach(((t,e)=>{l?(t.forEach((t=>{t.mw=i[e],t.resizeByMeasured().layout(this._wMarkers[e])})),p=c,"center"!==r&&"end"!==r||(_=t.map((t=>t.height)).reduce(((t,e)=>t+e))+o*(t.length-1)+h.top+h.bottom+a.top+a.bottom,p+="center"===r?(this.height-_)/2:this.height-_),t.forEach((t=>{t.trans(u,p),p+=t.height+o})),u+=i[e]+n):(t.forEach((t=>{t.resizeByMeasured().layout(NaN)})),u=d,"center"!==r&&"end"!==r||(_=t.map((t=>t.width)).reduce(((t,e)=>t+e))+o*(t.length-1)+h.left+h.right+a.left+a.right,u+="center"===r?(this.width-_)/2:this.width-_),t.forEach((t=>{t.trans(u,p),u+=t.width+o})),p+=i[e]+n)}))}$_prepareItems(t,e){this._itemViews.prepare(e.length)}$_measure(t,e,s,i,r,n){const o=e.options,h=e.items(),a=this._itemViews,l=o.itemGap||0,d=o.lineGap||0,c=e.getMarkerSize(),_=a.count,u=this._rowViews=[],p=this._sizes=[];let g,m,f,y;a.forEach(((e,s)=>{e.setMarker(h[s].source.legendMarker(t,c)),e.measure(t,h[s],r,n,1)}));let w=0,v=0;if(s){for(;w<_;)y=a.get(w),v%i==0?(u.push(f=[y]),m=y.mh,v++,w++):(m+=l+y.mh,m<=n?(f.push(y),v++,w++):v=0);this._wMarkers=[],g=m=0,u.forEach(((t,e)=>{let s=0,i=0,r=0;t.forEach((t=>{i+=t.mh,s=T(s,t.mw),r=T(r,t._rMarker.width),t._col=e})),i+=l*(t.length-1),m=T(m,i),g+=s,p.push(s),this._wMarkers.push(r)})),g+=d*(u.length-1)}else{for(;w<_;)y=a.get(w),v%i==0?(u.push(f=[y]),g=y.mw,v++,w++):(g+=l+y.mw,g<=r?(f.push(y),v++,w++):v=0);g=m=0,u.forEach((t=>{let e=0,s=0;t.forEach((t=>{e+=t.mw,s=T(s,t.mh)})),e+=l*(t.length-1),g=T(g,e),m+=s,p.push(s)})),m+=d*(u.length-1)}return{width:g,height:m}}}pt.LEGEND_CLASS="rct-legend";class gt extends u{constructor(){super(...arguments),this.views=[],this._gap=0}isEmpty(){return 0===this.views.length}prepare(t,e,s,i){const r=this.views,n=[];for(this.isX=s,i._axes.forEach((t=>{t.checkVisible()&&e.isValidAxis(t)&&n.push(t)}));r.length<n.length;){const e=new m(t);this.add(e),r.push(e)}for(;r.length>n.length;)r.pop().remove();if(r.forEach(((t,e)=>{t.setModel(n[e])})),this.axes=n,this.setVis(r.length>0)){const t=r[0].model;this._gap=t.chart.getAxesGap()}}prepareGuides(t,e,s){const i=this.views,r=this.axes;i.forEach(((s,i)=>{const n=r[i];e.forEach((e=>{e.forEach((e=>{e.isConnected(n)&&s.setVis(this.visible)&&(s.prepareGuides(t,e.row,e.col,e._guideContainer,e._frontGuideContainer),n._isHorz||(e._axes||(e._axes=[]),e._axes.push(n)))}))}))})),e.forEach((e=>{e.forEach((e=>{e._axes&&(e._gridRowContainer.addAll(t,e._axes),e._axes=[])}))}))}checkHeights(t,e,s){return this.views.length>0?this.$_checkHeights(this.views,t,e,s):0}$_checkHeights(t,e,s,i){let r=0;return t&&(t.forEach((t=>{r+=t.checkHeight(e,s,i)})),r+=(this.views.length-1)*this._gap),r}checkWidths(t,e,s){return this.views.length>0?this.$_checkWidths(this.views,t,e,s):0}$_checkWidths(t,e,s,i){let r=0;return t&&(t.forEach((t=>{r+=t.checkWidth(e,s,i)})),r+=(this.views.length-1)*this._gap),r}getScrollView(t){var e;for(const s of this.views)if(null===(e=s._scrollView)||void 0===e?void 0:e.contains(t))return s._scrollView}setMargins(t,e,s,i){this.views.forEach((r=>r.setMargins(t,e,s,i)))}_setInverted(t){super._setInverted(t),this.isHorz=t&&!this.isX||!t&&this.isX}_doMeasure(t,e,s,i,r){const n=this.axes;if(this.isHorz){let e=0;return this.views.forEach(((o,h)=>{e+=o.measure(t,n[h],s,i,r).height})),{width:s,height:e}}{let e=0;return this.views.forEach(((o,h)=>{e+=o.measure(t,n[h],s,i,r).width})),{width:e,height:i}}}_doLayout(t){const e=this.views,s=this.width,i=this.height,r=e.length;let n=0,o=r-1;if(this.isHorz){let t,h,a=0;for(;n<r;n++){const t=e[n];if(t.model._posValue()<1)break;t.trans(0,a),a+=t.mh}for(t=a,a=i;o>=0;o--){const t=e[o];if(t.model._posValue()>-1)break;a-=t.mh,t.trans(0,a)}h=a;const l=h-t;let d=0;for(let t=n;t<=o;t++)d+=e[t].mh;t+=(l-d)/2;for(let s=n;s<=o;s++){const i=e[s];i.trans(0,t),t+=i.mh}e.forEach((t=>{t.resize(s,t.mh),t.model._calcPoints(s,999),t.layout()}))}else{let t,h,a=0;for(;n<r;n++){const t=e[n];if(t.model._posValue()>-1)break;t.trans(a,0),a+=t.mw}for(t=a,a=s;o>=0;o--){const t=e[o];if(t.model._posValue()<1)break;a-=t.mw,t.trans(a,0)}h=a;const l=h-t;let d=0;for(let t=n;t<=o;t++)d+=e[t].mw;t+=(l-d)/2;for(let s=n;s<=o;s++){const i=e[s];i.trans(t,0),t+=i.mw}e.forEach((t=>{t.resize(t.mw,i),t.model._calcPoints(i,999),t.layout()}))}}}class mt extends u{constructor(t,e){super(t,"rct-axis-container"),this.isX=e,this.sections=[]}prepare(t,e,s,i,r){const n=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<n.length;){const e=new gt(t);this.add(e),this.sections.push(e)}for(;this.sections.length>n.length;)this.sections.pop().remove();this.sections.forEach(((s,r)=>{this.isX?(s.row=i,s.col=r):(s.col=i,s.row=r),s.prepare(t,e,this.isX,n[r])})),this._setInverted(r)}prepareGuides(t,e,s,i){const r=this.isX?s.getRow(i):s.getColumn(i);for(;this.sections.length<r.length;){const e=new gt(t);this.add(e),this.sections.push(e)}for(;this.sections.length>r.length;)this.sections.pop().remove();this.sections.forEach(((r,n)=>{this.isX?(r.row=i,r.col=n):(r.col=i,r.row=n),r.prepareGuides(t,e,s)}))}checkWidths(t,e,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,r)=>i+r.checkWidths(t,e,s)),0):this.sections.reduce(((i,r)=>Math.max(i,r.checkWidths(t,e,s))),0):0}checkHeights(t,e,s){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,r)=>Math.max(i,r.checkHeights(t,e,s))),0):this.sections.reduce(((i,r)=>i+r.checkHeights(t,e,s)),0):0}_setInverted(t){super._setInverted(t),this._isHorz=t&&!this.isX||!t&&this.isX}_doMeasure(t,e,s,i,n){let o=0,h=0;return this._isHorz?this.sections.forEach((o=>{h=r(h,o.measure(t,e,s,i,n).height)})):this.sections.forEach((h=>{o=r(o,h.measure(t,e,s,i,n).width)})),{width:o,height:h}}_doLayout(t){this._isHorz?this.height>0&&this.sections.forEach(((e,s)=>{e.resize(t[2*(s+1)]-t[2*(s+1)-1],this.height),e.trans(t[2*s+1]-t[1],0),e.layout()})):this.width>0&&this.sections.forEach(((e,s)=>{e.resize(this.width,t[2*(s+1)]-t[2*(s+1)-1]),e.trans(0,this.height-(t[2*(s+1)]-t[1])),e.layout()}))}}class ft extends p{constructor(t,e){super(t,e),this.row=0,this.col=0,this.add(this._legendView=new pt(t))}getCol(){return this.col}getRow(){return this.row}getTooltipPos(){return{x:this.parent.parent.tx+this.tx,y:this.parent.parent.ty+this.ty}}prepareRender(t,e){const s=e.chart,i=e.depth.visible,r=this.row,n=this.col,o=s._split.getPane(r,n).body;this._animatable=g._animatable&&s.animatable(),this._prepareSeries(t,e,s._getSeries().getPaneSeries(r,n),i),this._prepareGauges(t,s,s._getGauges().getPaneVisibles(r,n)),this._prepareAnnotations(t,o.getAnnotations().concat(s._getAnnotations().getPaneVisibles(r,n)))}_doMeasure(t,e,s,i,r){return this._legendView.setVis(e.pane.legend.visible)&&this._legendView.measure(t,e.pane.legend,s,i,r),super._doMeasure(t,e,s,i,r)}_doLayout(){super._doLayout();const t=this._legendView;if(t.visible){this._seriesViews.forEach((e=>{if(e.needDecoreateLegend()){const s=t.legendOfSeries(e.model);s&&e.decoreateLegend(s)}}));const e=t.model.options,s=e.align,i=e.verticalAlign;let r=0,n=0,o=+e.offsetX||0;switch(s){case"right":r+=this.width-t.mw-o;break;case"center":r+=(this.width-t.mw)/2+o;break;default:r+=o}switch(o=+e.offsetY||0,i){case"bottom":n+=this.height-t.mh-o;break;case"middle":n+=(this.height-t.mh)/2+o;break;default:n+=o}t.trans(r,n).resize(t.mw,t.mh),t.layout()}}}class yt extends d{constructor(t,e){super(t,yt.STYLE_NAME),this._bodies=[],this._xContainers=[],this._yContainers=[],this._owner=e}get bodies(){return this._bodies}bodyViewOf(t){return this._bodies.find((e=>e.contains(t)))}prepare(t,e){e.chart,this.$_init(t),this._model=e,this.$_prepareBodies(t,e)}measure(t,e,s,i,r){const n=e.chart,o=this._inverted=e.chart.isInverted(),h=e._xAxes,a=e._yAxes,l=s,d=i;this.$_prepareAxes(t,h,!0,o),this.$_prepareAxes(t,a,!1,o),e.measureAxes(s,i,o,r),o?(s-=this._xContainers.reduce(((e,r)=>e+r.checkWidths(t,s,i)),0),i-=this._yContainers.reduce(((e,r)=>e+r.checkHeights(t,s,i)),0)):(i-=this._xContainers.reduce(((e,r)=>e+r.checkHeights(t,s,i)),0),s-=this._yContainers.reduce(((e,r)=>e+r.checkWidths(t,s,i)),0)),e.measureAxes(s,i,o,r),this._xContainers.forEach((e=>e.measure(t,n,s,i,r))),this._yContainers.forEach((e=>e.measure(t,n,s,i,r))),s=l,i=d,o?(s-=this._xContainers.reduce(((t,e)=>t+e.mw),0),i-=this._yContainers.reduce(((t,e)=>t+e.mh),0)):(i-=this._xContainers.reduce(((t,e)=>t+e.mh),0),s-=this._yContainers.reduce(((t,e)=>t+e.mw),0)),r++,e.measureAxes(s,i,o,r),this.$_prepareAxisGuides(t,h,!0),this.$_prepareAxisGuides(t,a,!1),this._xContainers.forEach((e=>{e.measure(t,n,s,i,r)})),this._yContainers.forEach((e=>{e.measure(t,n,s,i,r)}));const c=e.getXLens(o?i:s),_=e.getYLens(o?s:i);e.completeAxesPoints(c,_)}layout(){const t=this._model,e=this.width,s=this.height;this._back.resize(e,s),this.$_calcExtents(t,e,s),this.$_layoutAxes(t,!0,e,s),this.$_layoutAxes(t,!1,e,s),this.$_layoutBodies(t,e,s)}seriesByDom(t){for(const e of this._bodies){const s=e.seriesByDom(t);if(s)return s}}getSeries(t){for(const e of this.bodies){const s=e.findSeries(t);if(s)return s}}legendByDom(t){for(const e of this.bodies){const s=e._legendView.legendByDom(t);if(s)return s}}$_init(t){this._back||(this.add(this._back=new c(t)),this._back.setStyles({fill:"none"}),this.add(this._bodyContainer=new _(t,void 0)),this.add(this._axisContainer=new _(t,void 0)))}$_prepareBodies(t,e){e.chart;const s=e.paneCount,i=e.rowCount,r=e.colCount,n=this._bodies,o=this._bodyMap=[];for(;n.length<s;){const e=new ft(t,this._owner);this._bodyContainer.add(e),n.push(e)}for(;n.length>s;)n.pop().remove();for(let t=0;t<i;t++){const e=[];for(let s=0;s<r;s++){const i=n[t*r+s];e.push(i),i.row=t,i.col=s}o.push(e)}n.forEach((s=>{s.prepareRender(t,e.getPane(s.row,s.col).body),s.prepareGuideContainers(),s._gridRowContainer.prepare()}))}$_prepareAxes(t,e,s,i){const r=this._model.chart,n=s?this._xContainers:this._yContainers,o=s?e.rows():e.cols();for(;n.length<o;){const e=new mt(t,s);this._axisContainer.add(e),n.push(e)}for(;n.length>o;)n.pop().remove();n.forEach(((s,n)=>{s.prepare(t,r,e,n,i)}))}$_prepareAxisGuides(t,e,s){(s?this._xContainers:this._yContainers).forEach(((s,i)=>{s.prepareGuides(t,this._bodyMap,e,i)}))}$_calc(t,e,s,i){const r=s.length,n=new Array(2*(r+1)),o=e-t.reduce(((t,e)=>t+e[i]),0),h=this._model._calcSizes(s,o);let a=0,l=0;for(l=0;l<r;l++)n[2*l]=a,n[2*l+1]=a+=t[l][i],a+=h[l];return n[2*l]=a,n[2*l+1]=a+t[l][i],n}$_calcExtents(t,e,s){this._inverted?(this._rowPoints=this.$_calc(this._xContainers,e,t.rowSizes(),"mw"),this._colPoints=this.$_calc(this._yContainers,s,t.colSizes(),"mh")):(this._rowPoints=this.$_calc(this._xContainers,s,t.rowSizes(),"mh"),this._colPoints=this.$_calc(this._yContainers,e,t.colSizes(),"mw"))}$_layoutAxes(t,e,s,i){const r=this.control._padding,n=this._rowPoints,o=this._colPoints,h=e?this._xContainers:this._yContainers;if(this._inverted)if(e){const t=o[1],e=o[o.length-2]-t;h.forEach(((t,s)=>{t.resize(t.mw,e),t.trans(n[2*s],i-o[o.length-2]),t.layout(o)}))}else{const t=n[1],e=n[n.length-2]-t;h.forEach(((s,h)=>{const a=s.sections;for(let t=0,e=a.length;t<e;t++){const s=a[t],i=0===t?r.left:0,o=t===e-1?r.right:0;let h=0,l=0;e>1&&(h=n[2*t+1]-n[2*t],l=n[2*(t+1)+1]-n[2*(t+1)],0===t?a[t+1].isEmpty()?l=n[2*(t+1)]-n[2*(t+1)-1]:l/=2:t===e-1?a[t-1].isEmpty()?h=n[2*(t-1)]-n[2*(t-1)-1]:h/=2:(a[t-1].isEmpty()?h=n[2*(t-1)]-n[2*(t-1)-1]:h/=2,a[t+1].isEmpty()?l=n[2*(t+1)]-n[2*(t+1)-1]:l/=2)),s.setMargins(i,h,l,o)}s.resize(e,s.mh),s.trans(t,i-o[2*h+1]),s.layout(n)}))}else if(e){const t=o[1];s=o[o.length-2]-t,h.forEach(((e,a)=>{const l=e.sections;for(let t=0,e=l.length;t<e;t++){const s=l[t],i=0===a?r.left:0,d=a===h.length-1?r.right:0;let c=0,_=0;e>1&&(c=o[2*t+1]-o[2*t],_=o[2*(t+1)+1]-o[2*(t+1)],0===t?l[t+1].isEmpty()?_=o[2*(t+1)]-o[2*(t+1)-1]:_/=2:t===e-1?l[t-1].isEmpty()?c=o[2*(t-1)]-o[2*(t-1)-1]:c/=2:(l[t-1].isEmpty()?c=o[2*(t-1)]-o[2*(t-1)-1]:c/=2,l[t+1].isEmpty()?_=o[2*(t+1)]-n[2*(t+1)-1]:_/=2)),s.setMargins(i,c,_,d)}e.resize(s,e.mh),e.trans(t,i-n[2*a+1]),e.layout(o)}))}else{const t=n[n.length-2],e=t-n[1];h.forEach(((s,r)=>{s.resize(s.mw,e),s.trans(o[2*r],i-t),s.layout(n)}))}}$_layoutBodies(t,e,s){const i=t.rowCount,r=t.colCount,n=this._rowPoints,o=this._colPoints,h=this._bodies;if(this._inverted)for(let e=0;e<i;e++){const s=n[2*(e+1)-1],i=n[2*(e+1)];for(let n=0;n<r;n++){const a=h[e*r+n],l=o[2*n+1],d=o[2*(n+1)];a.measure(this.doc,t.getPane(e,n).body,i-s,d-l,1),a.resize(i-s,d-l),a.trans(s,this.height-d),a.layout()}}else for(let e=0;e<i;e++){const i=n[2*(e+1)-1],a=n[2*(e+1)];for(let n=0;n<r;n++){const l=h[e*r+n],d=o[2*(n+1)-1],c=o[2*(n+1)];l.measure(this.doc,t.getPane(e,n).body,c-d,a-i,1),l.resize(c-d,a-i),l.trans(d,s-a),l.layout()}}}}function wt(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.ChartObject.registerSplitClass(E),t.ChartView.registerPaneClass(yt))}yt.STYLE_NAME="rct-panes";export{E as Split,wt as default,wt as registerSplit};
|
|
7
|
+
import{extend as e,Body as s,ChartItem as t,isArray as i,maxv as o,pickNum as r,isObject as n,isNumber as h,isString as a,Legend as c,PaneContainer as l,RectElement as _,LayerElement as d,SectionView as u,BodyView as p,LegendView as g,RcControl as w,AxisView as f}from"./index.mjs";class x{constructor(e,s){this.row=e,this.col=s,this._axes=[]}sort(e,s){const t=s&&!e||!s&&e;this._axes.length>1&&(t?this._axes.sort(((e,s)=>{const t=e._posValue(),i=s._posValue();return t===i?t<0?s._index-e._index:t>0?e._index-s._index:e.row!==s.row?s.row-e.row:e.row<this.row?s._index-e._index:e._index-s._index:i-t})):this._axes.sort(((e,s)=>{const t=e._posValue(),i=s._posValue();return t===i?t<0?e._index-s._index:t>0?s._index-e._index:e.col!==s.col?e.col-e.col:e.col<this.col?e._index-s._index:s._index-e._index:t-i})))}}class m{constructor(e,s){this.chart=e,this.isX=s}rows(){return this._matrix.length}cols(){return this._matrix[0].length}_prepare(e,s,t,i){this._doPrepare(e,s,t),this._matrix.forEach((e=>{e.forEach((e=>e.sort(this.isX,i)))}))}get(e,s){return this._matrix[e][s]}getRow(e){return this._matrix[e]}getColumn(e){return this._matrix.map((s=>s[e]))}_buildTicks(e,s){const t=this.isX;this._matrix.forEach(((i,o)=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{!i.isBased()&&(s<2||t)&&i._buildTicks(e[t?i.options.col:i.options.row],s)}))}))})),this._matrix.forEach(((i,o)=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{i.isBased()&&(s<2||t)&&i._buildTicks(e[t?i.options.col:i.options.row],s)}))}))}))}_calcPoints(e,s){const t=this.isX;this._matrix.forEach((i=>{i.forEach(((i,o)=>{i._axes.forEach((i=>{if(s<2||t){const o=t?i.options.col:i.options.row;i._calcPoints(e[o],s)}}))}))}))}}class y extends m{constructor(e){super(e,!0)}_doPrepare(e,s,t){const i=this._matrix=new Array(s+1);for(let e=0;e<i.length;e++){i[e]=[];for(let s=0;s<t;s++)i[e].push(new x(e,s))}e.forEach((e=>{var t,o;const r=e.options.position;let n=e.row;"opposite"===r?(n++,e._runPos=r):n<s-1&&"between"===r?(n++,e._runPos="normal"):e._runPos=r,null===(o=null===(t=i[n])||void 0===t?void 0:t[e.col])||void 0===o||o._axes.push(e)}))}}class b extends m{constructor(e){super(e,!1)}_doPrepare(e,s,t){const i=this._matrix=new Array(s);for(let e=0;e<i.length;e++){i[e]=[];for(let s=0;s<=t;s++)i[e].push(new x(e,s))}e.forEach((e=>{var s,o;const r=e.options.position;let n=e.col;"opposite"===r?(n++,e._runPos=r):e.col<t-1&&"between"===r?(n++,e._runPos="normal"):e._runPos=r,null===(o=null===(s=i[e.row])||void 0===s?void 0:s[n])||void 0===o||o._axes.push(e)}))}}class E extends s{constructor(e){super(e.chart),this.pane=e}contains(e){return e.col===this.pane.col||e.row===this.pane.row}}E.defaults=e(s.defaults,{extended:!0,radius:void 0,centerX:void 0,centerY:void 0});class v extends c{constructor(e){super(e.chart),this.pane=e}_doPrepareRender(e){super._doPrepareRender(e),this._location="body"}_getLegendSources(){return this.options.visible?this.chart._getSeries().getLegendSources(this.pane.row,this.pane.col):[]}}class A extends t{constructor(e,s,t){super(e),this.row=s,this.col=t}_doInit(e){e.body=(this._body=new E(this)).init(),e.legend=(this._legend=new v(this)).init()}get body(){return this._body}get legend(){return this._legend}_prepareRender(){this._body._prepareRender(),this._legend._prepareRender()}}class P extends t{constructor(e){super(e),this._cols=1,this._rows=1,this._paneDic={},this._panes=[],this._xAxes=new y(e),this._yAxes=new b(e)}get count(){return this._rows*this._cols}get rowCount(){return this._rows}get colCount(){return this._cols}get paneCount(){return this._rows*this._cols}colSizes(){return this._colSizes}rowSizes(){return this._rowSizes}getPane(e,s){return this._panes[e][s]}getRow(e){return this._panes[e]}getColumn(e){return this._panes.map((s=>s[e]))}getAxisOf(e,s){var t,i;const o=this.chart,r=e.body;if(r){const n=r.pane;return s?o._getXAxes().get(e.options.xAxis)||this._xAxes.get(n.row,n.col)._axes[0]||(null===(t=o._getSeries().getPaneSeries(n.row,n.col)[0])||void 0===t?void 0:t._xAxisObj):o._getXAxes().get(e.options.yAxis)||this._yAxes.get(r.pane.row,r.pane.col)._axes[0]||(null===(i=o._getSeries().getPaneSeries(n.row,n.col)[0])||void 0===i?void 0:i._yAxisObj)}}isValidAxis(e){return e&&e.row<this._rows&&e.col<this._cols}_doLoadProp(e,s){return["panes","cols","rows"].indexOf(e)>=0||super._doLoadProp(e,s)}_doSetSimple(e){if(i(e)&&e.length>0){const s=o(1,+e[0]),t=o(1,r(+e[1],s));return s>0&&t>0&&(this.$_parsePanes(s,t),this.visible=!0),!0}return super._doSetSimple(e)}_load(e){return super._load(e),n(e)&&(this.$_parsePanes(e.rows,e.cols),this._paneDic=this.$_loadPanes(e.panes)),this}_doPrepareRender(e){this._panes=this.$_collectPanes(e),this._panes.forEach((e=>e.forEach((e=>e._prepareRender()))))}_calcSizes(e,s){const t=e.length,i=new Array(t);let o=0;if(t>1){let r=s,n=0;for(o=0;o<t;o++){const s=e[o];h(s)?r-=i[o]=Math.max(0,Math.min(r,s)):n+=s.size}if(n>0)for(o=0;o<t;o++){const s=e[o];h(s)||(i[o]=r*s.size/n)}}else i[o]=s;return i}getXLens(e){return this._calcSizes(this._colSizes,e)}getYLens(e){return this._calcSizes(this._rowSizes,e)}measureAxes(e,s,t,i){const o=this.getXLens(t?s:e),r=this.getYLens(t?e:s);this._xAxes._buildTicks(o,i),this._yAxes._buildTicks(r,i),this.$_calcAxesPoints(o,r,i)}$_calcAxesPoints(e,s,t){this._xAxes._calcPoints(e,t),this._yAxes._calcPoints(s,t)}completeAxesPoints(e,s){this.$_calcAxesPoints(e,s,101)}getBodyAnnotation(e){for(const s in this._paneDic){const t=this._paneDic[s].body.getAnnotation(e);if(t)return t}}prepareRender(e,s){const t=this.chart.isInverted();this._prepareRender(),this._xAxes._prepare(e,this._rows,this._cols,t),this._yAxes._prepare(s,this._rows,this._cols,t)}$_parseSizes(e){let s;return s=i(e)&&e.length>0?e.slice(0):e>0?new Array(e).fill("*"):["*"],s.map((e=>{if(a(e)){const s=e.trim();return{size:"*"===s?1:r(parseFloat(s),1)}}return r(+e,1)}))}$_parsePanes(e,s){this._colSizes=this.$_parseSizes(s),this._rowSizes=this.$_parseSizes(e),this._cols=this._colSizes.length,this._rows=this._rowSizes.length}$_loadPanes(e){const s=this.chart,t=this._op.extendBody?s._body._config:void 0,o={};if(e=i(e)?e:n(e)?[e]:null,i(e)&&e.forEach((e=>{const i=+e.row||0,r=+e.col||0;if(r>=0&&r<this._cols&&i>=0&&i<this._rows){const n=new A(s,i,r);let h=e;n.init(),!t||e&&e.body&&!1===e.body.extended||(e?(h=Object.assign({},e),e.body?!1!==e.body.extended&&(h.body=Object.assign({},t,e.body)):h.body=t):h={body:t}),n._load(h),o[i+","+r]=n}})),t)for(let e=0;e<this._rows;e++)for(let i=0;i<this._cols;i++){const r=e+","+i;if(!o[r]){const n=new A(s,e,i);n.init(),n._load({body:t}),o[r]=n}}return o}$_collectPanes(e){const s=[];for(let t=0;t<this._rows;t++){const i=[];for(let s=0;s<this._cols;s++){const o=this._paneDic[t+","+s]||new A(e,t,s)._initObject();i.push(o)}s.push(i)}return s}}P.defaults=e(t.defaults,{visible:!1,extendBody:!0,gap:0});class C extends u{constructor(){super(...arguments),this.views=[],this._gap=0}isEmpty(){return 0===this.views.length}prepare(e,s,t,i){const o=this.views,r=[];for(this.isX=t,i._axes.forEach((e=>{e.checkVisible()&&s.isValidAxis(e)&&r.push(e)}));o.length<r.length;){const s=new f(e);this.add(s),o.push(s)}for(;o.length>r.length;)o.pop().remove();if(o.forEach(((e,s)=>{e.setModel(r[s])})),this.axes=r,this.setVis(o.length>0)){const e=o[0].model;this._gap=e.chart.getAxesGap()}}prepareGuides(e,s,t){const i=this.views,o=this.axes;i.forEach(((t,i)=>{const r=o[i];s.forEach((s=>{s.forEach((s=>{s.isConnected(r)&&t.setVis(this.visible)&&(t.prepareGuides(e,s.row,s.col,s._guideContainer,s._frontGuideContainer),r._isHorz||(s._axes||(s._axes=[]),s._axes.push(r)))}))}))})),s.forEach((s=>{s.forEach((s=>{s._axes&&(s._gridRowContainer.addAll(e,s._axes),s._axes=[])}))}))}checkHeights(e,s,t){return this.views.length>0?this.$_checkHeights(this.views,e,s,t):0}$_checkHeights(e,s,t,i){let o=0;return e&&(e.forEach((e=>{o+=e.checkHeight(s,t,i)})),o+=(this.views.length-1)*this._gap),o}checkWidths(e,s,t){return this.views.length>0?this.$_checkWidths(this.views,e,s,t):0}$_checkWidths(e,s,t,i){let o=0;return e&&(e.forEach((e=>{o+=e.checkWidth(s,t,i)})),o+=(this.views.length-1)*this._gap),o}getScrollView(e){var s;for(const t of this.views)if(null===(s=t._scrollView)||void 0===s?void 0:s.contains(e))return t._scrollView}setMargins(e,s,t,i){this.views.forEach((o=>o.setMargins(e,s,t,i)))}_setInverted(e){super._setInverted(e),this.isHorz=e&&!this.isX||!e&&this.isX}_doMeasure(e,s,t,i,o){const r=this.axes;if(this.isHorz){let s=0;return this.views.forEach(((n,h)=>{s+=n.measure(e,r[h],t,i,o).height})),{width:t,height:s}}{let s=0;return this.views.forEach(((n,h)=>{s+=n.measure(e,r[h],t,i,o).width})),{width:s,height:i}}}_doLayout(e){const s=this.views,t=this.width,i=this.height,o=s.length;let r=0,n=o-1;if(this.isHorz){let e,h,a=0;for(;r<o;r++){const e=s[r];if(e.model._posValue()<1)break;e.trans(0,a),a+=e.mh}for(e=a,a=i;n>=0;n--){const e=s[n];if(e.model._posValue()>-1)break;a-=e.mh,e.trans(0,a)}h=a;const c=h-e;let l=0;for(let e=r;e<=n;e++)l+=s[e].mh;e+=(c-l)/2;for(let t=r;t<=n;t++){const i=s[t];i.trans(0,e),e+=i.mh}s.forEach((e=>{e.resize(t,e.mh),e.model._calcPoints(t,999),e.layout()}))}else{let e,h,a=0;for(;r<o;r++){const e=s[r];if(e.model._posValue()>-1)break;e.trans(a,0),a+=e.mw}for(e=a,a=t;n>=0;n--){const e=s[n];if(e.model._posValue()<1)break;a-=e.mw,e.trans(a,0)}h=a;const c=h-e;let l=0;for(let e=r;e<=n;e++)l+=s[e].mw;e+=(c-l)/2;for(let t=r;t<=n;t++){const i=s[t];i.trans(e,0),e+=i.mw}s.forEach((e=>{e.resize(e.mw,i),e.model._calcPoints(i,999),e.layout()}))}}}class z extends u{constructor(e,s){super(e,"rct-axis-container"),this.isX=s,this.sections=[]}prepare(e,s,t,i,o){const r=this.isX?t.getRow(i):t.getColumn(i);for(;this.sections.length<r.length;){const s=new C(e);this.add(s),this.sections.push(s)}for(;this.sections.length>r.length;)this.sections.pop().remove();this.sections.forEach(((t,o)=>{this.isX?(t.row=i,t.col=o):(t.col=i,t.row=o),t.prepare(e,s,this.isX,r[o])})),this._setInverted(o)}prepareGuides(e,s,t,i){const o=this.isX?t.getRow(i):t.getColumn(i);for(;this.sections.length<o.length;){const s=new C(e);this.add(s),this.sections.push(s)}for(;this.sections.length>o.length;)this.sections.pop().remove();this.sections.forEach(((o,r)=>{this.isX?(o.row=i,o.col=r):(o.col=i,o.row=r),o.prepareGuides(e,s,t)}))}checkWidths(e,s,t){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,o)=>i+o.checkWidths(e,s,t)),0):this.sections.reduce(((i,o)=>Math.max(i,o.checkWidths(e,s,t))),0):0}checkHeights(e,s,t){return this.sections.length>0?this._isHorz?this.sections.reduce(((i,o)=>Math.max(i,o.checkHeights(e,s,t))),0):this.sections.reduce(((i,o)=>i+o.checkHeights(e,s,t)),0):0}_setInverted(e){super._setInverted(e),this._isHorz=e&&!this.isX||!e&&this.isX}_doMeasure(e,s,t,i,r){let n=0,h=0;return this._isHorz?this.sections.forEach((n=>{h=o(h,n.measure(e,s,t,i,r).height)})):this.sections.forEach((h=>{n=o(n,h.measure(e,s,t,i,r).width)})),{width:n,height:h}}_doLayout(e){this._isHorz?this.height>0&&this.sections.forEach(((s,t)=>{s.resize(e[2*(t+1)]-e[2*(t+1)-1],this.height),s.trans(e[2*t+1]-e[1],0),s.layout()})):this.width>0&&this.sections.forEach(((s,t)=>{s.resize(this.width,e[2*(t+1)]-e[2*(t+1)-1]),s.trans(0,this.height-(e[2*(t+1)]-e[1])),s.layout()}))}}class S extends p{constructor(e,s){super(e,s),this.row=0,this.col=0,this.add(this._legendView=new g(e))}getCol(){return this.col}getRow(){return this.row}getTooltipPos(){return{x:this.parent.parent.tx+this.tx,y:this.parent.parent.ty+this.ty}}prepareRender(e,s){const t=s.chart,i=s.depth.visible,o=this.row,r=this.col,n=t._split.getPane(o,r).body;this._animatable=w._animatable&&t.animatable(),this._prepareSeries(e,s,t._getSeries().getPaneSeries(o,r),i),this._prepareGauges(e,t,t._getGauges().getPaneVisibles(o,r)),this._prepareAnnotations(e,n.getAnnotations().concat(t._getAnnotations().getPaneVisibles(o,r)))}_doMeasure(e,s,t,i,o){return this._legendView.setVis(s.pane.legend.visible)&&this._legendView.measure(e,s.pane.legend,t,i,o),super._doMeasure(e,s,t,i,o)}_doLayout(){super._doLayout();const e=this._legendView;if(e.visible){this._seriesViews.forEach((s=>{if(s.needDecoreateLegend()){const t=e.legendOfSeries(s.model);t&&s.decoreateLegend(t)}}));const s=e.model.options,t=s.align,i=s.verticalAlign;let o=0,r=0,n=+s.offsetX||0;switch(t){case"right":o+=this.width-e.mw-n;break;case"center":o+=(this.width-e.mw)/2+n;break;default:o+=n}switch(n=+s.offsetY||0,i){case"bottom":r+=this.height-e.mh-n;break;case"middle":r+=(this.height-e.mh)/2+n;break;default:r+=n}e.trans(o,r).resize(e.mw,e.mh),e.layout()}}}class $ extends l{constructor(e,s){super(e,$.STYLE_NAME),this._bodies=[],this._xContainers=[],this._yContainers=[],this._owner=s}get bodies(){return this._bodies}bodyViewOf(e){return this._bodies.find((s=>s.contains(e)))}prepare(e,s){s.chart,this.$_init(e),this._model=s,this.$_prepareBodies(e,s)}measure(e,s,t,i,o){const r=s.chart,n=this._inverted=s.chart.isInverted(),h=s._xAxes,a=s._yAxes,c=t,l=i;this.$_prepareAxes(e,h,!0,n),this.$_prepareAxes(e,a,!1,n),s.measureAxes(t,i,n,o),n?(t-=this._xContainers.reduce(((s,o)=>s+o.checkWidths(e,t,i)),0),i-=this._yContainers.reduce(((s,o)=>s+o.checkHeights(e,t,i)),0)):(i-=this._xContainers.reduce(((s,o)=>s+o.checkHeights(e,t,i)),0),t-=this._yContainers.reduce(((s,o)=>s+o.checkWidths(e,t,i)),0)),s.measureAxes(t,i,n,o),this._xContainers.forEach((s=>s.measure(e,r,t,i,o))),this._yContainers.forEach((s=>s.measure(e,r,t,i,o))),t=c,i=l,n?(t-=this._xContainers.reduce(((e,s)=>e+s.mw),0),i-=this._yContainers.reduce(((e,s)=>e+s.mh),0)):(i-=this._xContainers.reduce(((e,s)=>e+s.mh),0),t-=this._yContainers.reduce(((e,s)=>e+s.mw),0)),o++,s.measureAxes(t,i,n,o),this.$_prepareAxisGuides(e,h,!0),this.$_prepareAxisGuides(e,a,!1),this._xContainers.forEach((s=>{s.measure(e,r,t,i,o)})),this._yContainers.forEach((s=>{s.measure(e,r,t,i,o)}));const _=s.getXLens(n?i:t),d=s.getYLens(n?t:i);s.completeAxesPoints(_,d)}layout(){const e=this._model,s=this.width,t=this.height;this._back.resize(s,t),this.$_calcExtents(e,s,t),this.$_layoutAxes(e,!0,s,t),this.$_layoutAxes(e,!1,s,t),this.$_layoutBodies(e,s,t)}seriesByDom(e){for(const s of this._bodies){const t=s.seriesByDom(e);if(t)return t}}getSeries(e){for(const s of this.bodies){const t=s.findSeries(e);if(t)return t}}legendByDom(e){for(const s of this.bodies){const t=s._legendView.legendByDom(e);if(t)return t}}$_init(e){this._back||(this.add(this._back=new _(e)),this._back.setStyles({fill:"none"}),this.add(this._bodyContainer=new d(e,void 0)),this.add(this._axisContainer=new d(e,void 0)))}$_prepareBodies(e,s){s.chart;const t=s.paneCount,i=s.rowCount,o=s.colCount,r=this._bodies,n=this._bodyMap=[];for(;r.length<t;){const s=new S(e,this._owner);this._bodyContainer.add(s),r.push(s)}for(;r.length>t;)r.pop().remove();for(let e=0;e<i;e++){const s=[];for(let t=0;t<o;t++){const i=r[e*o+t];s.push(i),i.row=e,i.col=t}n.push(s)}r.forEach((t=>{t.prepareRender(e,s.getPane(t.row,t.col).body),t.prepareGuideContainers(),t._gridRowContainer.prepare()}))}$_prepareAxes(e,s,t,i){const o=this._model.chart,r=t?this._xContainers:this._yContainers,n=t?s.rows():s.cols();for(;r.length<n;){const s=new z(e,t);this._axisContainer.add(s),r.push(s)}for(;r.length>n;)r.pop().remove();r.forEach(((t,r)=>{t.prepare(e,o,s,r,i)}))}$_prepareAxisGuides(e,s,t){(t?this._xContainers:this._yContainers).forEach(((t,i)=>{t.prepareGuides(e,this._bodyMap,s,i)}))}$_calc(e,s,t,i){const o=t.length,r=new Array(2*(o+1)),n=s-e.reduce(((e,s)=>e+s[i]),0),h=this._model._calcSizes(t,n);let a=0,c=0;for(c=0;c<o;c++)r[2*c]=a,r[2*c+1]=a+=e[c][i],a+=h[c];return r[2*c]=a,r[2*c+1]=a+e[c][i],r}$_calcExtents(e,s,t){this._inverted?(this._rowPoints=this.$_calc(this._xContainers,s,e.rowSizes(),"mw"),this._colPoints=this.$_calc(this._yContainers,t,e.colSizes(),"mh")):(this._rowPoints=this.$_calc(this._xContainers,t,e.rowSizes(),"mh"),this._colPoints=this.$_calc(this._yContainers,s,e.colSizes(),"mw"))}$_layoutAxes(e,s,t,i){const o=this.control._padding,r=this._rowPoints,n=this._colPoints,h=s?this._xContainers:this._yContainers;if(this._inverted)if(s){const e=n[1],s=n[n.length-2]-e;h.forEach(((e,t)=>{e.resize(e.mw,s),e.trans(r[2*t],i-n[n.length-2]),e.layout(n)}))}else{const e=r[1],s=r[r.length-2]-e;h.forEach(((t,h)=>{const a=t.sections;for(let e=0,s=a.length;e<s;e++){const t=a[e],i=0===e?o.left:0,n=e===s-1?o.right:0;let h=0,c=0;s>1&&(h=r[2*e+1]-r[2*e],c=r[2*(e+1)+1]-r[2*(e+1)],0===e?a[e+1].isEmpty()?c=r[2*(e+1)]-r[2*(e+1)-1]:c/=2:e===s-1?a[e-1].isEmpty()?h=r[2*(e-1)]-r[2*(e-1)-1]:h/=2:(a[e-1].isEmpty()?h=r[2*(e-1)]-r[2*(e-1)-1]:h/=2,a[e+1].isEmpty()?c=r[2*(e+1)]-r[2*(e+1)-1]:c/=2)),t.setMargins(i,h,c,n)}t.resize(s,t.mh),t.trans(e,i-n[2*h+1]),t.layout(r)}))}else if(s){const e=n[1];t=n[n.length-2]-e,h.forEach(((s,a)=>{const c=s.sections;for(let e=0,s=c.length;e<s;e++){const t=c[e],i=0===a?o.left:0,l=a===h.length-1?o.right:0;let _=0,d=0;s>1&&(_=n[2*e+1]-n[2*e],d=n[2*(e+1)+1]-n[2*(e+1)],0===e?c[e+1].isEmpty()?d=n[2*(e+1)]-n[2*(e+1)-1]:d/=2:e===s-1?c[e-1].isEmpty()?_=n[2*(e-1)]-n[2*(e-1)-1]:_/=2:(c[e-1].isEmpty()?_=n[2*(e-1)]-n[2*(e-1)-1]:_/=2,c[e+1].isEmpty()?d=n[2*(e+1)]-r[2*(e+1)-1]:d/=2)),t.setMargins(i,_,d,l)}s.resize(t,s.mh),s.trans(e,i-r[2*a+1]),s.layout(n)}))}else{const e=r[r.length-2],s=e-r[1];h.forEach(((t,o)=>{t.resize(t.mw,s),t.trans(n[2*o],i-e),t.layout(r)}))}}$_layoutBodies(e,s,t){const i=e.rowCount,o=e.colCount,r=this._rowPoints,n=this._colPoints,h=this._bodies;if(this._inverted)for(let s=0;s<i;s++){const t=r[2*(s+1)-1],i=r[2*(s+1)];for(let r=0;r<o;r++){const a=h[s*o+r],c=n[2*r+1],l=n[2*(r+1)];a.measure(this.doc,e.getPane(s,r).body,i-t,l-c,1),a.resize(i-t,l-c),a.trans(t,this.height-l),a.layout()}}else for(let s=0;s<i;s++){const i=r[2*(s+1)-1],a=r[2*(s+1)];for(let r=0;r<o;r++){const c=h[s*o+r],l=n[2*(r+1)-1],_=n[2*(r+1)];c.measure(this.doc,e.getPane(s,r).body,_-l,a-i,1),c.resize(_-l,a-i),c.trans(l,t-a),c.layout()}}}}function k(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.ChartObject.registerSplitClass(P),e.ChartView.registerPaneClass($))}$.STYLE_NAME="rct-panes";export{P as Split,k as default,k as registerSplit};
|
package/treemap.js
CHANGED
package/treemap.mjs
CHANGED
package/vector.js
CHANGED
package/vector.mjs
CHANGED
package/wordcloud.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealChart Wordcloud v1.4.
|
|
3
|
+
* RealChart Wordcloud v1.4.8
|
|
4
4
|
* Copyright (C) 2023-2025 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,(function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this._op,s=i.text;let n=[];if(s){const t=Math.max(i.minLength||1,1),e={};let r=i.excludes,o=s.split(/\s+/g);Array.isArray(r)&&r.length>0&&(o=o.filter((t=>r.indexOf(t)<0))),o.forEach((i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)}));for(const t in e)n.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)n.push({x:e.toStr(t[i]),y:t[i+1]||0});n.length>0&&(t=n.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0});const a=Math.floor;class h{constructor(t){this._options=t}start(t,i,s,n,r,o){this._container=t;const a="circle"===s.frame||"ellipse"===s.frame,h=s.autoScale,l=e.pickNum(s.seed,0)*Math.PI*2/360,c=Math.max(0,e.pickNum(s.wordGap,0));let d=n,u=0,_=r,x=0,p=0;this._prepare(s,n,r),this._unit,i.forEach((t=>{const e=t.point;if(this._findPos(t,a,s.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),u=Math.max(u,i+n),_=Math.min(_,s),x=Math.max(x,s+r),p++}else t.setVis(!1)})),e.Utils.log("Words placed.",p,"of",i.length);const m=u-d,f=x-_,g=n/2,y=r/2,M=h?1/(Math.max(m/n,f/r)+.02):1,w=~~((d+m/2-g)*M),P=~~((_+f/2-y)*M);return this._trans={x:w,y:P,cx:g,cy:y,rate:M},i.forEach((t=>{const e=t.point;e.xPos=g-w+(e.xPos-g)*M,e.yPos=y-P+(e.yPos-y)*M})),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:r}=this._trans;e=~~(e*t),i=~~(i*t),this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(r*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=t*this._unit;let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,d=a+l,u=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:d},{x:c,y:d}].map((t=>({x:u+(t.x-u)*n-(t.y-_)*r,y:_+(t.x-u)*r+(t.y-_)*n}))),p=Math.min(...x.map((t=>t.x))),m=Math.min(...x.map((t=>t.y))),f=Math.max(...x.map((t=>t.x))),g=Math.max(...x.map((t=>t.y))),y=this._unit,M=f-p,w=g-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:p,y:m,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),d=Math.ceil(l/2),u=Math.max(0,e-c),_=Math.max(0,i-d),x=u+Math.ceil(h),p=_+Math.ceil(l),m={x:(e-c)*r,y:(i-d)*r,width:o,height:a};return n?this._rotatePoint(m,n,s):{c1:u,r1:_,c2:x+s,r2:p,bounds:m}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(n);if(n.some(((i,s)=>{let n=this._options.rotation?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}})))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,d=c*Math.cos(l)/n,u=c*Math.sin(l),_=s.c+d,x=s.r+u;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const d=Math.max(1,this._unit>>1),u=d-Math.max(1,d>>1),_=.99;for(;++o>=0;){e=1+u*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class d extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.ElementPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_renderSeries(t,i){const s=this.model.options,n=s.text;if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();if(s.minWeight>0&&(o=o.filter((t=>t.yValue>=s.minWeight))),s.minLength>1&&(o=o.filter((t=>t.x.length>=s.minLength))),s.maxCount<o.length&&(o.length=Math.max(0,s.maxCount)),this.$_prepareWords(this.doc,this.model,o),"spiral"===s.placer)this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const d=n===r||l===h,u=d?NaN:i.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.options.textHeight)),p=isNaN(x)?t.createElement("canvas").getContext("2d"):null,m=1-c.TOP_PAD;let f;this._words.prepare(s.length,((r,a)=>{const c=r.point=s[a],g=r.textView;let y=(c.y-n)/o;u>1&&(y=1-(Math.pow(u,1-y)-1)/(u-1));let M=l+(d?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),p?(p.font=`${e.pixel(M)} ${_}`,f=p.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*m):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function u(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,d]))}u(s),t.WordCloudSeries=o,t.default=u,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
7
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,(function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this._op,s=i.text;let n=[];if(s){const t=Math.max(i.minLength||1,1),e={};let r=i.excludes,o=s.split(/\s+/g);Array.isArray(r)&&r.length>0&&(o=o.filter((t=>r.indexOf(t)<0))),o.forEach((i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)}));for(const t in e)n.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)n.push({x:e.toStr(t[i]),y:t[i+1]||0});n.length>0&&(t=n.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const a=Math.floor;class h{constructor(t){this._options=t}start(t,i,s,n,r,o){this._container=t;const a="circle"===s.frame||"ellipse"===s.frame,h=s.autoScale,l=e.pickNum(s.seed,0)*Math.PI*2/360,c=Math.max(0,e.pickNum(s.wordGap,0));let d=n,u=0,_=r,x=0,m=0;this._prepare(s,n,r),this._unit,this._startTime=Date.now(),i.forEach((t=>{const e=t.point;if(this._findPos(t,a,s.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),u=Math.max(u,i+n),_=Math.min(_,s),x=Math.max(x,s+r),m++}else t.setVis(!1)})),e.Utils.log("Words placed.",m,"of",i.length);const p=u-d,f=x-_,g=n/2,y=r/2,M=h?1/(Math.max(p/n,f/r)+.02):1,w=~~((d+p/2-g)*M),P=~~((_+f/2-y)*M);return this._trans={x:w,y:P,cx:g,cy:y,rate:M},i.forEach((t=>{const e=t.point;e.xPos=g-w+(e.xPos-g)*M,e.yPos=y-P+(e.yPos-y)*M})),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:i,y:s,cx:n,cy:r,rate:o}=this._trans;if(i=~~(i*t),s=~~(s*t),e.isIE){const e=o*t,a=n*(1-e),h=r*(1-e);this._container.trans(-i+a,-s+h),this._container.scale(e)}else this._container.dom.setAttribute("transform-origin",`${n} ${r}`),this._container.trans(-i,-s),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=Math.min(t*this._unit,64);let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,d=a+l,u=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:d},{x:c,y:d}].map((t=>({x:u+(t.x-u)*n-(t.y-_)*r,y:_+(t.x-u)*r+(t.y-_)*n}))),m=Math.min(...x.map((t=>t.x))),p=Math.min(...x.map((t=>t.y))),f=Math.max(...x.map((t=>t.x))),g=Math.max(...x.map((t=>t.y))),y=this._unit,M=f-m,w=g-p;return{c1:Math.max(0,~~(m/y)),r1:Math.max(0,~~(p/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:m,y:p,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),d=Math.ceil(l/2),u=Math.max(0,e-c),_=Math.max(0,i-d),x=u+Math.ceil(h),m=_+Math.ceil(l),p={x:(e-c)*r,y:(i-d)*r,width:o,height:a};return n?this._rotatePoint(p,n,s):{c1:u,r1:_,c2:x+s,r2:m,bounds:p}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=Date.now()-this._startTime;if(n>e.pickNum(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${n} ms 경과하여 중단합니다.`);const d=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(d);if(d.some(((i,s)=>{let n=this._options.rotation?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}})))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,d=c*Math.cos(l)/n,u=c*Math.sin(l),_=s.c+d,x=s.r+u;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const d=Math.max(1,this._unit>>1),u=d-Math.max(1,d>>1),_=.99;for(;++o>=0;){e=1+u*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class d extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.ElementPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,i){const s=this.model.options,n=s.text;if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();if(s.minWeight>0&&(o=o.filter((t=>t.yValue>=s.minWeight))),s.minLength>1&&(o=o.filter((t=>t.x.length>=s.minLength))),s.maxCount<o.length&&(o.length=Math.max(0,s.maxCount)),this.$_prepareWords(this.doc,this.model,o),"spiral"===s.placer)this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const d=n===r||l===h,u=d?NaN:i.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.options.textHeight)),m=isNaN(x)?t.createElement("canvas").getContext("2d"):null,p=1-c.TOP_PAD;let f;this._words.prepare(s.length,((r,a)=>{const c=r.point=s[a],g=r.textView;r._bbox=null;let y=(c.y-n)/o;u>1&&(y=1-(Math.pow(u,1-y)-1)/(u-1));let M=l+(d?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),m?(m.font=`${e.pixel(M)} ${_}`,f=m.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*p):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function u(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,d]))}u(s),t.WordCloudSeries=o,t.default=u,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/wordcloud.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealChart Wordcloud v1.4.
|
|
3
|
+
* RealChart Wordcloud v1.4.8
|
|
4
4
|
* Copyright (C) 2023-2025 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
|
-
import{WordCloudSeriesType as t,extend as e,WidgetSeries as i,calcPercent as s,parsePercentSize as n,Utils as o,toStr as r,WidgetSeriesPoint as a,RcElement as h,SeriesView as l,RectElement as c,TextElement as _,WidgetSeriesView as d,LayerElement as x,ElementPool as u,SeriesAnimation as m,TextAnchor as p,pixel as g,pickNum as M}from"./index.mjs";class y extends a{}class f extends y{constructor(t,e){super(t),this.points=e}}class w extends i{$_denormalizeFontSize(t,e,i){let o,r;return"min"==t?(o=s(n(w.MinFontSize,!1),e),r=s(n(w.MaxMinFontSize,!1),e)):(o=s(n(w.MinMaxFontSize,!1),e),r=s(n(w.MaxFontSize,!1),e)),i>1?r:i<0?o:i*(r-o)+o}calcFontRatio(t,e,i,n){return s(e,i,n)}getMinFontSize(t,e){const{fixed:i,size:o}=this._minFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("min",t,o):s(this._minFontSizeDim,t,e);return Math.max(s(n(w.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:o}=this._maxFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("max",t,o):s(this._maxFontSizeDim,t,e);return Math.min(s(n(w.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new y(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new f(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||o.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this._op,i=e.text;let s=[];if(i){const t=Math.max(e.minLength||1,1),n={};let o=e.excludes,r=i.split(/\s+/g);Array.isArray(o)&&o.length>0&&(r=r.filter((t=>o.indexOf(t)<0))),r.forEach((e=>{e.length>=t&&(e in n?n[e]++:n[e]=1)}));for(const t in n)s.push({x:t,y:n[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)s.push({x:r(t[e]),y:t[e+1]||0});s.length>0&&(t=s.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null)}}w.type=t,w.MinFontSize=8,w.MaxMinFontSize=15,w.MaxFontSize="15%",w.MinMaxFontSize="5%",w.defaults=e(i.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0});const S=Math.floor;class P{constructor(t){this._options=t}start(t,e,i,s,n,r){this._container=t;const a="circle"===i.frame||"ellipse"===i.frame,h=i.autoScale,l=M(i.seed,0)*Math.PI*2/360,c=Math.max(0,M(i.wordGap,0));let _=s,d=0,x=n,u=0,m=0;this._prepare(i,s,n),this._unit,e.forEach((t=>{const e=t.point;if(this._findPos(t,a,i.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,_=Math.min(_,i),d=Math.max(d,i+n),x=Math.min(x,s),u=Math.max(u,s+o),m++}else t.setVis(!1)})),o.log("Words placed.",m,"of",e.length);const p=d-_,g=u-x,y=s/2,f=n/2,w=h?1/(Math.max(p/s,g/n)+.02):1,S=~~((_+p/2-y)*w),P=~~((x+g/2-f)*w);return this._trans={x:S,y:P,cx:y,cy:f,rate:w},e.forEach((t=>{const e=t.point;e.xPos=y-S+(e.xPos-y)*w,e.yPos=f-P+(e.yPos-f)*w})),this.$_transform(),null==r||r(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;e=~~(e*t),i=~~(i*t),this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=S(e/s),this._rows=S(i/s),this._radius=S(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=t*this._unit;let r=0,a=[];for(0===t&&a.push([s.c,s.r]);r<o;){const h=r/o*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:a,width:h,height:l}=t,c=r+h,_=a+l,d=r+h/2,x=a+l/2,u=[{x:r,y:a},{x:c,y:a},{x:r,y:_},{x:c,y:_}].map((t=>({x:d+(t.x-d)*n-(t.y-x)*o,y:x+(t.x-d)*o+(t.y-x)*n}))),m=Math.min(...u.map((t=>t.x))),p=Math.min(...u.map((t=>t.y))),g=Math.max(...u.map((t=>t.x))),M=Math.max(...u.map((t=>t.y))),y=this._unit,f=g-m,w=M-p;return{c1:Math.max(0,~~(m/y)),r1:Math.max(0,~~(p/y)),c2:~~(g/y),r2:~~(M/y)+i,bounds:{x:m,y:p,width:f,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),a=t.hText,h=r/o,l=a/o,c=Math.ceil(h/2),_=Math.ceil(l/2),d=Math.max(0,e-c),x=Math.max(0,i-_),u=d+Math.ceil(h),m=x+Math.ceil(l),p={x:(e-c)*o,y:(i-_)*o,width:r,height:a};return n?this._rotatePoint(p,n,s):{c1:d,r1:x,c2:u+s,r2:m,bounds:p}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,a=c.create(i,"",s,n,o,r);a.setFill((null==e?void 0:e.fill)||"#ff000055"),a.setStroke((null==e?void 0:e.stroke)||"none"),a.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(a)}_findPos(t,e,i,s,n,r){let a=0,h=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<s;){const s=this._getPoints(a,e,n+h++%4*(Math.PI/4));i&&o.shuffle(s);if(s.some(((e,i)=>{let s=this._options.rotation?l[~~(o.randomLike(i+n)*c)]:0;const a=this._getBox(t,e[0],e[1],r,s);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],r),{bounds:n}=i,o={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(o.x,o.y,s),t.box=a,!0}})))return!0;a++}}}class z extends P{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*h,c=t*e,_=c*Math.cos(l)/n,d=c*Math.sin(l),x=s.c+_,u=s.r+d;a.push([~~x,~~u])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),d=_-Math.max(1,_>>1),x=.99;for(;++r>=0;){e=1+d*Math.pow(x,r),o=e/n;switch(3&(h*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,a=Math.min(2*this._radius,Math.max(0,e-S(o.width/2/n))),h=Math.min(2*this._radius,Math.max(0,i-S(r/2/n)));return{c1:a,r1:h,c2:a+S(o.width/n)+s,r2:h+S(r/n),w:t.width,h:r}}}class F extends h{constructor(t){super(t,l.POINT_CLASS),this.add(this.hintView=new c(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new _(t)),this.textView.setStyle("pointerEvents","none")}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*F.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*F.TOP_PAD)}}F.TOP_PAD=.5;class b extends d{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new x(t,null)),this._words=new u(this._wordContainer,F)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_renderSeries(t,e){const i=this.model.options,s=i.text;if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let r=this._visPoints.slice();if(i.minWeight>0&&(r=r.filter((t=>t.yValue>=i.minWeight))),i.minLength>1&&(r=r.filter((t=>t.x.length>=i.minLength))),i.maxCount<r.length&&(r.length=Math.max(0,i.maxCount)),this.$_prepareWords(this.doc,this.model,r),"spiral"===i.placer)this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));else this._placer=new P(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));this._wSave=t,this._hSave=e,this._tSave=s,this._empty=r.length<1,o.log(r.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&m.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,a=e.getMaxFontSize(r,1);let h=Math.min(a,e.getMinFontSize(r,0));const l=s===n||h===a,c=l?NaN:e.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,d=Math.min(2,Math.max(.1,+e.options.textHeight)),x=isNaN(d)?t.createElement("canvas").getContext("2d"):null,u=1-F.TOP_PAD;let m;this._words.prepare(i.length,((n,r)=>{const M=n.point=i[r],y=n.textView;let f=(M.y-s)/o;c>1&&(f=1-(Math.pow(c,1-f)-1)/(c-1));let w=h+(l?(a-h)/2:f*(a-h));const S=M.x;this._preparePoint(t,e,M,n),delete n.box,y.text=S,y.anchor=p.START,y.setStyles({fontSize:g(w)}),y.layoutText(),x?(x.font=`${g(w)} ${_}`,m=x.measureText(S),n.yText=.9*Math.max(0,m.fontBoundingBoxAscent-m.actualBoundingBoxAscent),n.hText=Math.ceil((m.actualBoundingBoxAscent+m.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*u):(n.yText=0,n.hText=n.getBBox().height*d),n.layout(),n.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,o=n.width,r=n.height,a=(t-o)/2;let h=(e-r)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function B(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(w),t.SeriesView.register([w,b]))}export{w as WordCloudSeries,B as default};
|
|
7
|
+
import{WordCloudSeriesType as t,extend as e,WidgetSeries as i,calcPercent as s,parsePercentSize as n,Utils as o,toStr as r,WidgetSeriesPoint as a,RcElement as h,SeriesView as l,RectElement as c,TextElement as _,WidgetSeriesView as x,LayerElement as d,ElementPool as u,SeriesAnimation as m,TextAnchor as p,pixel as g,pickNum as M,isIE as f}from"./index.mjs";class y extends a{}class w extends y{constructor(t,e){super(t),this.points=e}}class S extends i{$_denormalizeFontSize(t,e,i){let o,r;return"min"==t?(o=s(n(S.MinFontSize,!1),e),r=s(n(S.MaxMinFontSize,!1),e)):(o=s(n(S.MinMaxFontSize,!1),e),r=s(n(S.MaxFontSize,!1),e)),i>1?r:i<0?o:i*(r-o)+o}calcFontRatio(t,e,i,n){return s(e,i,n)}getMinFontSize(t,e){const{fixed:i,size:o}=this._minFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("min",t,o):s(this._minFontSizeDim,t,e);return Math.max(s(n(S.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:o}=this._maxFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("max",t,o):s(this._maxFontSizeDim,t,e);return Math.min(s(n(S.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new y(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new w(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||o.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this._op,i=e.text;let s=[];if(i){const t=Math.max(e.minLength||1,1),n={};let o=e.excludes,r=i.split(/\s+/g);Array.isArray(o)&&o.length>0&&(r=r.filter((t=>o.indexOf(t)<0))),r.forEach((e=>{e.length>=t&&(e in n?n[e]++:n[e]=1)}));for(const t in n)s.push({x:t,y:n[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)s.push({x:r(t[e]),y:t[e+1]||0});s.length>0&&(t=s.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null)}}S.type=t,S.MinFontSize=8,S.MaxMinFontSize=15,S.MaxFontSize="15%",S.MinMaxFontSize="5%",S.defaults=e(i.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const P=Math.floor;class b{constructor(t){this._options=t}start(t,e,i,s,n,r){this._container=t;const a="circle"===i.frame||"ellipse"===i.frame,h=i.autoScale,l=M(i.seed,0)*Math.PI*2/360,c=Math.max(0,M(i.wordGap,0));let _=s,x=0,d=n,u=0,m=0;this._prepare(i,s,n),this._unit,this._startTime=Date.now(),e.forEach((t=>{const e=t.point;if(this._findPos(t,a,i.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,_=Math.min(_,i),x=Math.max(x,i+n),d=Math.min(d,s),u=Math.max(u,s+o),m++}else t.setVis(!1)})),o.log("Words placed.",m,"of",e.length);const p=x-_,g=u-d,f=s/2,y=n/2,w=h?1/(Math.max(p/s,g/n)+.02):1,S=~~((_+p/2-f)*w),P=~~((d+g/2-y)*w);return this._trans={x:S,y:P,cx:f,cy:y,rate:w},e.forEach((t=>{const e=t.point;e.xPos=f-S+(e.xPos-f)*w,e.yPos=y-P+(e.yPos-y)*w})),this.$_transform(),null==r||r(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;if(e=~~(e*t),i=~~(i*t),f){const r=o*t,a=s*(1-r),h=n*(1-r);this._container.trans(-e+a,-i+h),this._container.scale(r)}else this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=P(e/s),this._rows=P(i/s),this._radius=P(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=Math.min(t*this._unit,64);let r=0,a=[];for(0===t&&a.push([s.c,s.r]);r<o;){const h=r/o*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:a,width:h,height:l}=t,c=r+h,_=a+l,x=r+h/2,d=a+l/2,u=[{x:r,y:a},{x:c,y:a},{x:r,y:_},{x:c,y:_}].map((t=>({x:x+(t.x-x)*n-(t.y-d)*o,y:d+(t.x-x)*o+(t.y-d)*n}))),m=Math.min(...u.map((t=>t.x))),p=Math.min(...u.map((t=>t.y))),g=Math.max(...u.map((t=>t.x))),M=Math.max(...u.map((t=>t.y))),f=this._unit,y=g-m,w=M-p;return{c1:Math.max(0,~~(m/f)),r1:Math.max(0,~~(p/f)),c2:~~(g/f),r2:~~(M/f)+i,bounds:{x:m,y:p,width:y,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),a=t.hText,h=r/o,l=a/o,c=Math.ceil(h/2),_=Math.ceil(l/2),x=Math.max(0,e-c),d=Math.max(0,i-_),u=x+Math.ceil(h),m=d+Math.ceil(l),p={x:(e-c)*o,y:(i-_)*o,width:r,height:a};return n?this._rotatePoint(p,n,s):{c1:x,r1:d,c2:u+s,r2:m,bounds:p}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,a=c.create(i,"",s,n,o,r);a.setFill((null==e?void 0:e.fill)||"#ff000055"),a.setStroke((null==e?void 0:e.stroke)||"none"),a.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(a)}_findPos(t,e,i,s,n,r){let a=0,h=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<s;){const s=Date.now()-this._startTime;if(s>M(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${s} ms 경과하여 중단합니다.`);const _=this._getPoints(a,e,n+h++%4*(Math.PI/4));i&&o.shuffle(_);if(_.some(((e,i)=>{let s=this._options.rotation?l[~~(o.randomLike(i+n)*c)]:0;const a=this._getBox(t,e[0],e[1],r,s);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],r),{bounds:n}=i,o={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(o.x,o.y,s),t.box=a,!0}})))return!0;a++}}}class z extends b{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*h,c=t*e,_=c*Math.cos(l)/n,x=c*Math.sin(l),d=s.c+_,u=s.r+x;a.push([~~d,~~u])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),x=_-Math.max(1,_>>1),d=.99;for(;++r>=0;){e=1+x*Math.pow(d,r),o=e/n;switch(3&(h*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,a=Math.min(2*this._radius,Math.max(0,e-P(o.width/2/n))),h=Math.min(2*this._radius,Math.max(0,i-P(r/2/n)));return{c1:a,r1:h,c2:a+P(o.width/n)+s,r2:h+P(r/n),w:t.width,h:r}}}class B extends h{constructor(t){super(t,l.POINT_CLASS),this.add(this.hintView=new c(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new _(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*B.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*B.TOP_PAD)}}B.TOP_PAD=.5;class F extends x{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new d(t,null)),this._words=new u(this._wordContainer,B)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,e){const i=this.model.options,s=i.text;if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let r=this._visPoints.slice();if(i.minWeight>0&&(r=r.filter((t=>t.yValue>=i.minWeight))),i.minLength>1&&(r=r.filter((t=>t.x.length>=i.minLength))),i.maxCount<r.length&&(r.length=Math.max(0,i.maxCount)),this.$_prepareWords(this.doc,this.model,r),"spiral"===i.placer)this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));else this._placer=new b(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));this._wSave=t,this._hSave=e,this._tSave=s,this._empty=r.length<1,o.log(r.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&m.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,a=e.getMaxFontSize(r,1);let h=Math.min(a,e.getMinFontSize(r,0));const l=s===n||h===a,c=l?NaN:e.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+e.options.textHeight)),d=isNaN(x)?t.createElement("canvas").getContext("2d"):null,u=1-B.TOP_PAD;let m;this._words.prepare(i.length,((n,r)=>{const M=n.point=i[r],f=n.textView;n._bbox=null;let y=(M.y-s)/o;c>1&&(y=1-(Math.pow(c,1-y)-1)/(c-1));let w=h+(l?(a-h)/2:y*(a-h));const S=M.x;this._preparePoint(t,e,M,n),delete n.box,f.text=S,f.anchor=p.START,f.setStyles({fontSize:g(w)}),f.layoutText(),d?(d.font=`${g(w)} ${_}`,m=d.measureText(S),n.yText=.9*Math.max(0,m.fontBoundingBoxAscent-m.actualBoundingBoxAscent),n.hText=Math.ceil((m.actualBoundingBoxAscent+m.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*u):(n.yText=0,n.hText=n.getBBox().height*x),n.layout(),n.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,o=n.width,r=n.height,a=(t-o)/2;let h=(e-r)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function T(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(S),t.SeriesView.register([S,F]))}export{S as WordCloudSeries,T as default};
|