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