UNPKG

realchart

Version:

Wooritech charting library

8 lines (6 loc) 23.5 kB
/** * RealChart Split v1.4.12 * Copyright (C) 2023-2026 WooriTech Inc. * All Rights Reserved. */ !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 o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var i,r=o(e),n=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),s=function(){function t(t,e){this.row=t,this.col=e,this._axes=[]}return t.prototype.sort=function(t,e){var o=this,i=e&&!t||!e&&t;this._axes.length>1&&(i?this._axes.sort((function(t,e){var i=t._posValue(),r=e._posValue();return i===r?i<0?e._index-t._index:i>0?t._index-e._index:t.row!==e.row?e.row-t.row:t.row<o.row?e._index-t._index:t._index-e._index:r-i})):this._axes.sort((function(t,e){var i=t._posValue(),r=e._posValue();return i===r?i<0?t._index-e._index:i>0?e._index-t._index:t.col!==e.col?t.col-t.col:t.col<o.col?t._index-e._index:e._index-t._index:i-r})))},t}(),a=function(){function t(t,e){this.chart=t,this.isX=e}return t.prototype.rows=function(){return this._matrix.length},t.prototype.cols=function(){return this._matrix[0].length},t.prototype._prepare=function(t,e,o,i){var r=this;this._doPrepare(t,e,o),this._matrix.forEach((function(t){t.forEach((function(t){return t.sort(r.isX,i)}))}))},t.prototype.get=function(t,e){return this._matrix[t][e]},t.prototype.getRow=function(t){return this._matrix[t]},t.prototype.getColumn=function(t){return this._matrix.map((function(e){return e[t]}))},t.prototype._buildTicks=function(t,e){var o=this.isX;this._matrix.forEach((function(i,r){i.forEach((function(i,r){i._axes.forEach((function(i){!i.isBased()&&(e<2||o)&&i._buildTicks(t[o?i.options.col:i.options.row],e)}))}))})),this._matrix.forEach((function(i,r){i.forEach((function(i,r){i._axes.forEach((function(i){i.isBased()&&(e<2||o)&&i._buildTicks(t[o?i.options.col:i.options.row],e)}))}))}))},t.prototype._calcPoints=function(t,e){var o=this.isX;this._matrix.forEach((function(i){i.forEach((function(i,r){i._axes.forEach((function(i){if(e<2||o){var r=o?i.options.col:i.options.row;i._calcPoints(t[r],e)}}))}))}))},t}(),c=function(t){function e(e){return t.call(this,e,!0)||this}return n(e,t),e.prototype._doPrepare=function(t,e,o){for(var i=this._matrix=new Array(e+1),r=0;r<i.length;r++){i[r]=[];for(var n=0;n<o;n++)i[r].push(new s(r,n))}t.forEach((function(t){var o,r,n=t.options.position,s=t.row;"opposite"===n?(s++,t._runPos=n):s<e-1&&"between"===n?(s++,t._runPos="normal"):t._runPos=n,null===(r=null===(o=i[s])||void 0===o?void 0:o[t.col])||void 0===r||r._axes.push(t)}))},e}(a),h=function(t){function e(e){return t.call(this,e,!1)||this}return n(e,t),e.prototype._doPrepare=function(t,e,o){for(var i=this._matrix=new Array(e),r=0;r<i.length;r++){i[r]=[];for(var n=0;n<=o;n++)i[r].push(new s(r,n))}t.forEach((function(t){var e,r,n=t.options.position,s=t.col;"opposite"===n?(s++,t._runPos=n):t.col<o-1&&"between"===n?(s++,t._runPos="normal"):t._runPos=n,null===(r=null===(e=i[t.row])||void 0===e?void 0:e[s])||void 0===r||r._axes.push(t)}))},e}(a),u=function(){var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),p=function(t){function o(e){var o=t.call(this,e.chart)||this;return o.pane=e,o}return u(o,t),o.prototype.contains=function(t){return t.col===this.pane.col||t.row===this.pane.row},o.defaults=e.extend(e.Body.defaults,{extended:!0,radius:void 0,centerX:void 0,centerY:void 0}),o}(e.Body),f=function(t){function e(e){var o=t.call(this,e.chart)||this;return o.pane=e,o}return u(e,t),e.prototype._doPrepareRender=function(e){t.prototype._doPrepareRender.call(this,e),this._location="body"},e.prototype._getLegendSources=function(){return this.options.visible?this.chart._getSeries().getLegendSources(this.pane.row,this.pane.col):[]},e}(e.Legend),l=function(t){function e(e,o,i){var r=t.call(this,e)||this;return r.row=o,r.col=i,r}return u(e,t),e.prototype._doInit=function(t){t.body=(this._body=new p(this)).init(),t.legend=(this._legend=new f(this)).init()},Object.defineProperty(e.prototype,"body",{get:function(){return this._body},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"legend",{get:function(){return this._legend},enumerable:!1,configurable:!0}),e.prototype._prepareRender=function(){this._body._prepareRender(),this._legend._prepareRender()},e}(e.ChartItem),_=function(t){function o(e){var o=t.call(this,e)||this;return o._cols=1,o._rows=1,o._paneDic={},o._panes=[],o._xAxes=new c(e),o._yAxes=new h(e),o}return u(o,t),Object.defineProperty(o.prototype,"count",{get:function(){return this._rows*this._cols},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rowCount",{get:function(){return this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"colCount",{get:function(){return this._cols},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"paneCount",{get:function(){return this._rows*this._cols},enumerable:!1,configurable:!0}),o.prototype.colSizes=function(){return this._colSizes},o.prototype.rowSizes=function(){return this._rowSizes},o.prototype.getPane=function(t,e){return this._panes[t][e]},o.prototype.getRow=function(t){return this._panes[t]},o.prototype.getColumn=function(t){return this._panes.map((function(e){return e[t]}))},o.prototype.getAxisOf=function(t,e){var o,i,r=this.chart,n=t.body;if(n){var s=n.pane;return e?r._getXAxes().get(t.options.xAxis)||this._xAxes.get(s.row,s.col)._axes[0]||(null===(o=r._getSeries().getPaneSeries(s.row,s.col)[0])||void 0===o?void 0:o._xAxisObj):r._getXAxes().get(t.options.yAxis)||this._yAxes.get(n.pane.row,n.pane.col)._axes[0]||(null===(i=r._getSeries().getPaneSeries(s.row,s.col)[0])||void 0===i?void 0:i._yAxisObj)}},o.prototype.isValidAxis=function(t){return t&&t.row<this._rows&&t.col<this._cols},o.prototype._doLoadProp=function(e,o){return["panes","cols","rows"].indexOf(e)>=0||t.prototype._doLoadProp.call(this,e,o)},o.prototype._doSetSimple=function(o){if(e.isArray(o)&&o.length>0){var i=e.maxv(1,+o[0]),r=e.maxv(1,e.pickNum(+o[1],i));return i>0&&r>0&&(this.$_parsePanes(i,r),this.visible=!0),!0}return t.prototype._doSetSimple.call(this,o)},o.prototype._load=function(o){return t.prototype._load.call(this,o),e.isObject(o)&&(this.$_parsePanes(o.rows,o.cols),this._paneDic=this.$_loadPanes(o.panes)),this},o.prototype._doPrepareRender=function(t){this._panes=this.$_collectPanes(t),this._panes.forEach((function(t){return t.forEach((function(t){return t._prepareRender()}))}))},o.prototype._calcSizes=function(t,o){var i=t.length,r=new Array(i),n=0;if(i>1){var s=o,a=0;for(n=0;n<i;n++){var c=t[n];e.isNumber(c)?s-=r[n]=Math.max(0,Math.min(s,c)):a+=c.size}if(a>0)for(n=0;n<i;n++){c=t[n];e.isNumber(c)||(r[n]=s*c.size/a)}}else r[n]=o;return r},o.prototype.getXLens=function(t){return this._calcSizes(this._colSizes,t)},o.prototype.getYLens=function(t){return this._calcSizes(this._rowSizes,t)},o.prototype.measureAxes=function(t,e,o,i){var r=this.getXLens(o?e:t),n=this.getYLens(o?t:e);this._xAxes._buildTicks(r,i),this._yAxes._buildTicks(n,i),this.$_calcAxesPoints(r,n,i)},o.prototype.$_calcAxesPoints=function(t,e,o){this._xAxes._calcPoints(t,o),this._yAxes._calcPoints(e,o)},o.prototype.completeAxesPoints=function(t,e){this.$_calcAxesPoints(t,e,101)},o.prototype.getBodyAnnotation=function(t){for(var e in this._paneDic){var o=this._paneDic[e].body.getAnnotation(t);if(o)return o}},o.prototype.prepareRender=function(t,e){var o=this.chart.isInverted();this._prepareRender(),this._xAxes._prepare(t,this._rows,this._cols,o),this._yAxes._prepare(e,this._rows,this._cols,o)},o.prototype.$_parseSizes=function(t){return(e.isArray(t)&&t.length>0?t.slice(0):t>0?new Array(t).fill("*"):["*"]).map((function(t){if(e.isString(t)){var o=t.trim();return{size:"*"===o?1:e.pickNum(parseFloat(o),1)}}return e.pickNum(+t,1)}))},o.prototype.$_parsePanes=function(t,e){this._colSizes=this.$_parseSizes(e),this._rowSizes=this.$_parseSizes(t),this._cols=this._colSizes.length,this._rows=this._rowSizes.length},o.prototype.$_loadPanes=function(t){var o=this,i=this.chart,r=this._op.extendBody?i._body._config:void 0,n={};if(t=e.isArray(t)?t:e.isObject(t)?[t]:null,e.isArray(t)&&t.forEach((function(t){var e=+t.row||0,s=+t.col||0;if(s>=0&&s<o._cols&&e>=0&&e<o._rows){var a=new l(i,e,s),c=t;a.init(),!r||t&&t.body&&!1===t.body.extended||(t?(c=Object.assign({},t),t.body?!1!==t.body.extended&&(c.body=Object.assign({},r,t.body)):c.body=r):c={body:r}),a._load(c),n[e+","+s]=a}})),r)for(var s=0;s<this._rows;s++)for(var a=0;a<this._cols;a++){var c=s+","+a;if(!n[c]){var h=new l(i,s,a);h.init(),h._load({body:r}),n[c]=h}}return n},o.prototype.$_collectPanes=function(t){for(var e=[],o=0;o<this._rows;o++){for(var i=[],r=0;r<this._cols;r++){var n=this._paneDic[o+","+r]||new l(t,o,r)._initObject();i.push(n)}e.push(i)}return e},o.defaults=e.extend(e.ChartItem.defaults,{visible:!1,extendBody:!0,gap:0}),o}(e.ChartItem),d=function(){var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.views=[],e._gap=0,e}return d(e,t),e.prototype.isEmpty=function(){return 0===this.views.length},e.prototype.prepare=function(t,e,o,i,r){var n=this.views,s=[];for(this.isX=i,r._axes.forEach((function(t){t.checkVisible()&&o.isValidAxis(t)&&s.push(t)}));n.length<s.length;){var a=e.createAxisView(t);this.add(a),n.push(a)}for(;n.length>s.length;)n.pop().remove();if(n.forEach((function(t,e){t.setModel(s[e])})),this.axes=s,this.setVis(n.length>0)){var c=n[0].model;this._gap=c.chart.getAxesGap()}},e.prototype.prepareGuides=function(t,e,o){var i=this,r=this.views,n=this.axes;r.forEach((function(o,r){var s=n[r];e.forEach((function(e){e.forEach((function(e){e.isConnected(s)&&o.setVis(i.visible)&&(o.prepareGuides(t,e.row,e.col,e._guideContainer,e._frontGuideContainer),s._isHorz||(e._axes||(e._axes=[]),e._axes.push(s)))}))}))})),e.forEach((function(e){e.forEach((function(e){e._axes&&(e._gridRowContainer.addAll(t,e._axes),e._axes=[])}))}))},e.prototype.checkHeights=function(t,e,o){return this.views.length>0?this.$_checkHeights(this.views,t,e,o):0},e.prototype.$_checkHeights=function(t,e,o,i){var r=0;return t&&(t.forEach((function(t){r+=t.checkHeight(e,o,i)})),r+=(this.views.length-1)*this._gap),r},e.prototype.checkWidths=function(t,e,o){return this.views.length>0?this.$_checkWidths(this.views,t,e,o):0},e.prototype.$_checkWidths=function(t,e,o,i){var r=0;return t&&(t.forEach((function(t){r+=t.checkWidth(e,o,i)})),r+=(this.views.length-1)*this._gap),r},e.prototype.getScrollView=function(t){for(var e,o=0,i=this.views;o<i.length;o++){var r=i[o];if(null===(e=r._scrollView)||void 0===e?void 0:e.contains(t))return r._scrollView}},e.prototype.setMargins=function(t,e,o,i){this.views.forEach((function(r){return r.setMargins(t,e,o,i)}))},e.prototype._setInverted=function(e){t.prototype._setInverted.call(this,e),this.isHorz=e&&!this.isX||!e&&this.isX},e.prototype._doMeasure=function(t,e,o,i,r){var n=this.axes;if(this.isHorz){var s=0;return this.views.forEach((function(e,a){s+=e.measure(t,n[a],o,i,r).height})),{width:o,height:s}}var a=0;return this.views.forEach((function(e,s){a+=e.measure(t,n[s],o,i,r).width})),{width:a,height:i}},e.prototype._doLayout=function(t){var e=this.views,o=this.width,i=this.height,r=e.length,n=0,s=r-1;if(this.isHorz){for(var a=0,c=void 0;n<r;n++){if((d=e[n]).model._posValue()<1)break;d.trans(0,a),a+=d.mh}for(c=a,a=i;s>=0;s--){if((d=e[s]).model._posValue()>-1)break;a-=d.mh,d.trans(0,a)}for(var h=a-c,u=0,p=n;p<=s;p++)u+=e[p].mh;c+=(h-u)/2;for(p=n;p<=s;p++){(d=e[p]).trans(0,c),c+=d.mh}e.forEach((function(t){t.resize(o,t.mh),t.model._calcPoints(o,999),t.layout()}))}else{for(var f=0,l=void 0;n<r;n++){if((d=e[n]).model._posValue()>-1)break;d.trans(f,0),f+=d.mw}for(l=f,f=o;s>=0;s--){if((d=e[s]).model._posValue()<1)break;f-=d.mw,d.trans(f,0)}var _=f-l;for(u=0,p=n;p<=s;p++)u+=e[p].mw;l+=(_-u)/2;for(p=n;p<=s;p++){var d;(d=e[p]).trans(l,0),l+=d.mw}e.forEach((function(t){t.resize(t.mw,i),t.model._calcPoints(i,999),t.layout()}))}},e}(e.SectionView),g=function(t){function o(e,o){var i=t.call(this,e,"rct-axis-container")||this;return i.isX=o,i.sections=[],i}return d(o,t),o.prototype.prepare=function(t,e,o,i,r,n){for(var s=this,a=this.isX?i.getRow(r):i.getColumn(r);this.sections.length<a.length;){var c=new y(t);this.add(c),this.sections.push(c)}for(;this.sections.length>a.length;)this.sections.pop().remove();this.sections.forEach((function(i,n){s.isX?(i.row=r,i.col=n):(i.col=r,i.row=n),i.prepare(t,e,o,s.isX,a[n])})),this._setInverted(n)},o.prototype.prepareGuides=function(t,e,o,i){for(var r=this,n=this.isX?o.getRow(i):o.getColumn(i);this.sections.length<n.length;){var s=new y(t);this.add(s),this.sections.push(s)}for(;this.sections.length>n.length;)this.sections.pop().remove();this.sections.forEach((function(n,s){r.isX?(n.row=i,n.col=s):(n.col=i,n.row=s),n.prepareGuides(t,e,o)}))},o.prototype.checkWidths=function(t,e,o){return this.sections.length>0?this._isHorz?this.sections.reduce((function(i,r){return i+r.checkWidths(t,e,o)}),0):this.sections.reduce((function(i,r){return Math.max(i,r.checkWidths(t,e,o))}),0):0},o.prototype.checkHeights=function(t,e,o){return this.sections.length>0?this._isHorz?this.sections.reduce((function(i,r){return Math.max(i,r.checkHeights(t,e,o))}),0):this.sections.reduce((function(i,r){return i+r.checkHeights(t,e,o)}),0):0},o.prototype._setInverted=function(e){t.prototype._setInverted.call(this,e),this._isHorz=e&&!this.isX||!e&&this.isX},o.prototype._doMeasure=function(t,o,i,r,n){var s=0,a=0;return this._isHorz?this.sections.forEach((function(s){a=e.maxv(a,s.measure(t,o,i,r,n).height)})):this.sections.forEach((function(a){s=e.maxv(s,a.measure(t,o,i,r,n).width)})),{width:s,height:a}},o.prototype._doLayout=function(t){var e=this;this._isHorz?this.height>0&&this.sections.forEach((function(o,i){o.resize(t[2*(i+1)]-t[2*(i+1)-1],e.height),o.trans(t[2*i+1]-t[1],0),o.layout()})):this.width>0&&this.sections.forEach((function(o,i){o.resize(e.width,t[2*(i+1)]-t[2*(i+1)-1]),o.trans(0,e.height-(t[2*(i+1)]-t[1])),o.layout()}))},o}(e.SectionView),v=function(t){function o(o,i){var r=t.call(this,o,i)||this;return r.row=0,r.col=0,r.add(r._legendView=new e.LegendView(o)),r}return d(o,t),o.prototype.getCol=function(){return this.col},o.prototype.getRow=function(){return this.row},o.prototype.getTooltipPos=function(){return{x:this.parent.parent.tx+this.tx,y:this.parent.parent.ty+this.ty}},o.prototype.prepareRender=function(t,o){var i=o.chart,r=o.depth.visible,n=this.row,s=this.col,a=i._split.getPane(n,s).body;this._animatable=e.RcControl._animatable&&i.animatable(),this._prepareSeries(t,o,i._getSeries().getPaneSeries(n,s),r),this._prepareGauges(t,i,i._getGauges().getPaneVisibles(n,s)),this._prepareAnnotations(t,a.getAnnotations().concat(i._getAnnotations().getPaneVisibles(n,s)))},o.prototype._doMeasure=function(e,o,i,r,n){return this._legendView.setVis(o.pane.legend.visible)&&this._legendView.measure(e,o.pane.legend,i,r,n),t.prototype._doMeasure.call(this,e,o,i,r,n)},o.prototype._doLayout=function(){t.prototype._doLayout.call(this);var e=this._legendView;if(e.visible){this._seriesViews.forEach((function(t){if(t.needDecoreateLegend()){var o=e.legendOfSeries(t.model);o&&t.decoreateLegend(o)}}));var o=e.model.options,i=o.align,r=o.verticalAlign,n=0,s=0,a=+o.offsetX||0;switch(i){case"right":n+=this.width-e.mw-a;break;case"center":n+=(this.width-e.mw)/2+a;break;default:n+=a}switch(a=+o.offsetY||0,r){case"bottom":s+=this.height-e.mh-a;break;case"middle":s+=(this.height-e.mh)/2+a;break;default:s+=a}e.trans(n,s).resize(e.mw,e.mh),e.layout()}},o}(e.BodyView),w=function(t){function o(e,i){var r=t.call(this,e,o.STYLE_NAME)||this;return r._bodies=[],r._xContainers=[],r._yContainers=[],r._owner=i,r}return d(o,t),Object.defineProperty(o.prototype,"bodies",{get:function(){return this._bodies},enumerable:!1,configurable:!0}),o.prototype.bodyViewOf=function(t){return this._bodies.find((function(e){return e.contains(t)}))},o.prototype.prepare=function(t,e){e.chart,this.$_init(t),this._model=e,this.$_prepareBodies(t,e)},o.prototype.measure=function(t,e,o,i,r){var n=e.chart,s=this._inverted=e.chart.isInverted(),a=e._xAxes,c=e._yAxes,h=o,u=i;this.$_prepareAxes(t,a,!0,s),this.$_prepareAxes(t,c,!1,s),e.measureAxes(o,i,s,r),s?(o-=this._xContainers.reduce((function(e,r){return e+r.checkWidths(t,o,i)}),0),i-=this._yContainers.reduce((function(e,r){return e+r.checkHeights(t,o,i)}),0)):(i-=this._xContainers.reduce((function(e,r){return e+r.checkHeights(t,o,i)}),0),o-=this._yContainers.reduce((function(e,r){return e+r.checkWidths(t,o,i)}),0)),e.measureAxes(o,i,s,r),this._xContainers.forEach((function(e){return e.measure(t,n,o,i,r)})),this._yContainers.forEach((function(e){return e.measure(t,n,o,i,r)})),o=h,i=u,s?(o-=this._xContainers.reduce((function(t,e){return t+e.mw}),0),i-=this._yContainers.reduce((function(t,e){return t+e.mh}),0)):(i-=this._xContainers.reduce((function(t,e){return t+e.mh}),0),o-=this._yContainers.reduce((function(t,e){return t+e.mw}),0)),r++,e.measureAxes(o,i,s,r),this.$_prepareAxisGuides(t,a,!0),this.$_prepareAxisGuides(t,c,!1),this._xContainers.forEach((function(e){e.measure(t,n,o,i,r)})),this._yContainers.forEach((function(e){e.measure(t,n,o,i,r)}));var p=e.getXLens(s?i:o),f=e.getYLens(s?o:i);e.completeAxesPoints(p,f)},o.prototype.layout=function(){var t=this._model,e=this.width,o=this.height;this._back.resize(e,o),this.$_calcExtents(t,e,o),this.$_layoutAxes(t,!0,e,o),this.$_layoutAxes(t,!1,e,o),this.$_layoutBodies(t,e,o)},o.prototype.seriesByDom=function(t){for(var e=0,o=this._bodies;e<o.length;e++){var i=o[e].seriesByDom(t);if(i)return i}},o.prototype.annotationByDom=function(t){for(var e=0,o=this._bodies;e<o.length;e++){var i=o[e].annotationByDom(t);if(i)return i}},o.prototype.getSeries=function(t){for(var e=0,o=this.bodies;e<o.length;e++){var i=o[e].findSeries(t);if(i)return i}},o.prototype.legendByDom=function(t){for(var e=0,o=this.bodies;e<o.length;e++){var i=o[e]._legendView.legendByDom(t);if(i)return i}},o.prototype.$_init=function(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)))},o.prototype.$_prepareBodies=function(t,e){e.chart;for(var o=e.paneCount,i=e.rowCount,r=e.colCount,n=this._bodies,s=this._bodyMap=[];n.length<o;){var a=new v(t,this._owner);this._bodyContainer.add(a),n.push(a)}for(;n.length>o;)n.pop().remove();for(var c=0;c<i;c++){for(var h=[],u=0;u<r;u++){var p=n[c*r+u];h.push(p),p.row=c,p.col=u}s.push(h)}n.forEach((function(o){o.prepareRender(t,e.getPane(o.row,o.col).body),o.prepareGuideContainers(),o._gridRowContainer.prepare()}))},o.prototype.$_prepareAxes=function(t,e,o,i){for(var r=this,n=this._model.chart,s=o?this._xContainers:this._yContainers,a=o?e.rows():e.cols();s.length<a;){var c=new g(t,o);this._axisContainer.add(c),s.push(c)}for(;s.length>a;)s.pop().remove();s.forEach((function(o,s){o.prepare(t,r._owner,n,e,s,i)}))},o.prototype.$_prepareAxisGuides=function(t,e,o){var i=this;(o?this._xContainers:this._yContainers).forEach((function(o,r){o.prepareGuides(t,i._bodyMap,e,r)}))},o.prototype.$_calc=function(t,e,o,i){var r=o.length,n=new Array(2*(r+1)),s=e-t.reduce((function(t,e){return t+e[i]}),0),a=this._model._calcSizes(o,s),c=0,h=0;for(h=0;h<r;h++)n[2*h]=c,n[2*h+1]=c+=t[h][i],c+=a[h];return n[2*h]=c,n[2*h+1]=c+t[h][i],n},o.prototype.$_calcExtents=function(t,e,o){this._inverted?(this._rowPoints=this.$_calc(this._xContainers,e,t.rowSizes(),"mw"),this._colPoints=this.$_calc(this._yContainers,o,t.colSizes(),"mh")):(this._rowPoints=this.$_calc(this._xContainers,o,t.rowSizes(),"mh"),this._colPoints=this.$_calc(this._yContainers,e,t.colSizes(),"mw"))},o.prototype.$_layoutAxes=function(t,e,o,i){var r=this.control._padding,n=this._rowPoints,s=this._colPoints,a=e?this._xContainers:this._yContainers;if(this._inverted)if(e){var c=s[1],h=s[s.length-2]-c;a.forEach((function(t,e){t.resize(t.mw,h),t.trans(n[2*e],i-s[s.length-2]),t.layout(s)}))}else{var u=n[1],p=n[n.length-2]-u;a.forEach((function(t,e){for(var o=t.sections,a=0,c=o.length;a<c;a++){var h=o[a],f=0===a?r.left:0,l=a===c-1?r.right:0,_=0,d=0;c>1&&(_=n[2*a+1]-n[2*a],d=n[2*(a+1)+1]-n[2*(a+1)],0===a?o[a+1].isEmpty()?d=n[2*(a+1)]-n[2*(a+1)-1]:d/=2:a===c-1?o[a-1].isEmpty()?_=n[2*(a-1)]-n[2*(a-1)-1]:_/=2:(o[a-1].isEmpty()?_=n[2*(a-1)]-n[2*(a-1)-1]:_/=2,o[a+1].isEmpty()?d=n[2*(a+1)]-n[2*(a+1)-1]:d/=2)),h.setMargins(f,_,d,l)}t.resize(p,t.mh),t.trans(u,i-s[2*e+1]),t.layout(n)}))}else if(e){var f=s[1];o=s[s.length-2]-f,a.forEach((function(t,e){for(var c=t.sections,h=0,u=c.length;h<u;h++){var p=c[h],l=0===e?r.left:0,_=e===a.length-1?r.right:0,d=0,y=0;u>1&&(d=s[2*h+1]-s[2*h],y=s[2*(h+1)+1]-s[2*(h+1)],0===h?c[h+1].isEmpty()?y=s[2*(h+1)]-s[2*(h+1)-1]:y/=2:h===u-1?c[h-1].isEmpty()?d=s[2*(h-1)]-s[2*(h-1)-1]:d/=2:(c[h-1].isEmpty()?d=s[2*(h-1)]-s[2*(h-1)-1]:d/=2,c[h+1].isEmpty()?y=s[2*(h+1)]-n[2*(h+1)-1]:y/=2)),p.setMargins(l,d,y,_)}t.resize(o,t.mh),t.trans(f,i-n[2*e+1]),t.layout(s)}))}else{var l=n[n.length-2],_=l-n[1];a.forEach((function(t,e){t.resize(t.mw,_),t.trans(s[2*e],i-l),t.layout(n)}))}},o.prototype.$_layoutBodies=function(t,e,o){var i=t.rowCount,r=t.colCount,n=this._rowPoints,s=this._colPoints,a=this._bodies;if(this._inverted)for(var c=0;c<i;c++)for(var h=n[2*(c+1)-1],u=n[2*(c+1)],p=0;p<r;p++){var f=a[c*r+p],l=s[2*p+1],_=s[2*(p+1)];f.measure(this.doc,t.getPane(c,p).body,u-h,_-l,1),f.resize(u-h,_-l),f.trans(h,this.height-_),f.layout()}else for(c=0;c<i;c++)for(l=n[2*(c+1)-1],_=n[2*(c+1)],p=0;p<r;p++){f=a[c*r+p],h=s[2*(p+1)-1],u=s[2*(p+1)];f.measure(this.doc,t.getPane(c,p).body,u-h,_-l,1),f.resize(u-h,_-l),f.trans(h,o-_),f.layout()}},o.STYLE_NAME="rct-panes",o}(e.PaneContainer);function x(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.ChartObject.registerSplitClass(_),t.ChartView.registerPaneClass(w))}x(r),t.Split=_,t.default=x,Object.defineProperty(t,"__esModule",{value:!0})}));