@mescius/wijmo.chart.analytics 5.20232.939

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/es5-esm.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{asNumber,copy,asEnum,asBoolean,asType,Point,Rect,isArray,Size,culture,_addCultureInfo,isNumber,asFunction,asArray,assert,asInt,asString,isString,_registerModule}from"@mescius/wijmo";import{SeriesBase,ChartType,_DataPoint,_RectArea,_CircleArea,HitTestInfo,ChartElement,_DataInfo,Series}from"@mescius/wijmo.chart";import*as selfModule from"@mescius/wijmo.chart.analytics";var Waterfall=function(e){__extends(Waterfall,e);function Waterfall(t){var r=e.call(this)||this;r._startLabel="Start";r._relativeData=!0;r._connectorLines=!1;r._showTotal=!1;r._totalLabel="Total";r._getXValues=!1;r._showIntermediateTotal=!1;r._intermediateTotalPos=[];r._chartType=ChartType.Bar;r.tooltipContent="<b>{seriesName}</b><br/>{x} {value}";r.rendering.addHandler(r._rendering,r);r.initialize(t);return r}Object.defineProperty(Waterfall.prototype,"relativeData",{get:function(){return this._relativeData},set:function(e){if(e!=this._relativeData){this._relativeData=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"start",{get:function(){return this._start},set:function(e){if(e!=this._start){this._start=asNumber(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"startLabel",{get:function(){return this._startLabel},set:function(e){if(e!=this._startLabel){this._startLabel=asString(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"showTotal",{get:function(){return this._showTotal},set:function(e){if(e!=this._showTotal){this._showTotal=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"totalLabel",{get:function(){return this._totalLabel},set:function(e){if(e!=this._totalLabel){this._totalLabel=asString(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"showIntermediateTotal",{get:function(){return this._showIntermediateTotal},set:function(e){if(e!=this._showIntermediateTotal){this._showIntermediateTotal=asBoolean(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"intermediateTotalPositions",{get:function(){return this._intermediateTotalPositions},set:function(e){if(e!=this._intermediateTotalPositions){this._intermediateTotalPositions=asArray(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"intermediateTotalLabels",{get:function(){return this._intermediateTotalLabels},set:function(e){if(e!=this._intermediateTotalLabels){assert(null==e||isArray(e)||isString(e),"Array or string expected.");this._intermediateTotalLabels=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"connectorLines",{get:function(){return this._connectorLines},set:function(e){if(e!=this._connectorLines){this._connectorLines=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Waterfall.prototype,"styles",{get:function(){return this._styles},set:function(e){if(e!=this._styles){this._styles=e;this._invalidate()}},enumerable:!0,configurable:!0});Waterfall.prototype.getValues=function(t){var r,i,n,a,o=this,s=[],l=0;r=e.prototype.getValues.call(this,t);if(0===t){if(!this._yValues){s=[];var u=null!=this.start?this.start:0,h=0,c=r&&r.length||0;if(this.relativeData){for(;h<c;h++){u+=isNaN(r[h])?0:r[h];s.push(u)}this._yValues=s}else{for(;h<c;h++){u=isNaN(r[h])?0:r[h];s.push(u)}this._yValues=s}if((i=this._yValues)&&i.length>0){if(this.showIntermediateTotal&&this.intermediateTotalPositions&&this.intermediateTotalPositions.length>0){this._intermediateTotalPos=i.slice();this.intermediateTotalPositions.reduceRight((function(e,t){var r=0===t?i[0]:i[t-1];if(i.length>t){i.splice(t,0,r);o._intermediateTotalPos.splice(t,0,!0)}else if(i.length===t){i.push(r);o._intermediateTotalPos.push(!0)}return 0}),0)}if(null!=this.start){i.splice(0,0,this.start);this._intermediateTotalPos.splice(0,0,!1)}this.showTotal&&i&&i.push(i[i.length-1])}}return this._yValues}if(!this._xValues&&this._getXValues){this._xValues=r&&r.slice();this._getXValues=!1;if(this._xValues&&this._xValues.length>1){c=this._xValues.length;a=this._xValues[c-1];l=Math.abs(this._xValues[c-1]-this._xValues[c-2])}if(this.chart&&this.chart._xlabels&&this.chart._xlabels.length){n=this.chart._xlabels;if(this.showIntermediateTotal&&this.intermediateTotalPositions&&this.intermediateTotalPositions.length>0){var f=this.intermediateTotalLabels;f&&this.intermediateTotalPositions.reduceRight((function(e,t,r){var i="";i=isString(f)?f:f[r]||"";n.length>t?n.splice(t,0,i):n.length===t&&n.push(i);if(l){a+=l;o._xValues.push(a)}return 0}),0)}if(null!=this.start){n.splice(0,0,this.startLabel);if(l){a+=l;this._xValues.push(a)}}if(this.showTotal){n.push(this.totalLabel);if(l){a+=l;this._xValues.push(a)}}}}return this._xValues};Waterfall.prototype.legendItemLength=function(){return this.showTotal?3:2};Waterfall.prototype.measureLegendItem=function(e,t){var r=this._getName(t);return r?this._measureLegendItem(e,r):new Size(0,0)};Waterfall.prototype.drawLegendItem=function(e,t,r){var i=this._getLegendStyles(r);this._getName(r)&&this._drawLegendItem(e,t,ChartType.Bar,this._getName(r),i,this.symbolStyle)};Waterfall.prototype._clearValues=function(){e.prototype._clearValues.call(this);this._xValues=null;this._yValues=null;this._wfstyle=null;this._getXValues=!0;this._intermediateTotalPos=[];this.chart&&this.chart._performBind()};Waterfall.prototype._invalidate=function(){e.prototype._invalidate.call(this);this._clearValues()};Waterfall.prototype._getXOffset=function(){return null!=this.start?1:0};Waterfall.prototype._getYOffset=function(e){return this.getValues(0)[e+this._getXOffset()]};Waterfall.prototype._getValue=function(e){var t=e;if(null!=this.start){if(0==e)return this.start;e--}return this.showIntermediateTotal&&this.intermediateTotalPositions&&this._intermediateTotalPos[t],this.getValues(0)[t]};Waterfall.prototype._getItem=function(t){var r=null;null!=this.start&&(0==t?(r={})[this.binding]=this.start:t--);if(this.showIntermediateTotal&&this.intermediateTotalPositions){var i=this._intermediateTotalPos;if(!0===i[t]){(r={})[this.binding]=this.getValues(0)[t];return r}for(var n=t,a=0;a<t;a++)!0===i[a]&&n--;t=n}r||!(r=e.prototype._getItem.call(this,t))&&this.showTotal&&this._yValues&&this._yValues.length>0&&((r={})[this.binding]=this._yValues[this._yValues.length-1]);return r};Waterfall.prototype._rendering=function(e,t){var r=this;t.cancel=!0;this._wfstyle=null;var i,n,a,o,s,l,u=this.chart,h=this._getAxisY(),c=this._getAxisX(),f=h.origin||0,p=t.engine;this._barPlotter=u._getPlotter(this);a=this._barPlotter.rotated;this._barPlotter._getSymbolOrigin||(this._barPlotter._getSymbolOrigin=function(e,t,i){return 0===t?e:!0===r._intermediateTotalPos[t]?e:t===i-1&&r.showTotal?e:r._yValues[t-1]});this._barPlotter._getSymbolStyles||(this._barPlotter._getSymbolStyles=function(e,t){var i=r._getStyles();return 0===e&&null!=r.start?i.start:!0===r._intermediateTotalPos[e]?i.intermediateTotal:e===t-1&&r.showTotal?i.total:0==e?r._yValues[e]<0?i.falling:i.rising:r._yValues[e]<r._yValues[e-1]?i.falling:i.rising});this._barPlotter.plotSeries(p,c,h,e,u,0,1);if(this.connectorLines&&(o=this._barPlotter.hitTester._map[0])&&o.length){p.startGroup(Waterfall.CSS_CONNECTOR_LINE_GROUP);l=this._yValues[0]<f;s=o[0].rect;for(i=1,n=o.length;i<n;i++)if(!0!==this._intermediateTotalPos[i]||i===n-1){this._drawConnectorLine(p,a,s,o[i].rect,l);s=o[i].rect;l=this._yValues[i]<this._yValues[i-1]}p.endGroup()}};Waterfall.prototype._getStyles=function(){if(this._wfstyle)return this._wfstyle;var e=this._chart.series.indexOf(this),t=this._getSymbolFill(e),r=this._getSymbolStroke(e),i=this.styles||{};this._wfstyle={start:this._getStyleByKey(i,"start",t,r),intermediateTotal:this._getStyleByKey(i,"intermediateTotal",t,r),total:this._getStyleByKey(i,"total",t,r),falling:this._getStyleByKey(i,"falling","red","red"),rising:this._getStyleByKey(i,"rising","green","green")};return this._wfstyle};Waterfall.prototype._getStyleByKey=function(e,t,r,i){return{fill:e[t]&&e[t].fill?e[t].fill:r,stroke:e[t]&&e[t].stroke?e[t].stroke:i}};Waterfall.prototype._drawConnectorLine=function(e,t,r,i,n){var a=new Point,o=new Point,s=this.chart.axisY.reversed,l=this.chart.axisX.reversed;s^=n;if(t){if(s){a.x=r.left;o.x=r.left}else{a.x=r.left+r.width;o.x=r.left+r.width}if(l){a.y=r.top;o.y=i.top+i.height}else{a.y=r.top+r.height;o.y=i.top}}else{if(s){a.y=r.top+r.height;o.y=r.top+r.height}else{a.y=r.top;o.y=r.top}if(l){a.x=r.left+r.width;o.x=i.left}else{a.x=r.left;o.x=i.left+i.width}}e.drawLine(a.x,a.y,o.x,o.y,Waterfall.CSS_CONNECTOR_LINE,this.styles&&this.styles.connectorLines||{stroke:"black"})};Waterfall.prototype._getLegendStyles=function(e){if(e<0||null===this.styles)return null;var t=this._getStyles();return 0===e?t.rising:1===e?t.falling:t.total};Waterfall.prototype._getName=function(e){var t=void 0;if(this.name)if(this.name.indexOf(",")){var r=this.name.split(",");r&&r.length-1>=e&&(t=r[e].trim())}else t=this.name;return t};Waterfall.CSS_CONNECTOR_LINE_GROUP="water-fall-connector-lines";Waterfall.CSS_CONNECTOR_LINE="water-fall-connector-line";Waterfall.CSS_ENDLABEL="water-fall-end-label";return Waterfall}(SeriesBase);export{Waterfall};var TrendLineBase=function(e){__extends(TrendLineBase,e);function TrendLineBase(t){var r=e.call(this)||this;r._chartType=ChartType.Line;r._sampleCount=100;r.initialize(t);return r}Object.defineProperty(TrendLineBase.prototype,"sampleCount",{get:function(){return this._sampleCount},set:function(e){if((e=asNumber(e,!1,!0))!=this._sampleCount){this._sampleCount=e;this._invalidate()}},enumerable:!0,configurable:!0});TrendLineBase.prototype.approximate=function(e){return 0};TrendLineBase.prototype.getValues=function(t){var r=this.binding,i=this.bindingX;if(r!==this._bind){this._bind=r;this.binding=r}if(i!==this._bindX){this._bindX=i;this.bindingX=i}null==this._originYValues&&(this._originYValues=e.prototype.getValues.call(this,0));null==this._originXValues&&(this._originXValues=e.prototype.getValues.call(this,1));if(null==this._originXValues||null==this._originYValues)return null;e.prototype.getValues.call(this,t);null!=this._xValues&&null!=this._yValues||this._calculateValues();return 0===t?this._yValues||null:1===t?this._xValues||null:void 0};TrendLineBase.prototype._calculateValues=function(){};TrendLineBase.prototype._invalidate=function(){e.prototype._invalidate.call(this);this._clearCalculatedValues()};TrendLineBase.prototype._clearValues=function(){e.prototype._clearValues.call(this);this._originXValues=null;this._originYValues=null;this._clearCalculatedValues()};TrendLineBase.prototype._clearCalculatedValues=function(){this._xValues=null;this._yValues=null};return TrendLineBase}(SeriesBase);export{TrendLineBase};export var MovingAverageType;!function(e){e[e.Simple=0]="Simple";e[e.Weighted=1]="Weighted";e[e.Exponential=2]="Exponential";e[e.Triangular=3]="Triangular"}(MovingAverageType||(MovingAverageType={}));var MovingAverage=function(e){__extends(MovingAverage,e);function MovingAverage(t){var r=e.call(this)||this;r._chartType=ChartType.Line;r._type=MovingAverageType.Simple;r._period=2;r.initialize(t);return r}Object.defineProperty(MovingAverage.prototype,"type",{get:function(){return this._type},set:function(e){if((e=asEnum(e,MovingAverageType,!1))!=this._type){this._type=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(MovingAverage.prototype,"period",{get:function(){return this._period},set:function(e){if((e=asNumber(e,!1,!0))!=this._period){this._period=asNumber(e,!1,!0);this._invalidate()}},enumerable:!0,configurable:!0});MovingAverage.prototype._checkPeriod=function(){var e=this.period,t=this._originXValues;e<=1&&assert(!1,"period must be greater than 1.");t&&t.length&&e>=t.length&&assert(!1,"period must be less than itemSource's length.")};MovingAverage.prototype._calculateValues=function(){this._type;var e="_calculate"+MovingAverageType[this._type],t=[],r=[];this._checkPeriod();this[e]&&this[e].call(this,t,r);this._yValues=r;this._xValues=t};MovingAverage.prototype._calculateSimple=function(e,t,r){void 0===r&&(r=!1);for(var i=this._originXValues,n=this._originYValues,a=i.length,o=this._period,s=0,l=0;l<a;l++){s+=n[l]||0;l>=o&&(s-=n[l-o]||0);if(l>=o-1){e.push(i[l]);t.push(s/o)}else if(r){e.push(i[l]);t.push(s/(l+1))}}};MovingAverage.prototype._calculateWeighted=function(e,t){for(var r=this._originXValues,i=this._originYValues,n=r.length,a=this._period,o=a*(a+1)/2,s=0,l=0,u=0;u<n;u++){u>0&&(s+=i[u-1]||0);u>a&&(s-=i[u-a-1]||0);if(u<a-1)l+=(i[u]||0)*(u+1);else{l+=(i[u]||0)*a;u>a-1&&(l-=s);e.push(r[u]);t.push(l/o)}}};MovingAverage.prototype._calculateExponential=function(e,t){for(var r=this._originXValues,i=this._originYValues,n=r.length,a=this._period,o=0,s=0;s<n;s++)if(s<=a-2){o+=i[s]||0;s===a-2&&(o/=a-1)}else{o+=2/(a+1)*((i[s]||0)-o);e.push(r[s]);t.push(o)}};MovingAverage.prototype._calculateTriangular=function(e,t){var r=this._period,i=[],n=[],a=0;this._calculateSimple(i,n,!0);for(var o=0,s=i.length;o<s;o++){a+=n[o]||0;o>=r&&(a-=n[o-r]||0);if(o>=r-1){e.push(i[o]);t.push(a/r)}}};return MovingAverage}(TrendLineBase);export{MovingAverage};var MathHelper=function(){function MathHelper(){}MathHelper.round=function(e,t){if(!e)return 0;var r=Math.pow(10,t||2);return Math.round(e*r)/r};MathHelper.avg=function(e){return MathHelper.sum(e)/e.length};MathHelper.sum=function(e){return(e=asArray(e,!1)).reduce((function(e,t){return e+t}),0)};MathHelper.sumOfPow=function(e,t){e=asArray(e,!1);t=asNumber(t,!1);return e.reduce((function(e,r){return e+Math.pow(r,t)}),0)};MathHelper.sumProduct=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.length;var r,i,n=0,a=[];(e=asArray(e,!1)).forEach((function(e,t){e=asArray(e,!1);0===t?n=e.length:assert(e.length===n,"The length of the arrays must be equal")}));for(r=0;r<n;r++){i=1;e.some((function(e,t){var n=e[r];if(!n||!isNumber(n)){i=0;return!0}i*=n}));a.push(i)}return MathHelper.sum(a)};MathHelper.variance=function(e){e=asArray(e,!1);var t,r=MathHelper.avg(e);t=e.map((function(e){return e-r}));return MathHelper.sumOfSquares(t)/(e.length-1)};MathHelper.covariance=function(e,t){e=asArray(e,!1);t=asArray(t,!1);assert(e.length===t.length,"Length of arrays must be equal");var r,i=MathHelper.avg(e),n=MathHelper.avg(t),a=e.length,o=0;for(r=0;r<a;r++)o+=(e[r]-i)*(t[r]-n)/a;return o};MathHelper.min=function(e){return Math.min.apply(Math,asArray(e,!1))};MathHelper.max=function(e){return Math.max.apply(Math,asArray(e,!1))};MathHelper.square=function(e){return Math.pow(asNumber(e,!1),2)};MathHelper.sumOfSquares=function(e){return MathHelper.sumOfPow(e,2)};MathHelper.stdDev=function(e){return Math.sqrt(MathHelper.variance(e))};return MathHelper}();export var TrendLineFitType;!function(e){e[e.Linear=0]="Linear";e[e.Exponential=1]="Exponential";e[e.Logarithmic=2]="Logarithmic";e[e.Power=3]="Power";e[e.Fourier=4]="Fourier";e[e.Polynomial=5]="Polynomial";e[e.MinX=6]="MinX";e[e.MinY=7]="MinY";e[e.MaxX=8]="MaxX";e[e.MaxY=9]="MaxY";e[e.AverageX=10]="AverageX";e[e.AverageY=11]="AverageY"}(TrendLineFitType||(TrendLineFitType={}));var TrendLine=function(e){__extends(TrendLine,e);function TrendLine(t){var r=e.call(this)||this;r._fitType=TrendLineFitType.Linear;r._order=2;r.initialize(t);return r}Object.defineProperty(TrendLine.prototype,"fitType",{get:function(){return this._fitType},set:function(e){if((e=asEnum(e,TrendLineFitType,!1))!=this._fitType){this._fitType=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TrendLine.prototype,"order",{get:function(){return this._order},set:function(e){if(e!=this._order){this._order=asNumber(e,!1,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(TrendLine.prototype,"coefficients",{get:function(){return this._helper?this._helper.coefficients:null},enumerable:!0,configurable:!0});TrendLine.prototype.approximate=function(e){return this._helper?this._helper.approximate(e):NaN};TrendLine.prototype.getEquation=function(e){return(this._helper?this._helper.getEquation(e):"").replace(/\S(\+|\-)\d/g,(function(e){return e[0]+" "+e[1]+" "+e[2]}))};TrendLine.prototype._calculateValues=function(){var e=TrendLineFitType[this._fitType];if(TrendLineHelper[e]){var t=!1,r=this._originXValues;if(0==this._chart._xvals.length&&this._chart._xlabels.length>0){r=this._originXValues.map((function(e){return e+1}));t=!0}var i=new TrendLineHelper[e](this._originYValues,r,this.sampleCount,this.order);i._isXString=t;var n=i.calculateValues();this._yValues=n[0];this._xValues=n[1];this._helper=i}};return TrendLine}(TrendLineBase);export{TrendLine};var Calculator=function(){function Calculator(e,t){this._x=e;this._y=t}Object.defineProperty(Calculator.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"minX",{get:function(){null==this._minX&&(this._minX=MathHelper.min(this._x));return this._minX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"minY",{get:function(){null==this._minY&&(this._minY=MathHelper.min(this._y));return this._minY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"maxX",{get:function(){null==this._maxX&&(this._maxX=MathHelper.max(this._x));return this._maxX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"maxY",{get:function(){null==this._maxY&&(this._maxY=MathHelper.max(this._y));return this._maxY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"averageX",{get:function(){null==this._averageX&&(this._averageX=MathHelper.avg(this._x));return this._averageX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"averageY",{get:function(){null==this._averageY&&(this._averageY=MathHelper.avg(this._y));return this._averageY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumX",{get:function(){null==this._sumX&&(this._sumX=MathHelper.sum(this._x));return this._sumX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumY",{get:function(){null==this._sumY&&(this._sumY=MathHelper.sum(this._y));return this._sumY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"LogX",{get:function(){null==this._logX&&(this._logX=this._x.map((function(e){return Math.log(e)})));return this._logX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"LogY",{get:function(){null==this._logY&&(this._logY=this._y.map((function(e){return Math.log(e)})));return this._logY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumLogX",{get:function(){null==this._sumLogX&&(this._sumLogX=MathHelper.sum(this.LogX));return this._sumLogX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumLogY",{get:function(){null==this._sumLogY&&(this._sumLogY=MathHelper.sum(this.LogY));return this._sumLogY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumOfSquareX",{get:function(){null==this._sumOfSquareX&&(this._sumOfSquareX=MathHelper.sumOfSquares(this._x));return this._sumOfSquareX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumOfSquareY",{get:function(){null==this._sumOfSquareY&&(this._sumOfSquareY=MathHelper.sumOfSquares(this._y));return this._sumOfSquareY},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumOfSquareLogX",{get:function(){null==this._sumOfSquareLogX&&(this._sumOfSquareLogX=MathHelper.sumOfSquares(this.LogX));return this._sumOfSquareLogX},enumerable:!0,configurable:!0});Object.defineProperty(Calculator.prototype,"sumOfSquareLogY",{get:function(){null==this._sumOfSquareLogY&&(this._sumOfSquareLogY=MathHelper.sumOfSquares(this.LogY));return this._sumOfSquareLogY},enumerable:!0,configurable:!0});Calculator.prototype.sumProduct=function(e,t){null==this._sumProduct&&(this._sumProduct=MathHelper.sumProduct(e,t));return this._sumProduct};return Calculator}(),TrendHelperBase=function(){function TrendHelperBase(e,t,r){this._coefficients=[];this.y=asArray(e);this.x=asArray(t);assert(e.length===t.length,"Length of X and Y arrays are not equal");this.count=r||e.length;this._calculator=new Calculator(t,e);this.xMin=this._calculator.minX;this.xMax=this._calculator.maxX}Object.defineProperty(TrendHelperBase.prototype,"calculator",{get:function(){return this._calculator},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"y",{get:function(){return this._y},set:function(e){e!==this.y&&(this._y=asArray(e,!1))},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"x",{get:function(){return this._x},set:function(e){e!==this.x&&(this._x=asArray(e,!1))},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"count",{get:function(){return this._count},set:function(e){e!==this.count&&(this._count=asInt(e,!1,!0))},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"xMin",{get:function(){return this._xMin},set:function(e){e!==this.xMin&&(this._xMin=asNumber(e,!1))},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"xMax",{get:function(){return this._xMax},set:function(e){e!==this.xMax&&(this._xMax=asNumber(e,!1))},enumerable:!0,configurable:!0});Object.defineProperty(TrendHelperBase.prototype,"coefficients",{get:function(){return this._coefficients},enumerable:!0,configurable:!0});TrendHelperBase.prototype._calculateCoefficients=function(){var e=this.calcB(),t=this.calcA(e);this._coefficients.push(t,e)};TrendHelperBase.prototype.calculateValues=function(){for(var e=(this.xMax-this.xMin)/(this.count-1),t=[[],[]],r=0;r<this.count;r++){var i=this.xMin+e*r,n=this.calcY(i);t[0].push(n);this._isXString?t[1].push(i-1):t[1].push(i)}return t};TrendHelperBase.prototype.calcA=function(e){var t=this.y.length,r=this.calculator.sumX;return(this.calculator.sumY-(e=e||this.calcB())*r)/t};TrendHelperBase.prototype.calcB=function(){var e=this.y.length,t=this.calculator,r=t.sumProduct(t.x,t.y),i=t.sumX;return(e*r-i*t.sumY)/(e*t.sumOfSquareX-MathHelper.square(i))};TrendHelperBase.prototype.calcY=function(e){var t=this.coefficients;return t[0]+t[1]*e};TrendHelperBase.prototype.approximate=function(e){return this.calcY(e)};TrendHelperBase.prototype.getEquation=function(e){e=e||this._defaultEquationFmt;return this._getEquation(e)};TrendHelperBase.prototype._getEquation=function(e){var t=this.coefficients,r=[];t.forEach((function(t){r.push(e(t))}));return this._concatEquation(r)};TrendHelperBase.prototype._concatEquation=function(e){return""};TrendHelperBase.prototype._defaultEquationFmt=function(e){var t,r=Math.abs(e),i=String(r),n=0;if(r>=1e5){t=String(Math.round(r)).length-1;return Math.round(e/Number("1e"+t))+"e"+t}if(r<1e-4){t=i.indexOf("e")>-1?Math.abs(+i.substring(i.indexOf("e")+1)):i.match(/\.0+/)[0].length;return Math.round(e*Number("1e"+t))+"e-"+t}n=e>0?6:7;r>=1e4&&n--;return String(+String(e).substring(0,n))};return TrendHelperBase}(),LinearHelper=function(e){__extends(LinearHelper,e);function LinearHelper(t,r,i,n){var a=e.call(this,t,r,i)||this;a._calculateCoefficients();a.yOffset=n;return a}Object.defineProperty(LinearHelper.prototype,"yOffset",{get:function(){return this._yOffset},set:function(e){e!==this.yOffset&&(this._yOffset=asNumber(e,!0))},enumerable:!0,configurable:!0});LinearHelper.prototype.calcA=function(t){return null!=this.yOffset?this.yOffset:e.prototype.calcA.call(this,t)};LinearHelper.prototype.calcB=function(){return null!=this.yOffset?this._calculateBSimple():e.prototype.calcB.call(this)};LinearHelper.prototype._calculateBSimple=function(){var e=this.calculator,t=e.sumProduct(e.x,e.y),r=e.sumX,i=e.sumOfSquareX;return(t-this.yOffset*r)/i};LinearHelper.prototype._calculateCoefficients=function(){var e=this.calcB(),t=this.calcA(e);this.coefficients.push(e,t)};LinearHelper.prototype.calcY=function(e){var t=this.coefficients;return t[0]*e+t[1]};LinearHelper.prototype._concatEquation=function(e){return"y = "+e[0]+"x"+(this.coefficients[1]>=0?"+":"")+e[1]};return LinearHelper}(TrendHelperBase),LogHelper=function(e){__extends(LogHelper,e);function LogHelper(t,r,i){var n=e.call(this,t,r,i)||this;n._calculateCoefficients();return n}LogHelper.prototype.calcA=function(e){var t=this.y.length,r=this.calculator,i=r.sumY,n=r.sumLogX;return(i-(e=e||this.calcB())*n)/t};LogHelper.prototype.calcB=function(){var e=this.y.length,t=this.calculator,r=t.sumProduct(t.y,t.LogX),i=t.sumY,n=t.sumLogX;return(e*r-i*n)/(e*t.sumOfSquareLogX-MathHelper.square(n))};LogHelper.prototype._calculateCoefficients=function(){var e=this.calcB(),t=this.calcA(e);this.coefficients.push(e,t)};LogHelper.prototype.calcY=function(e){var t=this.coefficients;return Math.log(e)*t[0]+t[1]};LogHelper.prototype._concatEquation=function(e){return"y = "+e[0]+"ln(x)"+(this.coefficients[1]>=0?"+":"")+e[1]};return LogHelper}(TrendHelperBase),ExpHelper=function(e){__extends(ExpHelper,e);function ExpHelper(t,r,i){var n=e.call(this,t,r,i)||this;n._calculateCoefficients();return n}ExpHelper.prototype.calcA=function(){var e=this.y.length,t=this.calculator,r=t.sumLogY,i=t.sumOfSquareX,n=t.sumX,a=t.sumProduct(t.x,t.LogY);return Math.exp((r*i-n*a)/(e*i-MathHelper.square(n)))};ExpHelper.prototype.calcB=function(){var e=this.y.length,t=this.calculator,r=t.sumLogY,i=t.sumOfSquareX,n=t.sumX;return(e*t.sumProduct(t.x,t.LogY)-n*r)/(e*i-MathHelper.square(n))};ExpHelper.prototype.calcY=function(e){var t=this.coefficients;return t[0]*Math.exp(t[1]*e)};ExpHelper.prototype._concatEquation=function(e){return"y = "+e[0]+"e<sup>"+e[1]+"x</sup>"};return ExpHelper}(TrendHelperBase),PowerHelper=function(e){__extends(PowerHelper,e);function PowerHelper(t,r,i){var n=e.call(this,t,r,i)||this;n._calculateCoefficients();return n}PowerHelper.prototype.calcA=function(e){var t=this.calculator,r=this.y.length,i=t.sumLogX,n=t.sumLogY;e=e||this.calcB();return Math.exp((n-e*i)/r)};PowerHelper.prototype.calcB=function(){var e=this.y.length,t=this.calculator,r=t.sumProduct(t.LogX,t.LogY),i=t.sumLogX;return(e*r-i*t.sumLogY)/(e*t.sumOfSquareLogX-MathHelper.square(i))};PowerHelper.prototype.calcY=function(e){var t=this.coefficients;return t[0]*Math.pow(e,t[1])};PowerHelper.prototype._concatEquation=function(e){return"y = "+e[0]+"x<sup>"+e[1]+"</sup>"};return PowerHelper}(TrendHelperBase),LeastSquaresHelper=function(e){__extends(LeastSquaresHelper,e);function LeastSquaresHelper(t,r,i,n){var a=e.call(this,t,r,i)||this;a._order=null==n?2:n;a._basis=[];a._calculateCoefficients();return a}Object.defineProperty(LeastSquaresHelper.prototype,"basis",{get:function(){return this._basis},enumerable:!0,configurable:!0});Object.defineProperty(LeastSquaresHelper.prototype,"order",{get:function(){return this._order},set:function(e){this._order=asNumber(e,!0)},enumerable:!0,configurable:!0});LeastSquaresHelper.prototype._calculateCoefficients=function(){this._coefficients.length=this.order;this._createBasis();this._normalizeAndSolveGauss()};LeastSquaresHelper.prototype._createBasis=function(){var e=this.x.length,t=this.order;if(e<2)throw"Incompatible data: Less than 2 data points.";if(t<1)throw"Incompatible data: Less than 1 coefficient in the fit";if(t>e)throw"Incompatible data: Number of data points less than number of terms"};LeastSquaresHelper.prototype._normalizeAndSolveGauss=function(){var e=[];this._computeNormalEquations(e);this._genDefValForArray(e,0);if(!this._solveGauss(e))throw"Incompatible data: No solution."};LeastSquaresHelper.prototype._genDefValForArray=function(e,t){var r=e.length+1;e.forEach((function(e){for(var i=0;i<r;i++)null==e[i]&&(e[i]=t)}))};LeastSquaresHelper.prototype._computeNormalEquations=function(e){var t,r,i,n,a=this.y,o=this.basis,s=this.order,l=a.length;for(t=0;t<s;t++){i=0;null==e[t]&&(e[t]=[]);a.forEach((function(e,r){i+=e*o[r][t]}));e[t][s]=i;for(r=t;r<s;r++){i=0;for(n=0;n<l;n++)i+=o[n][r]*o[n][t];null==e[r]&&(e[r]=[]);e[r][t]=i;e[t][r]=i}}};LeastSquaresHelper.prototype._solveGauss=function(e){var t,r,i=e.length,n=this._coefficients,a=!0;if(n.length<i||e[0].length<i+1)throw"Dimension of matrix is not correct.";e.some((function(t,n){var o,s,l=n,u=Math.abs(t[n]);for(r=n+1;r<i;r++)if(u<(o=Math.abs(e[r][n]))){u=o;l=r}if(!(u>0)){a=!1;return!0}for(r=n;r<=i;r++){s=e[n][r];e[n][r]=e[l][r];e[l][r]=s}for(l=n+1;l<i;l++){s=e[l][n]/t[n];e[l][n]=0;for(r=n+1;r<=i;r++)e[l][r]-=s*t[r]}}));if(a)for(t=i-1;t>=0;t--){n[t]=e[t][i];for(r=t+1;r<i;r++)n[t]-=e[t][r]*n[r];n[t]=n[t]/e[t][t]}return a};return LeastSquaresHelper}(TrendHelperBase),PolyHelper=function(e){__extends(PolyHelper,e);function PolyHelper(t,r,i,n){return e.call(this,t,r,i,n)||this}Object.defineProperty(PolyHelper.prototype,"coefficients",{get:function(){return this._coefficients.slice(0).reverse()},enumerable:!0,configurable:!0});PolyHelper.prototype.calcY=function(e){var t=this._coefficients,r=0,i=1;t.forEach((function(t,n){n>0&&(i*=e);r+=t*i}));return r};PolyHelper.prototype._calculateCoefficients=function(){this._coefficients;this.order++;0;e.prototype._calculateCoefficients.call(this);0;this.order--};PolyHelper.prototype._createBasis=function(){e.prototype._createBasis.call(this);var t=this.x,r=this.basis,i=this.order;t.forEach((function(e,t){r[t]=[1];for(var n=1;n<=i;n++)r[t][n]=e*r[t][n-1]}))};PolyHelper.prototype._concatEquation=function(e){var t="y = ",r=e.length,i=this.coefficients;e.forEach((function(e,n){var a,o=r-1-n;if(0===o)t+=e;else if(1===o){a=i[n+1]>=0?"+":"";t+=e+"x"+a}else{a=i[n+1]>=0?"+":"";t+=e+"x<sup>"+o+"</sup>"+a}}));return t};return PolyHelper}(LeastSquaresHelper),FourierHelper=function(e){__extends(FourierHelper,e);function FourierHelper(t,r,i,n){n=null==n?r.length:n;return e.call(this,t,r,i,n)||this}FourierHelper.prototype._createBasis=function(){e.prototype._createBasis.call(this);var t=this.x,r=this.basis,i=this.order;t.forEach((function(e,t){var n,a;r[t]=[1];for(n=1;n<i;n++){a=Math.floor((n+1)/2);n%2==1?r[t].push(Math.cos(a*e)):r[t].push(Math.sin(a*e))}}))};FourierHelper.prototype.calcY=function(e){var t;this._coefficients.forEach((function(r,i){var n,a=Math.floor((i+1)/2);if(0===i)t=r;else{n=a*e;t+=i%2==1?r*Math.cos(n):r*Math.sin(n)}}));return t};FourierHelper.prototype._concatEquation=function(e){var t="y = ",r=e.length,i=this.coefficients;e.forEach((function(e,n){var a=n===r-1?"":i[n+1]>=0?"+":"",o="",s=Math.ceil(n/2);if(0===n)t+=e+a;else{o=n%2==1?"cos":"sin";o+="("+(1===s?"":String(s))+"x)";t+=e+o+a}}));return t};return FourierHelper}(LeastSquaresHelper),SimpleTrendHelper=function(e){__extends(SimpleTrendHelper,e);function SimpleTrendHelper(t,r,i){var n=e.call(this,t,r,i)||this;n._calculateCoefficients();return n}SimpleTrendHelper.prototype._setVal=function(e){this._val=e};SimpleTrendHelper.prototype.calcY=function(e){return this._val};return SimpleTrendHelper}(TrendHelperBase),MinXHelper=function(e){__extends(MinXHelper,e);function MinXHelper(t,r,i){return e.call(this,t,r,i)||this}MinXHelper.prototype.calculateValues=function(){var e,t,r=this.xMin,i=MathHelper.min(this.y),n=MathHelper.max(this.y);this._isXString&&(r-=1);e=[r,r];t=[i,n];this._setVal(r);return[t,e]};MinXHelper.prototype.getEquation=function(e){var t=this.xMin;this._isXString&&(t-=1);e&&(t=e(t));return"x = "+t};return MinXHelper}(SimpleTrendHelper),MinYHelper=function(e){__extends(MinYHelper,e);function MinYHelper(t,r,i){return e.call(this,t,r,i)||this}MinYHelper.prototype.calculateValues=function(){var e,t,r=this.xMin,i=this.xMax,n=MathHelper.min(this.y);if(this._isXString){r-=1;i-=1}e=[r,i];t=[n,n];this._setVal(n);return[t,e]};MinYHelper.prototype.getEquation=function(e){var t=MathHelper.min(this.y);e&&(t=e(t));return"y = "+t};return MinYHelper}(SimpleTrendHelper),MaxXHelper=function(e){__extends(MaxXHelper,e);function MaxXHelper(t,r,i){return e.call(this,t,r,i)||this}MaxXHelper.prototype.calculateValues=function(){var e,t,r=this.xMax,i=MathHelper.min(this.y),n=MathHelper.max(this.y);this._isXString&&(r-=1);e=[r,r];t=[i,n];this._setVal(r);return[t,e]};MaxXHelper.prototype.getEquation=function(e){var t=this.xMax;this._isXString&&(t-=1);e&&(t=e(t));return"x = "+t};return MaxXHelper}(SimpleTrendHelper),MaxYHelper=function(e){__extends(MaxYHelper,e);function MaxYHelper(t,r,i){return e.call(this,t,r,i)||this}MaxYHelper.prototype.calculateValues=function(){var e,t,r=this.xMin,i=this.xMax,n=MathHelper.max(this.y);if(this._isXString){r-=1;i-=1}e=[r,i];t=[n,n];this._setVal(n);return[t,e]};MaxYHelper.prototype.getEquation=function(e){var t=MathHelper.max(this.y);e&&(t=e(t));return"y = "+t};return MaxYHelper}(SimpleTrendHelper),AverageXHelper=function(e){__extends(AverageXHelper,e);function AverageXHelper(t,r,i){return e.call(this,t,r,i)||this}AverageXHelper.prototype.calculateValues=function(){var e,t,r=MathHelper.avg(this.x),i=MathHelper.min(this.y),n=MathHelper.max(this.y);this._isXString&&(r-=1);e=[r,r];t=[i,n];this._setVal(r);return[t,e]};AverageXHelper.prototype._getEquation=function(e){var t=MathHelper.avg(this.x);this._isXString&&(t-=1);e&&(t=e(t));return" x ="+t};AverageXHelper.prototype._defaultEquationFmt=function(t){return Math.abs(t)<1e5?e.prototype._defaultEquationFmt.call(this,t):""+MathHelper.round(t,2)};return AverageXHelper}(SimpleTrendHelper),AverageYHelper=function(e){__extends(AverageYHelper,e);function AverageYHelper(t,r,i){return e.call(this,t,r,i)||this}AverageYHelper.prototype.calculateValues=function(){var e,t,r=MathHelper.avg(this.y),i=this.xMin,n=this.xMax;if(this._isXString){i-=1;n-=1}e=[i,n];t=[r,r];this._setVal(r);return[t,e]};AverageYHelper.prototype._getEquation=function(e){return"y = "+e(MathHelper.avg(this.y))};AverageYHelper.prototype._defaultEquationFmt=function(t){return Math.abs(t)<1e5?e.prototype._defaultEquationFmt.call(this,t):""+MathHelper.round(t,2)};return AverageYHelper}(SimpleTrendHelper),TrendLineHelper={TrendHelperBase:TrendHelperBase,Linear:LinearHelper,Exponential:ExpHelper,Logarithmic:LogHelper,Power:PowerHelper,Polynomial:PolyHelper,Fourier:FourierHelper,MinX:MinXHelper,MinY:MinYHelper,MaxX:MaxXHelper,MaxY:MaxYHelper,AverageX:AverageXHelper,AverageY:AverageYHelper},FunctionSeries=function(e){__extends(FunctionSeries,e);function FunctionSeries(t){var r=e.call(this)||this;r._min=0;r._max=1;r.initialize(t);null==r.itemsSource&&(r.itemsSource=[new Point(0,0)]);return r}Object.defineProperty(FunctionSeries.prototype,"min",{get:function(){return this._min},set:function(e){if(this._min!==e){this._min=asNumber(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FunctionSeries.prototype,"max",{get:function(){return this._max},set:function(e){if(this._max!==e){this._max=asNumber(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});FunctionSeries.prototype.getValues=function(e){null!=this._xValues&&null!=this._yValues||this._calculateValues();return 0===e?this._yValues||null:1===e?this._xValues||null:void 0};FunctionSeries.prototype._calculateValues=function(){for(var e,t=this.sampleCount,r=[],i=[],n=(this.max-this.min)/(t-1),a=0;a<t;a++){e=a===t-1?this.max:this.min+n*a;r[a]=this._calculateX(e);i[a]=this._calculateY(e)}this._yValues=i;this._xValues=r};FunctionSeries.prototype._validateValue=function(e){return isFinite(e)?e:Number.NaN};FunctionSeries.prototype._calculateValue=function(e,t){var r;try{r=e(t)}catch(e){r=Number.NaN}return this._validateValue(r)};FunctionSeries.prototype._calculateX=function(e){return 0};FunctionSeries.prototype._calculateY=function(e){return 0};return FunctionSeries}(TrendLineBase);export{FunctionSeries};var YFunctionSeries=function(e){__extends(YFunctionSeries,e);function YFunctionSeries(t){return e.call(this,t)||this}Object.defineProperty(YFunctionSeries.prototype,"func",{get:function(){return this._func},set:function(e){if(e&&this._func!==e){this._func=asFunction(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});YFunctionSeries.prototype._calculateX=function(e){return e};YFunctionSeries.prototype._calculateY=function(e){return this._calculateValue(this.func,e)};YFunctionSeries.prototype.approximate=function(e){return this._calculateValue(this.func,e)};return YFunctionSeries}(FunctionSeries);export{YFunctionSeries};var ParametricFunctionSeries=function(e){__extends(ParametricFunctionSeries,e);function ParametricFunctionSeries(t){return e.call(this,t)||this}Object.defineProperty(ParametricFunctionSeries.prototype,"xFunc",{get:function(){return this._xFunc},set:function(e){if(e&&this._xFunc!==e){this._xFunc=asFunction(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ParametricFunctionSeries.prototype,"yFunc",{get:function(){return this._yFunc},set:function(e){if(e&&this._yFunc!==e){this._yFunc=asFunction(e,!1);this._invalidate()}},enumerable:!0,configurable:!0});ParametricFunctionSeries.prototype._calculateX=function(e){return this._calculateValue(this.xFunc,e)};ParametricFunctionSeries.prototype._calculateY=function(e){return this._calculateValue(this.yFunc,e)};ParametricFunctionSeries.prototype.approximate=function(e){var t=this._calculateValue(this.xFunc,e),r=this._calculateValue(this.yFunc,e);return new Point(t,r)};return ParametricFunctionSeries}(FunctionSeries);export{ParametricFunctionSeries};export var ErrorAmount;!function(e){e[e.FixedValue=0]="FixedValue";e[e.Percentage=1]="Percentage";e[e.StandardDeviation=2]="StandardDeviation";e[e.StandardError=3]="StandardError";e[e.Custom=4]="Custom"}(ErrorAmount||(ErrorAmount={}));export var ErrorBarEndStyle;!function(e){e[e.Cap=0]="Cap";e[e.NoCap=1]="NoCap"}(ErrorBarEndStyle||(ErrorBarEndStyle={}));export var ErrorBarDirection;!function(e){e[e.Both=0]="Both";e[e.Minus=1]="Minus";e[e.Plus=2]="Plus"}(ErrorBarDirection||(ErrorBarDirection={}));var ErrorBar=function(e){__extends(ErrorBar,e);function ErrorBar(t){var r=e.call(this)||this;r._errorAmount=ErrorAmount.FixedValue;r._endStyle=ErrorBarEndStyle.Cap;r._direction=ErrorBarDirection.Both;r.rendering.addHandler(r._rendering,r);r.initialize(t);return r}Object.defineProperty(ErrorBar.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this._value){this._value=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"errorAmount",{get:function(){return this._errorAmount},set:function(e){if((e=asEnum(e,ErrorAmount,!0))!=this._errorAmount){this._errorAmount=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"errorBarStyle",{get:function(){return this._errorBarStyle},set:function(e){if(e!=this._errorBarStyle){this._errorBarStyle=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"endStyle",{get:function(){return this._endStyle},set:function(e){if((e=asEnum(e,ErrorBarEndStyle,!0))!=this._endStyle){this._endStyle=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"direction",{get:function(){return this._direction},set:function(e){if((e=asEnum(e,ErrorBarDirection,!0))!=this._direction){this._direction=e;this._invalidate()}},enumerable:!0,configurable:!0});ErrorBar.prototype.getDataRect=function(e,t){if(!e)return null;this._chart;var r,i=this.errorAmount,n=0,a=0;this._paddings=[];this._calculateErrorValue();var o,s,l=this.getValues(0),u=e.top,h=e.bottom;if(!l)return e;for(o=0,r=l.length;o<r;o++){var c={plus:0,val:0,minus:0},f=this._value||0;s=l[o];switch(i){case ErrorAmount.Custom:(c=this._getCustomValue(o)).val=s;this._paddings.push(c);break;case ErrorAmount.FixedValue:this._paddings.push({plus:f,minus:f,val:s});break;case ErrorAmount.Percentage:this._paddings.push({plus:s*f,minus:s*f,val:s});break;case ErrorAmount.StandardDeviation:this._paddings.push({plus:this._errorValue*f,minus:this._errorValue*f,val:s});break;case ErrorAmount.StandardError:this._paddings.push({plus:this._errorValue,minus:this._errorValue,val:s})}(isNaN(u)||u>s-c.minus)&&(u=s-c.minus);(isNaN(h)||h<s+c.plus)&&(h=s+c.plus)}switch(i){case ErrorAmount.FixedValue:n=f;a=f;break;case ErrorAmount.Percentage:n=u*f;a=h*f;break;case ErrorAmount.StandardDeviation:n=this._errorValue*f;a=this._errorValue*f;break;case ErrorAmount.StandardError:n=this._errorValue;a=this._errorValue}this._showPlus&&(h+=a);this._showMinus&&(u-=n);return new Rect(e.left,u,e.width,h-u)};ErrorBar.prototype._getCustomValue=function(e){var t,r=this.value,i={minus:0,val:0,plus:0};if(null!=this._minusBindingValues||null!=this._plusBindingValues){i.minus=this._minusBindingValues&&this._minusBindingValues[e]||0;i.plus=this._plusBindingValues&&this._plusBindingValues[e]||0;return i}if(null==r)return i;if(isArray(r)){(t=r[e])&&t.minus&&(i.minus=t.minus);t&&t.plus&&(i.plus=t.plus)}else if(isNumber(r)){i.minus=r;i.plus=r}else{r.minus&&(i.minus=r.minus);r.plus&&(i.plus=r.plus)}return i};ErrorBar.prototype._calculateErrorValue=function(){var e=0,t=0,r=0;if(this._errorAmount===ErrorAmount.StandardDeviation||this._errorAmount===ErrorAmount.StandardError){var i=this.getValues(0);if(null!=i){i.forEach((function(r){e+=r;t++}));r=e/t;this._mean=r;e=0;i.forEach((function(t){e+=Math.pow(t-r,2)}));this._errorValue=Math.sqrt(e/(t-1))}this._errorAmount==ErrorAmount.StandardError&&(this._errorValue=this._errorValue/Math.sqrt(t))}};ErrorBar.prototype._clearValues=function(){this.__errorValue=null;this._mean=null;this._plusBindingValues=null;this._minusBindingValues=null;e.prototype._clearValues.call(this)};ErrorBar.prototype.getValues=function(t){if(0==t&&this.errorAmount===ErrorAmount.Custom){var r=this._getBinding(1),i=this._getBinding(2);if((null==this._plusBindingValues||null==this._minusBindingValues)&&r&&i)if(null!=this._cv){if(r){var n=this._bindValues(this._cv.items,r);this._plusBindingValues=n.values}if(i){var a=this._bindValues(this._cv.items,i);this._minusBindingValues=a.values}}else if(null!=this.binding&&null!=this._chart&&null!=this._chart.collectionView){if(r){n=this._bindValues(this._chart.collectionView.items,r);this._plusBindingValues=n.values}if(i){a=this._bindValues(this._chart.collectionView.items,i);this._minusBindingValues=a.values}}}return e.prototype.getValues.call(this,t)};Object.defineProperty(ErrorBar.prototype,"_chart",{get:function(){return this.__chart},set:function(e){e!==this.__chart&&(this.__chart=e)},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"_errorValue",{get:function(){return this.__errorValue},set:function(e){e!=this.__errorValue&&(this.__errorValue=e)},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"_showPlus",{get:function(){return this.direction===ErrorBarDirection.Both||this.direction===ErrorBarDirection.Plus},enumerable:!0,configurable:!0});Object.defineProperty(ErrorBar.prototype,"_showMinus",{get:function(){return this.direction===ErrorBarDirection.Both||this.direction===ErrorBarDirection.Minus},enumerable:!0,configurable:!0});ErrorBar.prototype._rendering=function(e,t){var r=this;this._errorBarEles=[];t.cancel=!0;var i=this.chart,n=i._plotRect,a=this._getAxisY(),o=this._getAxisX(),s=(a.origin,t.engine),l=i.series.indexOf(this),u=this._plotter;u.plotSeries(s,o,a,this,i,t.index,t.count,(function(e){var t,h,c,f=r._paddings,p=r._showPlus,_=r._showMinus,d=i._isRotated(),m=r.errorBarStyle&&r.errorBarStyle["stroke-width"]||2;c=(h=d?o:a).actualMax;t=h.convert(c);var y=s.stroke,g=s.strokeWidth;s.stroke="black";s.strokeWidth=1;var v=r.chart._plotrectId;s.startGroup(null,v);e&&e.length&&e.forEach((function(e,i){if(null!=e&&null!=e.x&&null!=e.y){var a=f[i],o=a&&a.minus||0,y=a&&a.plus||0,g=Math.abs(h.convert(c-o)-t),v=Math.abs(h.convert(c+y)-t),b=new Point(e.x,e.y),x=new Point(e.x,e.y);if(d){if(r.errorAmount===ErrorAmount.StandardDeviation){e=new Point(h.convert(r._mean),e.y);b.x=e.x;x.x=e.x}_&&(b.x=b.x-g);p&&(x.x=x.x+v)}else{if(r.errorAmount===ErrorAmount.StandardDeviation){e=new Point(e.x,h.convert(r._mean));b.y=e.y;x.y=e.y}_&&(b.y=b.y+g);p&&(x.y=x.y-v)}var P=void 0;P=d?new Rect(b.x,b.y-m,Math.abs(x.x-b.x),2*m):new Rect(x.x-m,x.y,2*m,Math.abs(x.y-b.y));var M=new _RectArea(P);M.ignoreLabel=!0;var S=new _DataPoint(l,i,i,a.val);M.tag=S;u.hitTester.add(M,l);var H=[s.drawLine(b.x,b.y,x.x,x.y,"error-bar",r.errorBarStyle)];r._errorBarEles[i]=H;if(r.endStyle===ErrorBarEndStyle.Cap){if(p){var B=void 0;if(d){if(x.x<=n.right){B=s.drawLine(x.x,x.y-m,x.x,x.y+m,"error-bar",r.errorBarStyle);H.push(B)}}else if(x.y>=n.top){B=s.drawLine(x.x-m,x.y,x.x+m,x.y,"error-bar",r.errorBarStyle);H.push(B)}}if(_){var L=void 0;if(d){if(b.x>=n.left){L=s.drawLine(b.x,b.y-m,b.x,b.y+m,"error-bar",r.errorBarStyle);H.push(L)}}else if(b.y<=n.bottom){L=s.drawLine(b.x-m,b.y,b.x+m,b.y,"error-bar",r.errorBarStyle);H.push(L)}}}}}));s.endGroup();s.stroke=y;s.strokeWidth=g}))};ErrorBar.prototype.getPlotElement=function(e){if(this.hostElement&&e<this._pointIndexes.length){var t=null==this._errorBarEles[e]?[]:this._errorBarEles[e].slice(),r=this._pointIndexes[e];r<this.hostElement.childNodes.length&&t.push(this.hostElement.childNodes[r]);return t}return null};return ErrorBar}(Series);export{ErrorBar};_addCultureInfo("FlexChartAnalytics",{BreakEven:{profitArea:"Profit Area",lossArea:"Loss Area",safetyMargin:"Safety Margin",salesRevenue:"Sales Revenue",totalCost:"Total Cost",fixedCost:"Fixed Cost",variableCost:"Variable Cost",marginalProfit:"Marginal Profit",breakEven:"Break Even"}});var BreakEven=function(e){__extends(BreakEven,e);function BreakEven(t){var r=e.call(this)||this;r.rendering.addHandler(r._rendering,r);r.style={fill:"rgba(0,255,0,0.5)",strokeWidth:0};r.altStyle={fill:"rgba(255,0,0,0.5)",strokeWidth:0};r.tooltipContent="{y}";r.initialize(t);r._chartType=ChartType.Line;var i=culture.FlexChartAnalytics.BreakEven;r.name=i.profitArea+","+i.lossArea+","+i.safetyMargin+","+i.salesRevenue+","+i.totalCost+","+i.fixedCost+","+i.variableCost+","+i.marginalProfit+","+i.breakEven;return r}Object.defineProperty(BreakEven.prototype,"fixedCost",{get:function(){return this._fixedCost},set:function(e){if(e!=this._fixedCost){this._fixedCost=asNumber(e,!0,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BreakEven.prototype,"variableCost",{get:function(){return this._variableCost},set:function(e){if(e!=this._variableCost){this._variableCost=asNumber(e,!0,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BreakEven.prototype,"salesPrice",{get:function(){return this._salesPrice},set:function(e){if(e!=this._salesPrice){this._salesPrice=asNumber(e,!0,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BreakEven.prototype,"styles",{get:function(){return this._styles},set:function(e){if(e!==this._styles){this._styles=e;this._invalidate()}},enumerable:!0,configurable:!0});BreakEven.prototype.getValues=function(e){var t=this.salesPrice-this.variableCost;if(0==t)return null;for(var r=1.3*(this.fixedCost/t),i=[],n=0;n<10;n++)0==e?i.push(n*r/10*this.salesPrice):1==e&&i.push(n*r/10);return i};BreakEven.prototype._rendering=function(e,t){this.chart._plotRect;var r=t.engine,i=this.chart.axisX,n=this.chart.axisY,a=this.getValues(1),o=this.getValues(0),s=this.salesPrice-this.variableCost,l=this.fixedCost/s,u=this.fixedCost+o[o.length-1]-s*a[a.length-1],h=this.chart._plotrectId;r.startGroup(null,h);if(this.style&&this.style.fill){r.fill=this.style.fill;r.drawPolygon([i.convert(a[a.length-1]),i.convert(l),i.convert(a[a.length-1])],[n.convert(o[o.length-1]),n.convert(l*this.salesPrice),n.convert(u)]);r.fill=null}if(this.altStyle&&this.altStyle.fill){r.fill=this.altStyle.fill;r.drawPolygon([i.convert(a[0]),i.convert(l),i.convert(a[0])],[n.convert(0),n.convert(l*this.salesPrice),n.convert(this.fixedCost)]);r.fill=null}var c=this.styles?this.styles.safetyMargin:void 0,f=this.styles?this.styles.salesRevenue:void 0,p=this.styles?this.styles.totalCost:void 0,_=this.styles?this.styles.fixedCost:void 0,d=this.styles?this.styles.variableCost:void 0,m=this.styles?this.styles.marginalProfit:void 0,y=this.styles?this.styles.breakEven:void 0;if(c&&c.fill){r.fill=c.fill;r.drawPolygon([i.convert(a[a.length-1]),i.convert(l),i.convert(a[a.length-1])],[n.convert(a[a.length-1]*(this.salesPrice-this.variableCost)),n.convert(this.fixedCost),n.convert(this.fixedCost)]);r.fill=null}if(f){this._setStyle(r,f);r.drawLine(i.convert(0),n.convert(0),i.convert(a[a.length-1]),n.convert(o[o.length-1]))}if(p){this._setStyle(r,p);r.drawLine(i.convert(a[0]),n.convert(this.fixedCost),i.convert(a[a.length-1]),n.convert(u))}if(_){this._setStyle(r,_);r.drawLine(i.convert(a[0]),n.convert(this.fixedCost),i.convert(a[a.length-1]),n.convert(this.fixedCost))}if(d){this._setStyle(r,d);r.drawLine(i.convert(a[0]),n.convert(0),i.convert(a[a.length-1]),n.convert(a[a.length-1]*this.variableCost))}if(m){this._setStyle(r,m);r.drawLine(i.convert(a[0]),n.convert(0),i.convert(a[a.length-1]),n.convert(a[a.length-1]*(this.salesPrice-this.variableCost)))}if(y){this._setStyle(r,y);r.drawLine(i.convert(l),n.convert(0),i.convert(l),n.convert(l*this.salesPrice));r.drawLine(i.convert(0),n.convert(l*this.salesPrice),i.convert(l),n.convert(l*this.salesPrice))}r.endGroup()};BreakEven.prototype._setStyle=function(e,t){e.stroke=t.stroke;e.strokeWidth=t.strokeWidth?t.strokeWidth:3};BreakEven.prototype._getName=function(e){var t=void 0;if(this.name)if(this.name.indexOf(",")){var r=this.name.split(",");r&&r.length-1>=e&&(t=r[e].trim())}else t=this.name;return t};BreakEven.prototype.legendItemLength=function(){return 9};BreakEven.prototype._getStyle=function(e){var t=null;switch(e){case 0:t=this.style;break;case 1:t=this.altStyle;break;case 2:t=this.styles?this.styles.safetyMargin:null;break;case 3:t=this.styles?this.styles.salesRevenue:null;break;case 4:t=this.styles?this.styles.totalCost:null;break;case 5:t=this.styles?this.styles.fixedCost:null;break;case 6:t=this.styles?this.styles.variableCost:null;break;case 7:t=this.styles?this.styles.marginalProfit:null;break;case 8:t=this.styles?this.styles.breakEven:null}return t};BreakEven.prototype.measureLegendItem=function(e,t){var r=this._getName(t),i=new Size(0,0),n=this._getStyle(t);r&&n&&(i=this._measureLegendItem(e,this._getName(t)));return i};BreakEven.prototype.drawLegendItem=function(e,t,r){var i=this._getStyle(r),n=this._getName(r);n&&i&&this._drawLegendItem(e,t,r<3?5:3,n,i,this.symbolStyle)};return BreakEven}(SeriesBase);export{BreakEven};export var QuartileCalculation;!function(e){e[e.InclusiveMedian=0]="InclusiveMedian";e[e.ExclusiveMedian=1]="ExclusiveMedian"}(QuartileCalculation||(QuartileCalculation={}));var BoxWhisker=function(e){__extends(BoxWhisker,e);function BoxWhisker(t){var r=e.call(this)||this;r._groupWidth=.8;r._gapWidth=.1;r._showInnerPoints=!1;r._showOutliers=!1;r._quartileCalculation=QuartileCalculation.InclusiveMedian;r._chartType=ChartType.Bar;r.rendering.addHandler(r._rendering,r);r.initialize(t);return r}BoxWhisker.prototype._initProperties=function(e){copy(this,e)};BoxWhisker.prototype._clearValues=function(){e.prototype._clearValues.call(this)};Object.defineProperty(BoxWhisker.prototype,"quartileCalculation",{get:function(){return this._quartileCalculation},set:function(e){if((e=asEnum(e,QuartileCalculation,!0))!=this._quartileCalculation){this._quartileCalculation=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"groupWidth",{get:function(){return this._groupWidth},set:function(e){if(e!=this._groupWidth&&e>=0&&e<=1){this._groupWidth=asNumber(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"gapWidth",{get:function(){return this._gapWidth},set:function(e){if(e!=this._gapWidth&&e>=0&&e<=1){this._gapWidth=asNumber(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"showMeanLine",{get:function(){return this._showMeanLine},set:function(e){if(e!=this._showMeanLine){this._showMeanLine=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"meanLineStyle",{get:function(){return this._meanLineStyle},set:function(e){if(e!=this._meanLineStyle){this._meanLineStyle=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"showMeanMarker",{get:function(){return this._showMeanMarker},set:function(e){if(e!=this._showMeanMarker){this._showMeanMarker=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"meanMarkerStyle",{get:function(){return this._meanMarkerStyle},set:function(e){if(e!=this._meanMarkerStyle){this._meanMarkerStyle=e;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"showInnerPoints",{get:function(){return this._showInnerPoints},set:function(e){if(e!=this._showInnerPoints){this._showInnerPoints=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(BoxWhisker.prototype,"showOutliers",{get:function(){return this._showOutliers},set:function(e){if(e!=this._showOutliers){this._showOutliers=asBoolean(e,!0);this._invalidate()}},enumerable:!0,configurable:!0});BoxWhisker.prototype._rendering=function(e,t){var r=this;t.cancel=!0;var i,n,a=this,o=a.chart,s=(a.chart,a._getAxisX()),l=a._getAxisY(),u=t.index,h=t.count,c=t.engine,f=this._plotter,p=o.series.indexOf(a),_=asType(a,SeriesBase),d=this.quartileCalculation,m=this.showOutliers,y=this.groupWidth,g=(null==this.gapWidth?.2:this.gapWidth)/2;u=u||0;var v=y/(h=h||1),b=a.getValues(0),x=a.getValues(1);if(b){x||(x=f.dataInfo.getXVals());if(x){var P=f.dataInfo.getDeltaX();if(P>0){y*=P;v*=P}}var M=_._getSymbolFill(p),S=_._getAltSymbolFill(p)||M,H=_._getSymbolStroke(p),B=_._getAltSymbolStroke(p)||H,L=b.length;null!=x&&(L=Math.min(L,x.length));var w,E,V=0,T=0,O=f.getItemFormatter(a);if(f.rotated){(V=s.origin||V)<s.actualMin?V=s.actualMin:V>s.actualMax&&(V=s.actualMax);s.convert(V);var C=l.actualMin,A=l.actualMax;for(q=0;q<L;q++){j=x?x[q]:q;if(null==(F=b[q])||0===F.length)return;f._getSymbolOrigin&&l.convert(f._getSymbolOrigin(V,q));if(f._getSymbolStyles){M=(W=f._getSymbolStyles(q))&&W.fill?W.fill:M;S=W&&W.fill?W.fill:S;H=W&&W.stroke?W.fill:H;B=W&&W.stroke?W.fill:B}w=F[0]>0?M:S;E=F[0]>0?H:B;c.fill=w;c.stroke=E;if(_DataInfo.isValid(j)&&isArray(F)&&F.length>0&&_DataInfo.isValid(F[0])){var X=j-.5*y+u*v,Y=j-.5*y+(u+1)*v;Y-=N=(Y-X)*g;if((X+=N)<C&&Y<C||X>A&&Y>A)continue;X=l.convert(X);Y=l.convert(Y);R=new _BoxPlot(F,d,m),G={min:s.convert(R.min),max:s.convert(R.max),firstQuartile:s.convert(R.firstQuartile),median:s.convert(R.median),thirdQuartile:s.convert(R.thirdQuartile),mean:s.convert(R.mean),outlierPoints:this._convertPoints(R.outlierPoints,s),innerPoints:this._convertPoints(R.innerPoints,s)},z=new Rect(Math.min(G.min,G.max),Math.min(X,Y),Math.abs(G.max-G.min),Math.abs(Y-X)),K=new _RectArea(z);var k={min:Math.min(X,Y),median:(X+Y)/2,max:Math.max(Y,X)};if(O){c.startGroup();(J=new HitTestInfo(o,new Point((G.min+G.max)/2,k.median),ChartElement.SeriesSymbol))._setData(a,q);O(c,J,(function(){r._drawBoxWhisker(c,G,k,i,n,a);i=G;n=k}));c.endGroup()}else{this._drawBoxWhisker(c,G,k,i,n,a);i=G;n=k}a._setPointIndex(q,T);T++;(D=new _DataPoint(p,q,F,j)).item=R;K.tag=D;f.hitTester.add(K,p);R.outlierPoints&&R.outlierPoints.length&&R.outlierPoints.forEach((function(e,t){var r=G.outlierPoints[t],i=new _CircleArea(new Point(r,z.top+z.height/2),2);i.tag=D;f.hitTester.add(i,p)}))}}}else{(V=l.origin||V)<l.actualMin?V=l.actualMin:V>l.actualMax&&(V=l.actualMax);l.convert(V),s.actualMin,s.actualMax;for(var q=0;q<L;q++){var F,j=x?x[q]:q;if(null==(F=b[q])||0===F.length)return;f._getSymbolOrigin&&l.convert(f._getSymbolOrigin(V,q,L));if(f._getSymbolStyles){var W;M=(W=f._getSymbolStyles(q,L))&&W.fill?W.fill:M;S=W&&W.fill?W.fill:S;H=W&&W.stroke?W.stroke:H;B=W&&W.stroke?W.stroke:B}w=F[0]>0?M:S;E=F[0]>0?H:B;c.fill=w;c.stroke=E;if(_DataInfo.isValid(j)&&isArray(F)&&F.length>0&&_DataInfo.isValid(F[0])){var N,I=j-.5*y+u*v,Q=j-.5*y+(u+1)*v;I+=N=(Q-I)*g;Q-=N;I=s.convert(I);Q=s.convert(Q);if(!_DataInfo.isValid(I)||!_DataInfo.isValid(Q))continue;var D,R=new _BoxPlot(F,d,m),G={min:l.convert(R.min),max:l.convert(R.max),firstQuartile:l.convert(R.firstQuartile),median:l.convert(R.median),thirdQuartile:l.convert(R.thirdQuartile),mean:l.convert(R.mean),outlierPoints:this._convertPoints(R.outlierPoints,l),innerPoints:this._convertPoints(R.innerPoints,l)},z=new Rect(Math.min(I,Q),Math.min(G.min,G.max),Math.abs(Q-I),Math.abs(G.max-G.min)),K=new _RectArea(z),U={min:Math.min(I,Q),median:(I+Q)/2,max:Math.max(I,Q)};if(O){c.startGroup();var J;(J=new HitTestInfo(o,new Point(U.median,(G.min+G.max)/2),ChartElement.SeriesSymbol))._setData(a,q);O(c,J,(function(){r._drawBoxWhisker(c,U,G,i,n,a);i=U;n=G}));c.endGroup()}else{this._drawBoxWhisker(c,U,G,i,n,a);i=U;n=G}a._setPointIndex(q,T);T++;(D=new _DataPoint(p,q,j,F)).item=R;K.tag=D;f.hitTester.add(K,p);R.outlierPoints&&R.outlierPoints.length&&R.outlierPoints.forEach((function(e,t){var r=G.outlierPoints[t],i=new _CircleArea(new Point(z.left+z.width/2,r),2);i.tag=D;f.hitTester.add(i,p)}))}}}}};BoxWhisker.prototype._convertPoints=function(e,t){return e.map((function(e){return t.convert(e)}))};BoxWhisker.prototype._drawBoxWhisker=function(e,t,r,i,n,a){var o=a.symbolStyle,s=this.showInnerPoints,l=this.showOutliers,u=this.showMeanLine,h=this.meanLineStyle,c=this.showMeanMarker,f=this.meanMarkerStyle,p=this._plotter;e.startGroup("box-plot");e.strokeWidth=1;if(p.rotated){e.drawLine(t.min,(r.min+r.median)/2,t.min,(r.max+r.median)/2,null,o);e.drawLine(t.min,r.median,t.firstQuartile,r.median,null,o);e.drawRect(Math.min(t.firstQuartile,t.thirdQuartile),Math.min(r.min,r.max),Math.abs(t.thirdQuartile-t.firstQuartile),Math.abs(r.max-r.min),null,o);e.drawLine(t.median,r.min,t.median,r.max,null,o);e.drawLine(t.max,r.median,t.thirdQuartile,r.median,null,o);e.drawLine(t.max,(r.min+r.median)/2,t.max,(r.max+r.median)/2,null,o);u&&i&&n&&e.drawLine(t.mean,r.median,i.mean,n.median,"box-whisker-mean-line",h||o);if(c){var _=Math.abs(r.median-r.min)/2;e.drawLine(t.mean-_,r.median-_,t.mean+_,r.median+_,null,f||o);e.drawLine(t.mean+_,r.median-_,t.mean-_,r.median+_,null,f||o)}l&&t.outlierPoints.forEach((function(t){e.drawPieSegment(t,r.median,2,0,2*Math.PI,null,o)}));s&&t.innerPoints.forEach((function(t){e.drawPieSegment(t,r.median,2,0,2*Math.PI,null,o)}))}else{e.drawLine((t.min+t.median)/2,r.min,(t.max+t.median)/2,r.min,null,o);e.drawLine(t.median,r.min,t.median,r.firstQuartile,null,o);e.drawRect(Math.min(t.min,t.max),Math.min(r.firstQuartile,r.thirdQuartile),Math.abs(t.max-t.min),Math.abs(r.thirdQuartile-r.firstQuartile),null,o);e.drawLine(t.min,r.median,t.max,r.median,null,o);e.drawLine(t.median,r.max,t.median,r.thirdQuartile,null,o);e.drawLine((t.min+t.median)/2,r.max,(t.max+t.median)/2,r.max,null,o);u&&i&&n&&e.drawLine(t.median,r.mean,i.median,n.mean,"box-whisker-mean-line",h||o);if(c){_=Math.abs(t.median-t.min)/2;e.drawLine(t.median-_,r.mean-_,t.median+_,r.mean+_,null,f||o);e.drawLine(t.median-_,r.mean+_,t.median+_,r.mean-_,null,f||o)}l&&r.outlierPoints.forEach((function(r){e.drawPieSegment(t.median,r,2,0,2*Math.PI,null,o)}));s&&r.innerPoints.forEach((function(r){e.drawPieSegment(t.median,r,2,0,2*Math.PI,null,o)}))}e.endGroup()};BoxWhisker.prototype._renderLabels=function(e,t,r,i){var n=this,a=this,o=this._plotter,s=t.length,l=r.dataLabel,u=l.border,h=l.offset,c=l.connectingLine,f="dataY";o.rotated&&(f="dataX");void 0===h&&(h=c?16:0);u&&(h-=2);for(var p=[],_=0;_<s;_++){var d=t[_],m=d.tag,y=asType(m,_DataPoint,!0);if(y&&-1==p.indexOf(y)){p.push(y);var g=m.item,v=m.y;m[f]=g.min;m.yfmt=g.min;m.y=g.min;this._plotter._renderLabel(e,d,y,r,l,a,h,i);m[f]=g.firstQuartile;m.yfmt=g.firstQuartile;m.y=g.firstQuartile;this._plotter._renderLabel(e,d,y,r,l,a,h,i);m[f]=g.median;m.yfmt=g.median;m.y=g.median;this._plotter._renderLabel(e,d,y,r,l,a,h,i);m[f]=g.thirdQuartile;m.yfmt=g.thirdQuartile;m.y=g.thirdQuartile;this._plotter._renderLabel(e,d,y,r,l,a,h,i);m[f]=g.max;m.yfmt=g.max;m.y=g.max;this._plotter._renderLabel(e,d,y,r,l,a,h,i);if(this.showMeanMarker){var b=Number(g.mean.toFixed(2));m[f]=b;m.yfmt=b;m.y=b;this._plotter._renderLabel(e,d,y,r,l,a,h,i)}g.showOutliers&&g.outlierPoints&&g.outlierPoints.forEach((function(t){m[f]=t;m.yfmt=t;m.y=t;n._plotter._renderLabel(e,d,y,r,l,a,h,i)}));m.y=v}}};return BoxWhisker}(SeriesBase);export{BoxWhisker};var _BoxPlot=function(){function _BoxPlot(e,t,r){this._outlierPoints=[];this._innerPoints=[];this._data=e;this._quartileCalculation=t;this._showOutliers=r;this._parse()}Object.defineProperty(_BoxPlot.prototype,"showOutliers",{get:function(){return this._showOutliers},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"min",{get:function(){return this._min},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"max",{get:function(){return this._max},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"mean",{get:function(){return this._mean},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"firstQuartile",{get:function(){return this._firstQuartile},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"thirdQuartile",{get:function(){return this._thirdQuartile},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"median",{get:function(){return this._median},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"outlierPoints",{get:function(){return this._outlierPoints},enumerable:!0,configurable:!0});Object.defineProperty(_BoxPlot.prototype,"innerPoints",{get:function(){return this._innerPoints},enumerable:!0,configurable:!0});_BoxPlot.prototype._parse=function(){var e=this,t=this._data.length,r=this._data,i=0;this._outlierPoints=[];this._innerPoints=[];r.sort((function(e,t){return e-t}));r.some((function(t){if(null==t)return!1;e._min=t;return!0}));this._max=null==r[t-1]?0:r[t-1];if(this._quartileCalculation===QuartileCalculation.InclusiveMedian){this._firstQuartile=this._quartileInc(r,.25);this._median=this._quartileInc(r,.5);this._thirdQuartile=this._quartileInc(r,.75)}else{this._firstQuartile=this._quartileExc(r,.25);this._median=this._quartileExc(r,.5);this._thirdQuartile=this._quartileExc(r,.75)}this._iqr=1.5*Math.abs(this._thirdQuartile-this._firstQuartile);var n=this._firstQuartile-this._iqr,a=this._thirdQuartile+this._iqr;if(this._showOutliers){var o=this._max;this._max=this._min;this._min=o;this._data.forEach((function(t){i+=t;if(t<n||t>a)e._outlierPoints.push(t);else{t<e._min&&(e._min=t);t>e._max&&(e._max=t)}}))}else i=this._data.reduce((function(e,t){return e+t}),0);this._innerPoints=this._data.filter((function(t){if(t>e._min&&t<e._max)return!0}));this._mean=i/t};_BoxPlot.prototype._quartileInc=function(e,t){var r,i,n,a,o=e.length;if(1===o)return e[0];a=(r=(o-1)*t+1)-(i=Math.floor(r));return(n=e[i-1])+(e[i]-n)*a};_BoxPlot.prototype._quartileExc=function(e,t){var r,i,n,a,o=e.length;if(1===o)return e[0];if(2===o)return e[Math.round(t)];a=(r=(o+1)*t)-(i=Math.floor(r));return(n=e[i-1])+(e[i]-n)*a};return _BoxPlot}();export{_BoxPlot};_registerModule("wijmo.chart.analytics",selfModule);