Your IP : 18.118.26.7


Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/main/amcharts/3.21/
Upload File :
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/main/amcharts/3.21/serial.min.js

(function(){var t=window.AmCharts;t.AmRectangularChart=t.Class({inherits:t.AmCoordinateChart,construct:function(i){t.AmRectangularChart.base.construct.call(this,i);this.theme=i;this.createEvents("zoomed","changed");this.marginRight=this.marginBottom=this.marginTop=this.marginLeft=20;this.depth3D=this.angle=0;this.plotAreaFillColors="#FFFFFF";this.plotAreaFillAlphas=0;this.plotAreaBorderColor="#000000";this.plotAreaBorderAlpha=0;this.maxZoomFactor=20;this.zoomOutButtonImageSize=19;this.zoomOutButtonImage="lens";this.zoomOutText="Show all";this.zoomOutButtonColor="#e5e5e5";this.zoomOutButtonAlpha=0;this.zoomOutButtonRollOverAlpha=1;this.zoomOutButtonPadding=8;this.trendLines=[];this.autoMargins=!0;this.marginsUpdated=!1;this.autoMarginOffset=10;t.applyTheme(this,i,"AmRectangularChart")},initChart:function(){t.AmRectangularChart.base.initChart.call(this);this.updateDxy();!this.marginsUpdated&&this.autoMargins&&(this.resetMargins(),this.drawGraphs=!1);this.processScrollbars();this.updateMargins();this.updatePlotArea();this.updateScrollbars();this.updateTrendLines();this.updateChartCursor();this.updateValueAxes();this.scrollbarOnly||this.updateGraphs()},drawChart:function(){t.AmRectangularChart.base.drawChart.call(this);this.drawPlotArea();if(t.ifArray(this.chartData)){var i=this.chartCursor;i&&i.draw()}},resetMargins:function(){var t={},i;if("xy"==this.type){var e=this.xAxes,a=this.yAxes;for(i=0;i<e.length;i++){var s=e[i];s.ignoreAxisWidth||(s.setOrientation(!0),s.fixAxisPosition(),t[s.position]=!0)}for(i=0;i<a.length;i++)e=a[i],e.ignoreAxisWidth||(e.setOrientation(!1),e.fixAxisPosition(),t[e.position]=!0)}else{a=this.valueAxes;for(i=0;i<a.length;i++)e=a[i],e.ignoreAxisWidth||(e.setOrientation(this.rotate),e.fixAxisPosition(),t[e.position]=!0);(i=this.categoryAxis)&&!i.ignoreAxisWidth&&(i.setOrientation(!this.rotate),i.fixAxisPosition(),i.fixAxisPosition(),t[i.position]=!0)}t.left&&(this.marginLeft=0);t.right&&(this.marginRight=0);t.top&&(this.marginTop=0);t.bottom&&(this.marginBottom=0);this.fixMargins=t},measureMargins:function(){var t=this.valueAxes,i,e=this.autoMarginOffset,a=this.fixMargins,s=this.realWidth,r=this.realHeight,h=e,o=e,n=s;i=r;var l;for(l=0;l<t.length;l++)t[l].handleSynchronization(),i=this.getAxisBounds(t[l],h,n,o,i),h=Math.round(i.l),n=Math.round(i.r),o=Math.round(i.t),i=Math.round(i.b);if(t=this.categoryAxis)i=this.getAxisBounds(t,h,n,o,i),h=Math.round(i.l),n=Math.round(i.r),o=Math.round(i.t),i=Math.round(i.b);a.left&&h<e&&(this.marginLeft=Math.round(-h+e),!isNaN(this.minMarginLeft)&&this.marginLeft<this.minMarginLeft&&(this.marginLeft=this.minMarginLeft));a.right&&n>=s-e&&(this.marginRight=Math.round(n-s+e),!isNaN(this.minMarginRight)&&this.marginRight<this.minMarginRight&&(this.marginRight=this.minMarginRight));a.top&&o<e+this.titleHeight&&(this.marginTop=Math.round(this.marginTop-o+e+this.titleHeight),!isNaN(this.minMarginTop)&&this.marginTop<this.minMarginTop&&(this.marginTop=this.minMarginTop));a.bottom&&i>r-e&&(this.marginBottom=Math.round(this.marginBottom+i-r+e),!isNaN(this.minMarginBottom)&&this.marginBottom<this.minMarginBottom&&(this.marginBottom=this.minMarginBottom));this.initChart()},getAxisBounds:function(t,i,e,a,s){if(!t.ignoreAxisWidth){var r=t.labelsSet,h=t.tickLength;t.inside&&(h=0);if(r)switch(r=t.getBBox(),t.position){case"top":t=r.y;a>t&&(a=t);break;case"bottom":t=r.y+r.height;s<t&&(s=t);break;case"right":t=r.x+r.width+h+3;e<t&&(e=t);break;case"left":t=r.x-h,i>t&&(i=t)}}return{l:i,t:a,r:e,b:s}},drawZoomOutButton:function(){var i=this;if(!i.zbSet){var e=i.container.set();i.zoomButtonSet.push(e);var a=i.color,s=i.fontSize,r=i.zoomOutButtonImageSize,h=i.zoomOutButtonImage.replace(/\.[a-z]*$/i,""),o=i.langObj.zoomOutText||i.zoomOutText,n=i.zoomOutButtonColor,l=i.zoomOutButtonAlpha,d=i.zoomOutButtonFontSize,u=i.zoomOutButtonPadding;isNaN(d)||(s=d);(d=i.zoomOutButtonFontColor)&&(a=d);var d=i.zoomOutButton,c;d&&(d.fontSize&&(s=d.fontSize),d.color&&(a=d.color),d.backgroundColor&&(n=d.backgroundColor),isNaN(d.backgroundAlpha)||(i.zoomOutButtonRollOverAlpha=d.backgroundAlpha));var m=d=0,m=i.pathToImages;if(h){if(t.isAbsolute(h)||void 0===m)m="";c=i.container.image(m+h+i.extension,0,0,r,r);t.setCN(i,c,"zoom-out-image");e.push(c);c=c.getBBox();d=c.width+5}void 0!==o&&(a=t.text(i.container,o,a,i.fontFamily,s,"start"),t.setCN(i,a,"zoom-out-label"),s=a.getBBox(),m=c?c.height/2-3:s.height/2,a.translate(d,m),e.push(a));c=e.getBBox();a=1;t.isModern||(a=0);n=t.rect(i.container,c.width+2*u+5,c.height+2*u-2,n,1,1,n,a);n.setAttr("opacity",l);n.translate(-u,-u);t.setCN(i,n,"zoom-out-bg");e.push(n);n.toBack();i.zbBG=n;c=n.getBBox();e.translate(i.marginLeftReal+i.plotAreaWidth-c.width+u,i.marginTopReal+u);e.hide();e.mouseover(function(){i.rollOverZB()}).mouseout(function(){i.rollOutZB()}).click(function(){i.clickZB()}).touchstart(function(){i.rollOverZB()}).touchend(function(){i.rollOutZB();i.clickZB()});for(l=0;l<e.length;l++)e[l].attr({cursor:"pointer"});void 0!==i.zoomOutButtonTabIndex&&(e.setAttr("tabindex",i.zoomOutButtonTabIndex),e.setAttr("role","menuitem"),e.keyup(function(t){13==t.keyCode&&i.clickZB()}));i.zbSet=e}},rollOverZB:function(){this.rolledOverZB=!0;this.zbBG.setAttr("opacity",this.zoomOutButtonRollOverAlpha)},rollOutZB:function(){this.rolledOverZB=!1;this.zbBG.setAttr("opacity",this.zoomOutButtonAlpha)},clickZB:function(){this.rolledOverZB=!1;this.zoomOut()},zoomOut:function(){this.zoomOutValueAxes()},drawPlotArea:function(){var i=this.dx,e=this.dy,a=this.marginLeftReal,s=this.marginTopReal,r=this.plotAreaWidth-1,h=this.plotAreaHeight-1,o=this.plotAreaFillColors,n=this.plotAreaFillAlphas,l=this.plotAreaBorderColor,d=this.plotAreaBorderAlpha;"object"==typeof n&&(n=n[0]);o=t.polygon(this.container,[0,r,r,0,0],[0,0,h,h,0],o,n,1,l,d,this.plotAreaGradientAngle);t.setCN(this,o,"plot-area");o.translate(a+i,s+e);this.set.push(o);0!==i&&0!==e&&(o=this.plotAreaFillColors,"object"==typeof o&&(o=o[0]),o=t.adjustLuminosity(o,-.15),r=t.polygon(this.container,[0,i,r+i,r,0],[0,e,e,0,0],o,n,1,l,d),t.setCN(this,r,"plot-area-bottom"),r.translate(a,s+h),this.set.push(r),i=t.polygon(this.container,[0,0,i,i,0],[0,h,h+e,e,0],o,n,1,l,d),t.setCN(this,i,"plot-area-left"),i.translate(a,s),this.set.push(i));(a=this.bbset)&&this.scrollbarOnly&&a.remove()},updatePlotArea:function(){var t=this.updateWidth(),i=this.updateHeight(),e=this.container;this.realWidth=t;this.realWidth=i;e&&this.container.setSize(t,i);var e=this.marginLeftReal,a=this.marginTopReal,t=t-e-this.marginRightReal-this.dx,i=i-a-this.marginBottomReal;1>t&&(t=1);1>i&&(i=1);this.plotAreaWidth=Math.round(t);this.plotAreaHeight=Math.round(i);this.plotBalloonsSet.translate(e,a)},updateDxy:function(){this.dx=Math.round(this.depth3D*Math.cos(this.angle*Math.PI/180));this.dy=Math.round(-this.depth3D*Math.sin(this.angle*Math.PI/180));this.d3x=Math.round(this.columnSpacing3D*Math.cos(this.angle*Math.PI/180));this.d3y=Math.round(-this.columnSpacing3D*Math.sin(this.angle*Math.PI/180))},updateMargins:function(){var t=this.getTitleHeight();this.titleHeight=t;this.marginTopReal=this.marginTop-this.dy;this.fixMargins&&!this.fixMargins.top&&(this.marginTopReal+=t);this.marginBottomReal=this.marginBottom;this.marginLeftReal=this.marginLeft;this.marginRightReal=this.marginRight},updateValueAxes:function(){var t=this.valueAxes,i;for(i=0;i<t.length;i++){var e=t[i];this.setAxisRenderers(e);this.updateObjectSize(e)}},setAxisRenderers:function(i){i.axisRenderer=t.RecAxis;i.guideFillRenderer=t.RecFill;i.axisItemRenderer=t.RecItem;i.marginsChanged=!0},updateGraphs:function(){var t=this.graphs,i;for(i=0;i<t.length;i++){var e=t[i];e.index=i;e.rotate=this.rotate;this.updateObjectSize(e)}},updateObjectSize:function(t){t.width=this.plotAreaWidth-1;t.height=this.plotAreaHeight-1;t.x=this.marginLeftReal;t.y=this.marginTopReal;t.dx=this.dx;t.dy=this.dy},updateChartCursor:function(){var i=this.chartCursor;i&&(i=t.processObject(i,t.ChartCursor,this.theme),this.updateObjectSize(i),this.addChartCursor(i),i.chart=this)},processScrollbars:function(){var i=this.chartScrollbar;i&&(i=t.processObject(i,t.ChartScrollbar,this.theme),this.addChartScrollbar(i))},updateScrollbars:function(){},removeChartCursor:function(){t.callMethod("destroy",[this.chartCursor]);this.chartCursor=null},zoomTrendLines:function(){var t=this.trendLines,i;for(i=0;i<t.length;i++){var e=t[i];e.valueAxis.recalculateToPercents?e.set&&e.set.hide():(e.x=this.marginLeftReal,e.y=this.marginTopReal,e.draw())}},handleCursorValueZoom:function(){},addTrendLine:function(t){this.trendLines.push(t)},zoomOutValueAxes:function(){for(var t=this.valueAxes,i=0;i<t.length;i++)t[i].zoomOut()},removeTrendLine:function(t){var i=this.trendLines,e;for(e=i.length-1;0<=e;e--)i[e]==t&&i.splice(e,1)},adjustMargins:function(t,i){var e=t.position,a=t.scrollbarHeight+t.offset;t.enabled&&("top"==e?i?this.marginLeftReal+=a:this.marginTopReal+=a:i?this.marginRightReal+=a:this.marginBottomReal+=a)},getScrollbarPosition:function(t,i,e){var a="bottom",s="top";t.oppositeAxis||(s=a,a="top");t.position=i?"bottom"==e||"left"==e?a:s:"top"==e||"right"==e?a:s},updateChartScrollbar:function(t,i){if(t){t.rotate=i;var e=this.marginTopReal,a=this.marginLeftReal,s=t.scrollbarHeight,r=this.dx,h=this.dy,o=t.offset;"top"==t.position?i?(t.y=e,t.x=a-s-o):(t.y=e-s+h-o,t.x=a+r):i?(t.y=e+h,t.x=a+this.plotAreaWidth+r+o):(t.y=e+this.plotAreaHeight+o,t.x=this.marginLeftReal)}},showZB:function(t){var i=this.zbSet;t&&(i=this.zoomOutText,""!==i&&i&&this.drawZoomOutButton());if(i=this.zbSet)this.zoomButtonSet.push(i),t?i.show():i.hide(),this.rollOutZB()},handleReleaseOutside:function(i){t.AmRectangularChart.base.handleReleaseOutside.call(this,i);(i=this.chartCursor)&&i.handleReleaseOutside&&i.handleReleaseOutside()},handleMouseDown:function(i){t.AmRectangularChart.base.handleMouseDown.call(this,i);var e=this.chartCursor;e&&e.handleMouseDown&&!this.rolledOverZB&&e.handleMouseDown(i)},update:function(){t.AmRectangularChart.base.update.call(this);this.chartCursor&&this.chartCursor.update&&this.chartCursor.update()},handleScrollbarValueZoom:function(t){this.relativeZoomValueAxes(t.target.valueAxes,t.relativeStart,t.relativeEnd);this.zoomAxesAndGraphs()},zoomValueScrollbar:function(t){if(t&&t.enabled){var i=t.valueAxes[0],e=i.relativeStart,a=i.relativeEnd;i.reversed&&(a=1-e,e=1-i.relativeEnd);t.percentZoom(e,a)}},zoomAxesAndGraphs:function(){if(!this.scrollbarOnly){var t=this.valueAxes,i;for(i=0;i<t.length;i++)t[i].zoom(this.start,this.end);t=this.graphs;for(i=0;i<t.length;i++)t[i].zoom(this.start,this.end);(i=this.chartCursor)&&i.clearSelection();this.zoomTrendLines()}},handleValueAxisZoomReal:function(t,i){var e=t.relativeStart,a=t.relativeEnd;if(e>a)var s=e,e=a,a=s;this.relativeZoomValueAxes(i,e,a);this.updateAfterValueZoom()},updateAfterValueZoom:function(){this.zoomAxesAndGraphs();this.zoomScrollbar()},relativeZoomValueAxes:function(i,e,a){this.hideBalloonReal();e=t.fitToBounds(e,0,1);a=t.fitToBounds(a,0,1);if(e>a){var s=e;e=a;a=s}var s=1/this.maxZoomFactor,r=t.getDecimals(s)+4;a-e<s&&(a=e+(a-e)/2,e=a-s/2,a+=s/2,1<a&&(e-=a-1,a=1),0>e&&(e=0,a=s));e=t.roundTo(e,r);a=t.roundTo(a,r);s=!1;if(i){for(r=0;r<i.length;r++){var h=i[r].zoomToRelativeValues(e,a,!0);h&&(s=h)}this.showZB()}return s},addChartCursor:function(i){t.callMethod("destroy",[this.chartCursor]);i&&(this.listenTo(i,"moved",this.handleCursorMove),this.listenTo(i,"zoomed",this.handleCursorZoom),this.listenTo(i,"zoomStarted",this.handleCursorZoomStarted),this.listenTo(i,"panning",this.handleCursorPanning),this.listenTo(i,"onHideCursor",this.handleCursorHide));this.chartCursor=i},handleCursorChange:function(){},handleCursorMove:function(t){var i,e=this.valueAxes;for(i=0;i<e.length;i++)if(!t.panning){var a=e[i];a&&a.showBalloon&&a.showBalloon(t.x,t.y)}},handleCursorZoom:function(t){if(this.skipZoomed)this.skipZoomed=!1;else{var i=this.startX0,e=this.endX0,a=this.endY0,s=this.startY0,r=t.startX,h=t.endX,o=t.startY,n=t.endY;this.startX0=this.endX0=this.startY0=this.endY0=NaN;this.handleCursorZoomReal(i+r*(e-i),i+h*(e-i),s+o*(a-s),s+n*(a-s),t)}},handleCursorHide:function(){var t,i=this.valueAxes;for(t=0;t<i.length;t++)i[t].hideBalloon();i=this.graphs;for(t=0;t<i.length;t++)i[t].hideBalloonReal()}})})();(function(){var t=window.AmCharts;t.AmSerialChart=t.Class({inherits:t.AmRectangularChart,construct:function(i){this.type="serial";t.AmSerialChart.base.construct.call(this,i);this.cname="AmSerialChart";this.theme=i;this.columnSpacing=5;this.columnSpacing3D=0;this.columnWidth=.8;var e=new t.CategoryAxis(i);e.chart=this;this.categoryAxis=e;this.zoomOutOnDataUpdate=!0;this.mouseWheelZoomEnabled=this.mouseWheelScrollEnabled=this.rotate=this.skipZoom=!1;this.minSelectedTime=0;t.applyTheme(this,i,this.cname)},initChart:function(){t.AmSerialChart.base.initChart.call(this);this.updateCategoryAxis(this.categoryAxis,this.rotate,"categoryAxis");if(this.dataChanged)this.parseData();else this.onDataUpdated();this.drawGraphs=!0},onDataUpdated:function(){var t=this.countColumns(),i=this.chartData,e=this.graphs,a;for(a=0;a<e.length;a++){var s=e[a];s.data=i;s.columnCount=t}0<i.length&&(this.firstTime=this.getStartTime(i[0].time),this.lastTime=this.getEndTime(i[i.length-1].time));this.drawChart();this.autoMargins&&!this.marginsUpdated?(this.marginsUpdated=!0,this.measureMargins()):this.dispDUpd()},syncGrid:function(){if(this.synchronizeGrid){var i=this.valueAxes,e,a;if(0<i.length){var s=0;for(a=0;a<i.length;a++)e=i[a],s<e.gridCountReal&&(s=e.gridCountReal);var r=!1;for(a=0;a<i.length;a++)if(e=i[a],e.gridCountReal<s){var h=(s-e.gridCountReal)/2,o=r=h;0!==h-Math.round(h)&&(r-=.5,o+=.5);0<=e.min&&0>e.min-r*e.step&&(o+=r,r=0);0>=e.max&&0<e.max+o*e.step&&(r+=o,o=0);h=t.getDecimals(e.step);e.minimum=t.roundTo(e.min-r*e.step,h);e.maximum=t.roundTo(e.max+o*e.step,h);e.setStep=e.step;r=e.strictMinMax=!0}r&&this.updateAfterValueZoom();for(a=0;a<i.length;a++)e=i[a],e.minimum=NaN,e.maximum=NaN,e.setStep=NaN,e.strictMinMax=!1}}},handleWheelReal:function(t,i){if(!this.wheelBusy){var e=this.categoryAxis,a=e.parseDates,s=e.minDuration(),r=1,h=1;this.mouseWheelZoomEnabled?i||(r=-1):i&&(r=-1);var o=this.chartCursor;if(o){var n=o.mouseX,o=o.mouseY;r!=h&&(n=this.rotate?o/this.plotAreaHeight:n/this.plotAreaWidth,r*=n,h*=1-n);n=.05*(this.end-this.start);a&&(n=.05*(this.endTime-this.startTime)/s);1>n&&(n=1);r*=n;h*=n;if(!a||e.equalSpacing)r=Math.round(r),h=Math.round(h)}o=this.chartData.length;e=this.lastTime;n=this.firstTime;0>t?a?(o=this.endTime-this.startTime,a=this.startTime+r*s,s=this.endTime+h*s,0<h&&0<r&&s>=e&&(s=e,a=e-o),this.zoomToDates(new Date(a),new Date(s))):(0<h&&0<r&&this.end>=o-1&&(r=h=0),a=this.start+r,s=this.end+h,this.zoomToIndexes(a,s)):a?(o=this.endTime-this.startTime,a=this.startTime-r*s,s=this.endTime-h*s,0<h&&0<r&&a<=n&&(a=n,s=n+o),this.zoomToDates(new Date(a),new Date(s))):(0<h&&0<r&&1>this.start&&(r=h=0),a=this.start-r,s=this.end-h,this.zoomToIndexes(a,s))}},validateData:function(i){this.marginsUpdated=!1;this.zoomOutOnDataUpdate&&!i&&(this.endTime=this.end=this.startTime=this.start=NaN);var e=i=!1,a=!1,s=this.chartScrollbar;s&&(s.dragging&&(i=!0,s.handleDragStop()),s.resizingRight&&(a=!0,s.rightDragStop()),s.resizingLeft&&(e=!0,s.leftDragStop()));t.AmSerialChart.base.validateData.call(this);i&&s.handleDragStart();a&&s.rightDragStart();e&&s.leftDragStart()},drawChart:function(){if(0<this.realWidth&&0<this.realHeight){t.AmSerialChart.base.drawChart.call(this);var i=this.chartData;if(t.ifArray(i)){var e=this.chartScrollbar;!e||!this.marginsUpdated&&this.autoMargins||e.draw();(e=this.valueScrollbar)&&e.draw();var e=i.length-1,a,s;a=this.categoryAxis;if(a.parseDates&&!a.equalSpacing){if(a=this.startTime,s=this.endTime,isNaN(a)||isNaN(s))a=this.firstTime,s=this.lastTime}else{a=this.start;s=this.end;if(isNaN(a)||isNaN(s))s=a=NaN;isNaN(a)&&(isNaN(this.startTime)||(a=this.getClosestIndex(i,"time",this.startTime,!0,0,i.length)));isNaN(s)&&(isNaN(this.endTime)||(s=this.getClosestIndex(i,"time",this.endTime,!1,0,i.length)));if(isNaN(a)||isNaN(s))a=0,s=e}this.endTime=this.startTime=this.end=this.start=void 0;this.zoom(a,s)}}else this.cleanChart()},cleanChart:function(){t.callMethod("destroy",[this.valueAxes,this.graphs,this.categoryAxis,this.chartScrollbar,this.chartCursor,this.valueScrollbar])},updateCategoryAxis:function(t,i,e){t.chart=this;t.id=e;t.rotate=i;t.setOrientation(!this.rotate);t.init();this.setAxisRenderers(t);this.updateObjectSize(t)},updateValueAxes:function(){t.AmSerialChart.base.updateValueAxes.call(this);var i=this.valueAxes,e;for(e=0;e<i.length;e++){var a=i[e],s=this.rotate;a.rotate=s;a.setOrientation(s);s=this.categoryAxis;if(!s.startOnAxis||s.parseDates)a.expandMinMax=!0}},getStartTime:function(i){var e=this.categoryAxis;return t.resetDateToMin(new Date(i),e.minPeriod,1,e.firstDayOfWeek).getTime()},getEndTime:function(i){var e=t.extractPeriod(this.categoryAxis.minPeriod);return t.changeDate(new Date(i),e.period,e.count,!0).getTime()-1},updateMargins:function(){t.AmSerialChart.base.updateMargins.call(this);var i=this.chartScrollbar;i&&(this.getScrollbarPosition(i,this.rotate,this.categoryAxis.position),this.adjustMargins(i,this.rotate));if(i=this.valueScrollbar)this.getScrollbarPosition(i,!this.rotate,this.valueAxes[0].position),this.adjustMargins(i,!this.rotate)},updateScrollbars:function(){t.AmSerialChart.base.updateScrollbars.call(this);this.updateChartScrollbar(this.chartScrollbar,this.rotate);this.updateChartScrollbar(this.valueScrollbar,!this.rotate)},zoom:function(t,i){var e=this.categoryAxis;e.parseDates&&!e.equalSpacing?(this.timeZoom(t,i),isNaN(t)&&this.zoomOutValueAxes()):this.indexZoom(t,i);(e=this.chartCursor)&&(e.pan||e.hideCursorReal());this.updateLegendValues()},timeZoom:function(i,e){var a=this.maxSelectedTime;isNaN(a)||(e!=this.endTime&&e-i>a&&(i=e-a),i!=this.startTime&&e-i>a&&(e=i+a));var s=this.minSelectedTime;if(0<s&&e-i<s){var r=Math.round(i+(e-i)/2),s=Math.round(s/2);i=r-s;e=r+s}s=this.chartData;r=this.categoryAxis;if(t.ifArray(s)&&(i!=this.startTime||e!=this.endTime)){var h=r.minDuration(),o=this.firstTime,n=this.lastTime;i||(i=o,isNaN(a)||(i=n-a));e||(e=n);i>n&&(i=n);e<o&&(e=o);i<o&&(i=o);e>n&&(e=n);e<i&&(e=i+h);e-i<h/5&&(e<n?e=i+h/5:i=e-h/5);this.startTime=i;this.endTime=e;a=s.length-1;h=this.getClosestIndex(s,"time",i,!0,0,a);s=this.getClosestIndex(s,"time",e,!1,h,a);r.timeZoom(i,e);r.zoom(h,s);this.start=t.fitToBounds(h,0,a);this.end=t.fitToBounds(s,0,a);this.zoomAxesAndGraphs();this.zoomScrollbar();this.fixCursor();this.showZB();this.syncGrid();this.updateColumnsDepth();this.dispatchTimeZoomEvent()}},showZB:function(){var i,e=this.categoryAxis;e&&e.parseDates&&!e.equalSpacing&&(this.startTime>this.firstTime&&(i=!0),this.endTime<this.lastTime&&(i=!0));0<this.start&&(i=!0);this.end<this.chartData.length-1&&(i=!0);if(e=this.valueAxes)e=e[0],isNaN(e.relativeStart)||(0!==t.roundTo(e.relativeStart,3)&&(i=!0),1!=t.roundTo(e.relativeEnd,3)&&(i=!0));t.AmSerialChart.base.showZB.call(this,i)},updateAfterValueZoom:function(){t.AmSerialChart.base.updateAfterValueZoom.call(this);this.updateColumnsDepth()},indexZoom:function(t,i){var e=this.maxSelectedSeries,a=!1;isNaN(e)||(i!=this.end&&i-t>e&&(t=i-e,a=!0),t!=this.start&&i-t>e&&(i=t+e,a=!0));if(a&&(a=this.chartScrollbar)&&a.dragger){var s=a.dragger.getBBox();a.maxWidth=s.width;a.maxHeight=s.height}if(t!=this.start||i!=this.end)a=this.chartData.length-1,isNaN(t)&&(t=0,isNaN(e)||(t=a-e)),isNaN(i)&&(i=a),i<t&&(i=t),i>a&&(i=a),t>a&&(t=a-1),0>t&&(t=0),this.start=t,this.end=i,this.categoryAxis.zoom(t,i),this.zoomAxesAndGraphs(),this.zoomScrollbar(),this.fixCursor(),0!==t||i!=this.chartData.length-1?this.showZB(!0):this.showZB(!1),this.syncGrid(),this.updateColumnsDepth(),this.dispatchIndexZoomEvent()},updateGraphs:function(){t.AmSerialChart.base.updateGraphs.call(this);var i=this.graphs,e;for(e=0;e<i.length;e++){var a=i[e];a.columnWidthReal=this.columnWidth;a.categoryAxis=this.categoryAxis;t.isString(a.fillToGraph)&&(a.fillToGraph=this.graphsById[a.fillToGraph])}},zoomAxesAndGraphs:function(){t.AmSerialChart.base.zoomAxesAndGraphs.call(this);this.updateColumnsDepth()},updateColumnsDepth:function(){if(0!==this.depth3D||0!==this.angle){var i,e=this.graphs,a;this.columnsArray=[];for(i=0;i<e.length;i++){a=e[i];var s=a.columnsArray;if(s){var r;for(r=0;r<s.length;r++)this.columnsArray.push(s[r])}}this.columnsArray.sort(this.compareDepth);e=this.columnsSet;if(0<this.columnsArray.length){s=this.container.set();this.columnSet.push(s);for(i=0;i<this.columnsArray.length;i++)s.push(this.columnsArray[i].column.set);a&&s.translate(a.x,a.y);this.columnsSet=s}t.remove(e)}},compareDepth:function(t,i){return t.depth>i.depth?1:-1},zoomScrollbar:function(){var t=this.chartScrollbar,i=this.categoryAxis;if(t){if(!this.zoomedByScrollbar){var e=t.dragger;e&&e.stop()}this.zoomedByScrollbar=!1;i.parseDates&&!i.equalSpacing?t.timeZoom(this.startTime,this.endTime):t.zoom(this.start,this.end)}this.zoomValueScrollbar(this.valueScrollbar)},updateTrendLines:function(){var i=this.trendLines,e;for(e=0;e<i.length;e++){var a=i[e],a=t.processObject(a,t.TrendLine,this.theme);i[e]=a;a.chart=this;a.id||(a.id="trendLineAuto"+e+"_"+(new Date).getTime());t.isString(a.valueAxis)&&(a.valueAxis=this.getValueAxisById(a.valueAxis));a.valueAxis||(a.valueAxis=this.valueAxes[0]);a.categoryAxis=this.categoryAxis}},countColumns:function(){var t=0,i=this.valueAxes.length,e=this.graphs.length,a,s,r=!1,h,o;for(o=0;o<i;o++){s=this.valueAxes[o];var n=s.stackType,l=0;if("100%"==n||"regular"==n)for(r=!1,h=0;h<e;h++)a=this.graphs[h],a.tcc=1,a.valueAxis==s&&"column"==a.type&&(!r&&a.stackable&&(t++,r=!0),(!a.stackable&&a.clustered||a.newStack&&0!==l)&&t++,a.columnIndex=t-1,a.clustered||(a.columnIndex=0),l++);if("none"==n||"3d"==n){r=!1;for(h=0;h<e;h++)a=this.graphs[h],a.valueAxis==s&&"column"==a.type&&(a.clustered?(a.tcc=1,a.newStack&&(t=0),a.hidden||(a.columnIndex=t,t++)):a.hidden||(r=!0,a.tcc=1,a.columnIndex=0));r&&0===t&&(t=1)}if("3d"==n){s=1;for(o=0;o<e;o++)a=this.graphs[o],a.newStack&&s++,a.depthCount=s,a.tcc=t;t=s}}return t},parseData:function(){t.AmSerialChart.base.parseData.call(this);this.parseSerialData(this.dataProvider)},getCategoryIndexByValue:function(t){var i=this.chartData,e;for(e=0;e<i.length;e++)if(i[e].category==t)return e},handleScrollbarZoom:function(t){this.zoomedByScrollbar=!0;this.zoom(t.start,t.end)},dispatchTimeZoomEvent:function(){if(this.drawGraphs&&(this.prevStartTime!=this.startTime||this.prevEndTime!=this.endTime)){var i={type:"zoomed"};i.startDate=new Date(this.startTime);i.endDate=new Date(this.endTime);i.startIndex=this.start;i.endIndex=this.end;this.startIndex=this.start;this.endIndex=this.end;this.startDate=i.startDate;this.endDate=i.endDate;this.prevStartTime=this.startTime;this.prevEndTime=this.endTime;var e=this.categoryAxis,a=t.extractPeriod(e.minPeriod).period,e=e.dateFormatsObject[a];i.startValue=t.formatDate(i.startDate,e,this);i.endValue=t.formatDate(i.endDate,e,this);i.chart=this;i.target=this;this.fire(i)}},dispatchIndexZoomEvent:function(){if(this.drawGraphs&&(this.prevStartIndex!=this.start||this.prevEndIndex!=this.end)){this.startIndex=this.start;this.endIndex=this.end;var i=this.chartData;if(t.ifArray(i)&&!isNaN(this.start)&&!isNaN(this.end)){var e={chart:this,target:this,type:"zoomed"};e.startIndex=this.start;e.endIndex=this.end;e.startValue=i[this.start].category;e.endValue=i[this.end].category;this.categoryAxis.parseDates&&(this.startTime=i[this.start].time,this.endTime=i[this.end].time,e.startDate=new Date(this.startTime),e.endDate=new Date(this.endTime));this.prevStartIndex=this.start;this.prevEndIndex=this.end;this.fire(e)}}},updateLegendValues:function(){this.legend&&this.legend.updateValues()},getClosestIndex:function(t,i,e,a,s,r){0>s&&(s=0);r>t.length-1&&(r=t.length-1);var h=s+Math.round((r-s)/2),o=t[h][i];return e==o?h:1>=r-s?a?s:Math.abs(t[s][i]-e)<Math.abs(t[r][i]-e)?s:r:e==o?h:e<o?this.getClosestIndex(t,i,e,a,s,h):this.getClosestIndex(t,i,e,a,h,r)},zoomToIndexes:function(t,i){var e=this.chartData;if(e){var a=e.length;0<a&&(0>t&&(t=0),i>a-1&&(i=a-1),a=this.categoryAxis,a.parseDates&&!a.equalSpacing?this.zoom(e[t].time,this.getEndTime(e[i].time)):this.zoom(t,i))}},zoomToDates:function(i,e){var a=this.chartData;if(a)if(this.categoryAxis.equalSpacing){var s=this.getClosestIndex(a,"time",i.getTime(),!0,0,a.length);e=t.resetDateToMin(e,this.categoryAxis.minPeriod,1);a=this.getClosestIndex(a,"time",e.getTime(),!1,0,a.length);this.zoom(s,a)}else this.zoom(i.getTime(),e.getTime())},zoomToCategoryValues:function(t,i){this.chartData&&this.zoom(this.getCategoryIndexByValue(t),this.getCategoryIndexByValue(i))},formatPeriodString:function(i,e){if(e){e.periodDataItem={};e.periodPercentDataItem={};var a=["value","open","low","high","close"],s="value open low high close average sum count".split(" "),r=e.valueAxis,h=this.chartData,o=e.numberFormatter;o||(o=this.nf);for(var n=0;n<a.length;n++){for(var l=a[n],d=0,u=0,c=0,m=0,g,p,f,x,v,b,A,C,T,y,D=this.start;D<=this.end;D++){var S=h[D];if(S){var N=S.axes[r.id].graphs[e.id];if(N){if(N.values){var M=N.values[l],S=S.x.categoryAxis;if(this.rotate){if(0>S||S>N.graph.height)M=NaN}else if(0>S||S>N.graph.width)M=NaN;if(!isNaN(M)){isNaN(g)&&(g=M);p=M;if(isNaN(f)||f>M)f=M;if(isNaN(x)||x<M)x=M;v=t.getDecimals(d);S=t.getDecimals(M);d+=M;d=t.roundTo(d,Math.max(v,S));u++;v=d/u}}if(N.percents&&(N=N.percents[l],!isNaN(N))){isNaN(b)&&(b=N);A=N;if(isNaN(C)||C>N)C=N;if(isNaN(T)||T<N)T=N;y=t.getDecimals(c);M=t.getDecimals(N);c+=N;c=t.roundTo(c,Math.max(y,M));m++;y=c/m}}}}d={open:g,close:p,high:x,low:f,average:v,sum:d,count:u};c={open:b,close:A,high:T,low:C,average:y,sum:c,count:m};i=t.formatValue(i,d,s,o,l+"\\.",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers);i=t.formatValue(i,c,s,this.pf,"percents\\."+l+"\\.");e.periodDataItem[l]=d;e.periodPercentDataItem[l]=c}}return i=t.cleanFromEmpty(i)},formatString:function(i,e,a){if(e){var s=e.graph;if(void 0!==i){if(-1!=i.indexOf("[[category]]")){var r=e.serialDataItem.category;if(this.categoryAxis.parseDates){var h=this.balloonDateFormat,o=this.chartCursor;o&&o.categoryBalloonDateFormat&&(h=o.categoryBalloonDateFormat);h=t.formatDate(r,h,this);-1!=h.indexOf("fff")&&(h=t.formatMilliseconds(h,r));r=h}i=i.replace(/\[\[category\]\]/g,String(r.replace("$","$$$")))}r=s.numberFormatter;r||(r=this.nf);h=e.graph.valueAxis;(o=h.duration)&&!isNaN(e.values.value)&&(o=t.formatDuration(e.values.value,o,"",h.durationUnits,h.maxInterval,r),i=i.replace(RegExp("\\[\\[value\\]\\]","g"),o));"date"==h.type&&(h=t.formatDate(new Date(e.values.value),s.dateFormat,this),o=RegExp("\\[\\[value\\]\\]","g"),i=i.replace(o,h),h=t.formatDate(new Date(e.values.open),s.dateFormat,this),o=RegExp("\\[\\[open\\]\\]","g"),i=i.replace(o,h));s="value open low high close total".split(" ");h=this.pf;i=t.formatValue(i,e.percents,s,h,"percents\\.");i=t.formatValue(i,e.values,s,r,"",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers);i=t.formatValue(i,e.values,["percents"],h);-1!=i.indexOf("[[")&&(i=t.formatDataContextValue(i,e.dataContext));-1!=i.indexOf("[[")&&e.graph.customData&&(i=t.formatDataContextValue(i,e.graph.customData));i=t.AmSerialChart.base.formatString.call(this,i,e,a)}return i}},updateChartCursor:function(){t.AmSerialChart.base.updateChartCursor.call(this);var i=this.chartCursor,e=this.categoryAxis;if(i){var a=i.categoryBalloonAlpha,s=i.categoryBalloonColor,r=i.color;void 0===s&&(s=i.cursorColor);var h=i.valueZoomable,o=i.zoomable,n=i.valueLineEnabled;this.rotate?(i.vLineEnabled=n,i.hZoomEnabled=h,i.vZoomEnabled=o):(i.hLineEnabled=n,i.vZoomEnabled=h,i.hZoomEnabled=o);if(i.valueLineBalloonEnabled)for(n=0;n<this.valueAxes.length;n++)h=this.valueAxes[n],(o=h.balloon)||(o={}),o=t.extend(o,this.balloon,!0),o.fillColor=s,o.balloonColor=s,o.fillAlpha=a,o.borderColor=s,o.color=r,h.balloon=o;else for(o=0;o<this.valueAxes.length;o++)h=this.valueAxes[o],h.balloon&&(h.balloon=null);e&&(e.balloonTextFunction=i.categoryBalloonFunction,i.categoryLineAxis=e,e.balloonText=i.categoryBalloonText,i.categoryBalloonEnabled&&((o=e.balloon)||(o={}),o=t.extend(o,this.balloon,!0),o.fillColor=s,o.balloonColor=s,o.fillAlpha=a,o.borderColor=s,o.color=r,e.balloon=o),e.balloon&&(e.balloon.enabled=i.categoryBalloonEnabled))}},addChartScrollbar:function(i){t.callMethod("destroy",[this.chartScrollbar]);i&&(i.chart=this,this.listenTo(i,"zoomed",this.handleScrollbarZoom));this.rotate?void 0===i.width&&(i.width=i.scrollbarHeight):void 0===i.height&&(i.height=i.scrollbarHeight);i.gridAxis=this.categoryAxis;this.chartScrollbar=i},addValueScrollbar:function(i){t.callMethod("destroy",[this.valueScrollbar]);i&&(i.chart=this,this.listenTo(i,"zoomed",this.handleScrollbarValueZoom),this.listenTo(i,"zoomStarted",this.handleCursorZoomStarted));var e=i.scrollbarHeight;this.rotate?void 0===i.height&&(i.height=e):void 0===i.width&&(i.width=e);i.gridAxis||(i.gridAxis=this.valueAxes[0]);i.valueAxes=this.valueAxes;this.valueScrollbar=i},removeChartScrollbar:function(){t.callMethod("destroy",[this.chartScrollbar]);this.chartScrollbar=null},removeValueScrollbar:function(){t.callMethod("destroy",[this.valueScrollbar]);this.valueScrollbar=null},handleReleaseOutside:function(i){t.AmSerialChart.base.handleReleaseOutside.call(this,i);t.callMethod("handleReleaseOutside",[this.chartScrollbar,this.valueScrollbar])},update:function(){t.AmSerialChart.base.update.call(this);this.chartScrollbar&&this.chartScrollbar.update&&this.chartScrollbar.update();this.valueScrollbar&&this.valueScrollbar.update&&this.valueScrollbar.update()},processScrollbars:function(){t.AmSerialChart.base.processScrollbars.call(this);var i=this.valueScrollbar;i&&(i=t.processObject(i,t.ChartScrollbar,this.theme),i.id="valueScrollbar",this.addValueScrollbar(i))},handleValueAxisZoom:function(t){this.handleValueAxisZoomReal(t,this.valueAxes)},zoomOut:function(){t.AmSerialChart.base.zoomOut.call(this);this.zoom();this.syncGrid()},getNextItem:function(t){var i=t.index,e=this.chartData,a=t.graph;if(i+1<e.length)for(i+=1;i<e.length;i++)if(t=e[i])if(t=t.axes[a.valueAxis.id].graphs[a.id],!isNaN(t.y))return t},handleCursorZoomReal:function(t,i,e,a,s){var r=s.target,h,o;this.rotate?(isNaN(t)||isNaN(i)||this.relativeZoomValueAxes(this.valueAxes,t,i)&&this.updateAfterValueZoom(),r.vZoomEnabled&&(h=s.start,o=s.end)):(isNaN(e)||isNaN(a)||this.relativeZoomValueAxes(this.valueAxes,e,a)&&this.updateAfterValueZoom(),r.hZoomEnabled&&(h=s.start,o=s.end));isNaN(h)||isNaN(o)||(t=this.categoryAxis,t.parseDates&&!t.equalSpacing?this.zoomToDates(new Date(h),new Date(o)):this.zoomToIndexes(h,o))},handleCursorZoomStarted:function(){var t=this.valueAxes;if(t){var t=t[0],i=t.relativeStart,e=t.relativeEnd;t.reversed&&(i=1-t.relativeEnd,e=1-t.relativeStart);this.rotate?(this.startX0=i,this.endX0=e):(this.startY0=i,this.endY0=e)}this.categoryAxis&&(this.start0=this.start,this.end0=this.end,this.startTime0=this.startTime,this.endTime0=this.endTime)},fixCursor:function(){this.chartCursor&&this.chartCursor.fixPosition();this.prevCursorItem=null},handleCursorMove:function(i){t.AmSerialChart.base.handleCursorMove.call(this,i);var e=i.target,a=this.categoryAxis;if(i.panning)this.handleCursorHide(i);else if(this.chartData&&!e.isHidden){var s=this.graphs;if(s){var r;r=a.xToIndex(this.rotate?i.y:i.x);if(r=this.chartData[r]){var h,o,n,l;if(e.oneBalloonOnly&&e.valueBalloonsEnabled){var d=Infinity;for(h=s.length-1;0<=h;h--)if(o=s[h],o.balloon.enabled&&o.showBalloon&&!o.hidden){n=o.valueAxis.id;n=r.axes[n].graphs[o.id];if(e.showNextAvailable&&isNaN(n.y)&&(n=this.getNextItem(n),!n))continue;n=n.y;"top"==o.showBalloonAt&&(n=0);"bottom"==o.showBalloonAt&&(n=this.height);var u=e.mouseX,c=e.mouseY;n=this.rotate?Math.abs(u-n):Math.abs(c-n);n<d&&(d=n,l=o)}e.mostCloseGraph=l}if(this.prevCursorItem!=r||l!=this.prevMostCloseGraph){d=[];for(h=0;h<s.length;h++){o=s[h];n=o.valueAxis.id;n=r.axes[n].graphs[o.id];if(e.showNextAvailable&&isNaN(n.y)&&(n=this.getNextItem(n),!n&&o.balloon)){o.balloon.hide();continue}l&&o!=l?(o.showGraphBalloon(n,e.pointer,!1,e.graphBulletSize,e.graphBulletAlpha),
o.balloon.hide(0)):e.valueBalloonsEnabled?(o.balloon.showBullet=e.bulletsEnabled,o.balloon.bulletSize=e.bulletSize/2,i.hideBalloons||(o.showGraphBalloon(n,e.pointer,!1,e.graphBulletSize,e.graphBulletAlpha),o.balloon.set&&d.push({balloon:o.balloon,y:o.balloon.pointToY}))):(o.currentDataItem=n,o.resizeBullet(n,e.graphBulletSize,e.graphBulletAlpha))}e.avoidBalloonOverlapping&&this.arrangeBalloons(d);this.prevCursorItem=r}this.prevMostCloseGraph=l}}a.showBalloon(i.x,i.y,e.categoryBalloonDateFormat,i.skip);this.updateLegendValues()}},handleCursorHide:function(i){t.AmSerialChart.base.handleCursorHide.call(this,i);i=this.categoryAxis;this.prevCursorItem=null;this.updateLegendValues();i&&i.hideBalloon();i=this.graphs;var e;for(e=0;e<i.length;e++)i[e].currentDataItem=null},handleCursorPanning:function(i){var e=i.target,a,s=i.deltaX,r=i.deltaY,h=i.delta2X,o=i.delta2Y;i=!1;if(this.rotate){isNaN(h)&&(h=s,i=!0);var n=this.endX0;a=this.startX0;var l=n-a,n=n-l*h,d=l;i||(d=0);i=t.fitToBounds(a-l*s,0,1-d)}else isNaN(o)&&(o=r,i=!0),n=this.endY0,a=this.startY0,l=n-a,n+=l*r,d=l,i||(d=0),i=t.fitToBounds(a+l*o,0,1-d);a=t.fitToBounds(n,d,1);var u;e.valueZoomable&&(u=this.relativeZoomValueAxes(this.valueAxes,i,a));var c;a=this.categoryAxis;this.rotate&&(s=r,h=o);i=!1;isNaN(h)&&(h=s,i=!0);if(e.zoomable&&(0<Math.abs(s)||0<Math.abs(h)))if(a.parseDates&&!a.equalSpacing){if(o=this.startTime0,r=this.endTime0,a=r-o,h*=a,l=this.firstTime,n=this.lastTime,d=a,i||(d=0),i=Math.round(t.fitToBounds(o-a*s,l,n-d)),h=Math.round(t.fitToBounds(r-h,l+d,n)),this.startTime!=i||this.endTime!=h)c={chart:this,target:e,type:"zoomed",start:i,end:h},this.skipZoomed=!0,e.fire(c),this.zoom(i,h),c=!0}else if(o=this.start0,r=this.end0,a=r-o,s=Math.round(a*s),h=Math.round(a*h),l=this.chartData.length-1,i||(a=0),i=t.fitToBounds(o-s,0,l-a),a=t.fitToBounds(r-h,a,l),this.start!=i||this.end!=a)this.skipZoomed=!0,e.fire({chart:this,target:e,type:"zoomed",start:i,end:a}),this.zoom(i,a),c=!0;!c&&u&&this.updateAfterValueZoom()},arrangeBalloons:function(t){var i=this.plotAreaHeight;t.sort(this.compareY);var e,a,s,r=this.plotAreaWidth,h=t.length;for(e=0;e<h;e++)a=t[e].balloon,a.setBounds(0,0,r,i),a.restorePrevious(),a.draw(),i=a.yPos-3;t.reverse();for(e=0;e<h;e++){a=t[e].balloon;var i=a.bottom,o=a.bottom-a.yPos;0<e&&i-o<s+3&&a.setBounds&&(a.setBounds(0,s+3,r,s+o+3),a.restorePrevious(),a.draw());a.set&&a.set.show();s=a.bottom}},compareY:function(t,i){return t.y<i.y?1:-1}})})();(function(){var t=window.AmCharts;t.Cuboid=t.Class({construct:function(t,i,e,a,s,r,h,o,n,l,d,u,c,m,g,p,f){this.set=t.set();this.container=t;this.h=Math.round(e);this.w=Math.round(i);this.dx=a;this.dy=s;this.colors=r;this.alpha=h;this.bwidth=o;this.bcolor=n;this.balpha=l;this.dashLength=m;this.topRadius=p;this.pattern=g;this.rotate=c;this.bcn=f;c?0>i&&0===d&&(d=180):0>e&&270==d&&(d=90);this.gradientRotation=d;0===a&&0===s&&(this.cornerRadius=u);this.draw()},draw:function(){var i=this.set;i.clear();var e=this.container,a=e.chart,s=this.w,r=this.h,h=this.dx,o=this.dy,n=this.colors,l=this.alpha,d=this.bwidth,u=this.bcolor,c=this.balpha,m=this.gradientRotation,g=this.cornerRadius,p=this.dashLength,f=this.pattern,x=this.topRadius,v=this.bcn,b=n,A=n;"object"==typeof n&&(b=n[0],A=n[n.length-1]);var C,T,y,D,S,N,M,w,B,z=l;f&&(l=0);var R,O,I,Z,L=this.rotate;if(0<Math.abs(h)||0<Math.abs(o))if(isNaN(x))M=A,A=t.adjustLuminosity(b,-.2),A=t.adjustLuminosity(b,-.2),C=t.polygon(e,[0,h,s+h,s,0],[0,o,o,0,0],A,l,1,u,0,m),0<c&&(B=t.line(e,[0,h,s+h],[0,o,o],u,c,d,p)),T=t.polygon(e,[0,0,s,s,0],[0,r,r,0,0],A,l,1,u,0,m),T.translate(h,o),0<c&&(y=t.line(e,[h,h],[o,o+r],u,c,d,p)),D=t.polygon(e,[0,0,h,h,0],[0,r,r+o,o,0],A,l,1,u,0,m),S=t.polygon(e,[s,s,s+h,s+h,s],[0,r,r+o,o,0],A,l,1,u,0,m),0<c&&(N=t.line(e,[s,s+h,s+h,s],[0,o,r+o,r],u,c,d,p)),A=t.adjustLuminosity(M,.2),M=t.polygon(e,[0,h,s+h,s,0],[r,r+o,r+o,r,r],A,l,1,u,0,m),0<c&&(w=t.line(e,[0,h,s+h],[r,r+o,r+o],u,c,d,p));else{var V,W,P;L?(V=r/2,A=h/2,P=r/2,W=s+h/2,O=Math.abs(r/2),R=Math.abs(h/2)):(A=s/2,V=o/2,W=s/2,P=r+o/2+1,R=Math.abs(s/2),O=Math.abs(o/2));I=R*x;Z=O*x;.1<R&&.1<R&&(C=t.circle(e,R,b,l,d,u,c,!1,O),C.translate(A,V));.1<I&&.1<I&&(M=t.circle(e,I,t.adjustLuminosity(b,.5),l,d,u,c,!1,Z),M.translate(W,P))}l=z;1>Math.abs(r)&&(r=0);1>Math.abs(s)&&(s=0);!isNaN(x)&&(0<Math.abs(h)||0<Math.abs(o))?(n=[b],n={fill:n,stroke:u,"stroke-width":d,"stroke-opacity":c,"fill-opacity":l},L?(l="M0,0 L"+s+","+(r/2-r/2*x),d=" B",0<s&&(d=" A"),t.VML?(l+=d+Math.round(s-I)+","+Math.round(r/2-Z)+","+Math.round(s+I)+","+Math.round(r/2+Z)+","+s+",0,"+s+","+r,l=l+(" L0,"+r)+(d+Math.round(-R)+","+Math.round(r/2-O)+","+Math.round(R)+","+Math.round(r/2+O)+",0,"+r+",0,0")):(l+="A"+I+","+Z+",0,0,0,"+s+","+(r-r/2*(1-x))+"L0,"+r,l+="A"+R+","+O+",0,0,1,0,0"),R=90):(d=s/2-s/2*x,l="M0,0 L"+d+","+r,t.VML?(l="M0,0 L"+d+","+r,d=" B",0>r&&(d=" A"),l+=d+Math.round(s/2-I)+","+Math.round(r-Z)+","+Math.round(s/2+I)+","+Math.round(r+Z)+",0,"+r+","+s+","+r,l+=" L"+s+",0",l+=d+Math.round(s/2+R)+","+Math.round(O)+","+Math.round(s/2-R)+","+Math.round(-O)+","+s+",0,0,0"):(l+="A"+I+","+Z+",0,0,0,"+(s-s/2*(1-x))+","+r+"L"+s+",0",l+="A"+R+","+O+",0,0,1,0,0"),R=180),e=e.path(l).attr(n),e.gradient("linearGradient",[b,t.adjustLuminosity(b,-.3),t.adjustLuminosity(b,-.3),b],R),L?e.translate(h/2,0):e.translate(0,o/2)):e=0===r?t.line(e,[0,s],[0,0],u,c,d,p):0===s?t.line(e,[0,0],[0,r],u,c,d,p):0<g?t.rect(e,s,r,n,l,d,u,c,g,m,p):t.polygon(e,[0,0,s,s,0],[0,r,r,0,0],n,l,d,u,c,m,!1,p);s=isNaN(x)?0>r?[C,B,T,y,D,S,N,M,w,e]:[M,w,T,y,D,S,C,B,N,e]:L?0<s?[C,e,M]:[M,e,C]:0>r?[C,e,M]:[M,e,C];t.setCN(a,e,v+"front");t.setCN(a,T,v+"back");t.setCN(a,M,v+"top");t.setCN(a,C,v+"bottom");t.setCN(a,D,v+"left");t.setCN(a,S,v+"right");for(C=0;C<s.length;C++)if(T=s[C])i.push(T),t.setCN(a,T,v+"element");f&&e.pattern(f,NaN,a.path)},width:function(t){isNaN(t)&&(t=0);this.w=Math.round(t);this.draw()},height:function(t){isNaN(t)&&(t=0);this.h=Math.round(t);this.draw()},animateHeight:function(i,e){var a=this;a.animationFinished=!1;a.easing=e;a.totalFrames=i*t.updateRate;a.rh=a.h;a.frame=0;a.height(1);setTimeout(function(){a.updateHeight.call(a)},1e3/t.updateRate)},updateHeight:function(){var i=this;i.frame++;var e=i.totalFrames;i.frame<=e?(e=i.easing(0,i.frame,1,i.rh-1,e),i.height(e),window.requestAnimationFrame?window.requestAnimationFrame(function(){i.updateHeight.call(i)}):setTimeout(function(){i.updateHeight.call(i)},1e3/t.updateRate)):(i.height(i.rh),i.animationFinished=!0)},animateWidth:function(i,e){var a=this;a.animationFinished=!1;a.easing=e;a.totalFrames=i*t.updateRate;a.rw=a.w;a.frame=0;a.width(1);setTimeout(function(){a.updateWidth.call(a)},1e3/t.updateRate)},updateWidth:function(){var i=this;i.frame++;var e=i.totalFrames;i.frame<=e?(e=i.easing(0,i.frame,1,i.rw-1,e),i.width(e),window.requestAnimationFrame?window.requestAnimationFrame(function(){i.updateWidth.call(i)}):setTimeout(function(){i.updateWidth.call(i)},1e3/t.updateRate)):(i.width(i.rw),i.animationFinished=!0)}})})();(function(){var t=window.AmCharts;t.CategoryAxis=t.Class({inherits:t.AxisBase,construct:function(i){this.cname="CategoryAxis";t.CategoryAxis.base.construct.call(this,i);this.minPeriod="DD";this.equalSpacing=this.parseDates=!1;this.position="bottom";this.startOnAxis=!1;this.gridPosition="middle";this.safeDistance=30;this.stickBalloonToCategory=!1;t.applyTheme(this,i,this.cname)},draw:function(){t.CategoryAxis.base.draw.call(this);this.generateDFObject();var i=this.chart.chartData;this.data=i;this.labelRotationR=this.labelRotation;this.type=null;if(t.ifArray(i)){var e,a=this.chart;"scrollbar"!=this.id?(t.setCN(a,this.set,"category-axis"),t.setCN(a,this.labelsSet,"category-axis"),t.setCN(a,this.axisLine.axisSet,"category-axis")):this.bcn=this.id+"-";var s=this.start,r=this.labelFrequency,h=0,o=this.end-s+1,n=this.gridCountR,l=this.showFirstLabel,d=this.showLastLabel,u,c="",c=t.extractPeriod(this.minPeriod),m=t.getPeriodDuration(c.period,c.count),g,p,f,x,v,b=this.rotate,A=this.firstDayOfWeek,C=this.boldPeriodBeginning;e=t.resetDateToMin(new Date(i[i.length-1].time+1.05*m),this.minPeriod,1,A).getTime();this.firstTime=a.firstTime;this.endTime>e&&(this.endTime=e);v=this.minorGridEnabled;p=this.gridAlpha;var T=0,y=0;if(this.widthField)for(e=this.start;e<=this.end;e++)if(x=this.data[e]){var D=Number(this.data[e].dataContext[this.widthField]);isNaN(D)||(T+=D,x.widthValue=D)}if(this.parseDates&&!this.equalSpacing)this.lastTime=i[i.length-1].time,this.maxTime=t.resetDateToMin(new Date(this.lastTime+1.05*m),this.minPeriod,1,A).getTime(),this.timeDifference=this.endTime-this.startTime,this.parseDatesDraw();else if(!this.parseDates){if(this.cellWidth=this.getStepWidth(o),o<n&&(n=o),h+=this.start,this.stepWidth=this.getStepWidth(o),0<n)for(A=Math.floor(o/n),x=this.chooseMinorFrequency(A),o=h,o/2==Math.round(o/2)&&o--,0>o&&(o=0),C=0,this.widthField&&(o=this.start),this.end-o+1>=this.autoRotateCount&&(this.labelRotationR=this.autoRotateAngle),e=o;e<=this.end+2;e++){n=!1;0<=e&&e<this.data.length?(g=this.data[e],c=g.category,n=g.forceShow):c="";if(v&&!isNaN(x))if(e/x==Math.round(e/x)||n)e/A==Math.round(e/A)||n||(this.gridAlpha=this.minorGridAlpha,c=void 0);else continue;else if(e/A!=Math.round(e/A)&&!n)continue;o=this.getCoordinate(e-h);n=0;"start"==this.gridPosition&&(o-=this.cellWidth/2,n=this.cellWidth/2);u=!0;f=n;"start"==this.tickPosition&&(f=0,u=!1,n=0);if(e==s&&!l||e==this.end&&!d)c=void 0;Math.round(C/r)!=C/r&&(c=void 0);C++;i=this.cellWidth;b&&(i=NaN,this.ignoreAxisWidth||!a.autoMargins)&&(i="right"==this.position?a.marginRight:a.marginLeft,i-=this.tickLength+10);this.labelFunction&&g&&(c=this.labelFunction(c,g,this));c=t.fixBrakes(c);m=!1;this.boldLabels&&(m=!0);e>this.end&&"start"==this.tickPosition&&(c=" ");this.rotate&&this.inside&&(n-=2);isNaN(g.widthValue)||(g.percentWidthValue=g.widthValue/T*100,i=this.rotate?this.height*g.widthValue/T:this.width*g.widthValue/T,o=y,y+=i,f=n=i/2);u=new this.axisItemRenderer(this,o,c,u,i,n,void 0,m,f,!1,g.labelColor,g.className);u.serialDataItem=g;this.pushAxisItem(u);this.gridAlpha=p}}else if(this.parseDates&&this.equalSpacing){h=this.start;this.startTime=this.data[this.start].time;this.endTime=this.data[this.end].time;this.timeDifference=this.endTime-this.startTime;e=this.choosePeriod(0);r=e.period;g=e.count;e=t.getPeriodDuration(r,g);e<m&&(r=c.period,g=c.count,e=m);p=r;"WW"==p&&(p="DD");this.currentDateFormat=this.dateFormatsObject[p];this.stepWidth=this.getStepWidth(o);n=Math.ceil(this.timeDifference/e)+1;c=t.resetDateToMin(new Date(this.startTime-e),r,g,A).getTime();this.cellWidth=this.getStepWidth(o);o=Math.round(c/e);s=-1;o/2==Math.round(o/2)&&(s=-2,c-=e);o=this.start;o/2==Math.round(o/2)&&o--;0>o&&(o=0);y=this.end+2;y>=this.data.length&&(y=this.data.length);i=!1;i=!l;this.previousPos=-1e3;20<this.labelRotationR&&(this.safeDistance=5);D=o;if(this.data[o].time!=t.resetDateToMin(new Date(this.data[o].time),r,g,A).getTime()){var m=0,S=c;for(e=o;e<y;e++)x=this.data[e].time,this.checkPeriodChange(r,g,x,S)&&(m++,2<=m&&(D=e,e=y),S=x)}v&&1<g&&(x=this.chooseMinorFrequency(g),t.getPeriodDuration(r,x));if(0<this.gridCountR)for(e=o;e<y;e++)if(x=this.data[e].time,this.checkPeriodChange(r,g,x,c)&&e>=D){o=this.getCoordinate(e-this.start);v=!1;this.nextPeriod[p]&&(v=this.checkPeriodChange(this.nextPeriod[p],1,x,c,p))&&t.resetDateToMin(new Date(x),this.nextPeriod[p],1,A).getTime()!=x&&(v=!1);m=!1;v&&this.markPeriodChange?(v=this.dateFormatsObject[this.nextPeriod[p]],m=!0):v=this.dateFormatsObject[p];c=t.formatDate(new Date(x),v,a);if(e==s&&!l||e==n&&!d)c=" ";i?i=!1:(C||(m=!1),o-this.previousPos>this.safeDistance*Math.cos(this.labelRotationR*Math.PI/180)&&(this.labelFunction&&(c=this.labelFunction(c,new Date(x),this,r,g,f)),this.boldLabels&&(m=!0),u=new this.axisItemRenderer(this,o,c,void 0,void 0,void 0,void 0,m),v=u.graphics(),this.pushAxisItem(u),v=v.getBBox().width,t.isModern||(v-=o),this.previousPos=o+v));f=c=x}}for(e=l=0;e<this.data.length;e++)if(x=this.data[e])this.parseDates&&!this.equalSpacing?(d=x.time,s=this.cellWidth,"MM"==this.minPeriod&&(s=864e5*t.daysInMonth(new Date(d))*this.stepWidth,x.cellWidth=s),d=Math.round((d-this.startTime)*this.stepWidth+s/2)):d=this.getCoordinate(e-h),x.x[this.id]=d;if(this.widthField)for(e=this.start;e<=this.end;e++)x=this.data[e],s=x.widthValue,x.percentWidthValue=s/T*100,this.rotate?(d=this.height*s/T/2+l,l=this.height*s/T+l):(d=this.width*s/T/2+l,l=this.width*s/T+l),x.x[this.id]=d;T=this.guides.length;for(e=0;e<T;e++)if(l=this.guides[e],A=A=A=v=s=NaN,d=l.above,l.toCategory&&(A=a.getCategoryIndexByValue(l.toCategory),isNaN(A)||(s=this.getCoordinate(A-h),l.expand&&(s+=this.cellWidth/2),u=new this.axisItemRenderer(this,s,"",!0,NaN,NaN,l),this.pushAxisItem(u,d))),l.category&&(A=a.getCategoryIndexByValue(l.category),isNaN(A)||(v=this.getCoordinate(A-h),l.expand&&(v-=this.cellWidth/2),A=(s-v)/2,u=new this.axisItemRenderer(this,v,l.label,!0,NaN,A,l),this.pushAxisItem(u,d))),C=a.dataDateFormat,l.toDate&&(!C||l.toDate instanceof Date||(l.toDate=l.toDate.toString()+" |"),l.toDate=t.getDate(l.toDate,C),this.equalSpacing?(A=a.getClosestIndex(this.data,"time",l.toDate.getTime(),!1,0,this.data.length-1),isNaN(A)||(s=this.getCoordinate(A-h))):s=(l.toDate.getTime()-this.startTime)*this.stepWidth,u=new this.axisItemRenderer(this,s,"",!0,NaN,NaN,l),this.pushAxisItem(u,d)),l.date&&(!C||l.date instanceof Date||(l.date=l.date.toString()+" |"),l.date=t.getDate(l.date,C),this.equalSpacing?(A=a.getClosestIndex(this.data,"time",l.date.getTime(),!1,0,this.data.length-1),isNaN(A)||(v=this.getCoordinate(A-h))):v=(l.date.getTime()-this.startTime)*this.stepWidth,A=(s-v)/2,u=!0,l.toDate&&(u=!1),u="H"==this.orientation?new this.axisItemRenderer(this,v,l.label,u,2*A,NaN,l):new this.axisItemRenderer(this,v,l.label,!1,NaN,A,l),this.pushAxisItem(u,d)),u&&(A=u.label)&&this.addEventListeners(A,l),0<s||0<v){A=!1;if(this.rotate){if(s<this.height||v<this.height)A=!0}else if(s<this.width||v<this.width)A=!0;A&&(s=new this.guideFillRenderer(this,v,s,l),v=s.graphics(),this.pushAxisItem(s,d),l.graphics=v,v.index=e,this.addEventListeners(v,l))}if(a=a.chartCursor)b?a.fixHeight(this.cellWidth):(a.fixWidth(this.cellWidth),a.fullWidth&&this.balloon&&(this.balloon.minWidth=this.cellWidth));this.previousHeight=N}this.axisCreated=!0;this.set.translate(this.x,this.y);this.labelsSet.translate(this.x,this.y);this.labelsSet.show();this.positionTitle();(b=this.axisLine.set)&&b.toFront();var N=this.getBBox().height;2<N-this.previousHeight&&this.autoWrap&&!this.parseDates&&(this.axisCreated=this.chart.marginsUpdated=!1)},xToIndex:function(i){var e=this.data,a=this.chart,s=a.rotate,r=this.stepWidth,h;if(this.parseDates&&!this.equalSpacing)i=this.startTime+Math.round(i/r)-this.minDuration()/2,h=a.getClosestIndex(e,"time",i,!1,this.start,this.end+1);else if(this.widthField)for(a=Infinity,r=this.start;r<=this.end;r++){var o=this.data[r];o&&(o=Math.abs(o.x[this.id]-i),o<a&&(a=o,h=r))}else this.startOnAxis||(i-=r/2),h=this.start+Math.round(i/r);h=t.fitToBounds(h,0,e.length-1);var n;e[h]&&(n=e[h].x[this.id]);s?n>this.height+1&&h--:n>this.width+1&&h--;0>n&&h++;return h=t.fitToBounds(h,0,e.length-1)},dateToCoordinate:function(t){return this.parseDates&&!this.equalSpacing?(t.getTime()-this.startTime)*this.stepWidth:this.parseDates&&this.equalSpacing?(t=this.chart.getClosestIndex(this.data,"time",t.getTime(),!1,0,this.data.length-1),this.getCoordinate(t-this.start)):NaN},categoryToCoordinate:function(t){if(this.chart){if(this.parseDates)return this.dateToCoordinate(new Date(t));t=this.chart.getCategoryIndexByValue(t);if(!isNaN(t))return this.getCoordinate(t-this.start)}else return NaN},coordinateToDate:function(t){return this.equalSpacing?(t=this.xToIndex(t),new Date(this.data[t].time)):new Date(this.startTime+t/this.stepWidth)},coordinateToValue:function(t){t=this.xToIndex(t);if(t=this.data[t])return this.parseDates?t.time:t.category},getCoordinate:function(t){t*=this.stepWidth;this.startOnAxis||(t+=this.stepWidth/2);return Math.round(t)},formatValue:function(i,e){e||(e=this.currentDateFormat);this.parseDates&&(i=t.formatDate(new Date(i),e,this.chart));return i},showBalloonAt:function(t,i){void 0===i&&(i=this.parseDates?this.dateToCoordinate(new Date(t)):this.categoryToCoordinate(t));return this.adjustBalloonCoordinate(i)},formatBalloonText:function(i,e,a){var s="",r="",h=this.chart,o=this.data[e];if(o)if(this.parseDates)s=t.formatDate(o.category,a,h),e=t.changeDate(new Date(o.category),this.minPeriod,1),r=t.formatDate(e,a,h),-1!=s.indexOf("fff")&&(s=t.formatMilliseconds(s,o.category),r=t.formatMilliseconds(r,e));else{var n;this.data[e+1]&&(n=this.data[e+1]);s=t.fixNewLines(o.category);n&&(r=t.fixNewLines(n.category))}i=i.replace(/\[\[category\]\]/g,String(s));return i=i.replace(/\[\[toCategory\]\]/g,String(r))},adjustBalloonCoordinate:function(t,i){var e=this.xToIndex(t),a=this.chart.chartCursor;if(this.stickBalloonToCategory){var s=this.data[e];s&&(t=s.x[this.id]+1);this.stickBalloonToStart&&(t-=this.cellWidth/2);var r=0;if(a){var h=a.limitToGraph;if(h){var o=h.valueAxis.id;h.hidden||(r=s.axes[o].graphs[h.id].y)}this.rotate?("left"==this.position?(h&&(r-=a.width),0<r&&(r=0)):0>r&&(r=0),a.fixHLine(t,r)):("top"==this.position?(h&&(r-=a.height),0<r&&(r=0)):0>r&&(r=0),a.fixVLine(t,r))}}a&&!i&&(a.setIndex(e),this.parseDates&&a.setTimestamp(this.coordinateToDate(t).getTime()));return t}})})();
//# sourceMappingURL=serial.map.js