AmCharts.AmSerialChart=AmCharts.Class({inherits:AmCharts.AmRectangularChart,construct:function(a){this.type="serial";AmCharts.AmSerialChart.base.construct.call(this,a);this.cname="AmSerialChart";this.theme=a;this.createEvents("changed");this.columnSpacing=5;this.columnSpacing3D=0;this.columnWidth=0.8;this.updateScrollbar=!0;var b=new AmCharts.CategoryAxis(a);b.chart=this;this.categoryAxis=b;this.zoomOutOnDataUpdate=!0;this.mouseWheelScrollEnabled=this.rotate=this.skipZoom=!1;this.minSelectedTime= 0;AmCharts.applyTheme(this,a,this.cname)},initChart:function(){AmCharts.AmSerialChart.base.initChart.call(this);this.updateCategoryAxis(this.categoryAxis,this.rotate,"categoryAxis");this.dataChanged&&(this.updateData(),this.dataChanged=!1,this.dispatchDataUpdated=!0);var a=this.chartCursor;a&&(a.updateData(),a.fullWidth&&(a.fullRectSet=this.cursorLineSet));var a=this.countColumns(),b=this.graphs,c;for(c=0;ca?d?this.endTimethis.firstTime&&this.zoomToDates(new Date(this.startTime- e*c),new Date(this.endTime-1*c)):0c&&(a=b-c,this.updateScrollbar=!0),a!=this.startTime&&b-a>c&&(b=a+c,this.updateScrollbar=!0));var d=this.minSelectedTime;if(0n&&(a=n);bn&&(b=n);bc&&(a=b-c,this.updateScrollbar=!0),a!=this.start&&b-a>c&&(b=a+c,this.updateScrollbar=!0));if(a!=this.start||b!=this.end){var d=this.chartData.length-1;isNaN(a)&&(a=0,isNaN(c)||(a=d-c));isNaN(b)&&(b=d);bd&&(b=d);a>d&&(a=d-1);0>a&&(a=0);this.start=a;this.end=b;this.categoryAxis.zoom(a,b);this.zoomAxesAndGraphs();this.zoomScrollbar();0!==a||b!=this.chartData.length- 1?this.showZB(!0):this.showZB(!1);this.updateColumnsDepth();this.dispatchIndexZoomEvent()}},updateGraphs:function(){AmCharts.AmSerialChart.base.updateGraphs.call(this);var a=this.graphs,b;for(b=0;bb.depth?1:-1},zoomScrollbar:function(){var a=this.chartScrollbar,b=this.categoryAxis;a&&this.updateScrollbar&&(b.parseDates&&!b.equalSpacing? a.timeZoom(this.startTime,this.endTime):a.zoom(this.start,this.end),this.updateScrollbar=!0)},updateTrendLines:function(){var a=this.trendLines,b;for(b=0;be&&(e=0);f>a.length-1&&(f=a.length-1);var k=e+Math.round((f-e)/2),n=a[k][b];if(1>=f-e){if(d)return e;d=a[f][b];return Math.abs(a[e][b]-c)a&&(a=0),b>d-1&&(b=d-1),d=this.categoryAxis,d.parseDates&&!d.equalSpacing?this.zoom(c[a].time,this.getEndTime(c[b].time)):this.zoom(a,b))}},zoomToDates:function(a,b){this.updateScrollbar=!0;var c=this.chartData;if(this.categoryAxis.equalSpacing){var d=this.getClosestIndex(c,"time",a.getTime(),!0,0,c.length);b=AmCharts.resetDateToMin(b,this.categoryAxis.minPeriod,1);c=this.getClosestIndex(c,"time",b.getTime(),!1,0,c.length); this.zoom(d,c)}else this.zoom(a.getTime(),b.getTime())},zoomToCategoryValues:function(a,b){this.updateScrollbar=!0;this.zoom(this.getCategoryIndexByValue(a),this.getCategoryIndexByValue(b))},formatPeriodString:function(a,b){if(b){var c=["value","open","low","high","close"],d="value open low high close average sum count".split(" "),e=b.valueAxis,f=this.chartData,k=b.numberFormatter;k||(k=this.nf);for(var n=0;nz)q=z;if(isNaN(s)||sx)t=x;if(isNaN(w)||wb&&0===g&&(g=180):0>c&&270==g&&(g=90);this.gradientRotation=g;0===d&&0===e&&(this.cornerRadius=m);this.draw()},draw:function(){var a=this.set;a.clear();var b=this.container,c=this.w,d=this.h,e=this.dx,f= this.dy,k=this.colors,n=this.alpha,l=this.bwidth,h=this.bcolor,g=this.balpha,m=this.gradientRotation,u=this.cornerRadius,q=this.dashLength,s=this.pattern,p=k,v=k;"object"==typeof k&&(p=k[0],v=k[k.length-1]);var A,y,r,t,w,B,C,x,z,D=n;s&&(n=0);if(0Math.abs(d)&&(d=0);1>Math.abs(c)&&(c=0);b=0===d?AmCharts.line(b,[0,c],[0,0],h,g,l,q):0===c?AmCharts.line(b, [0,0],[0,d],h,g,l,q):0d?[A,z,y,r,t,w,B,C,x,b]:[C,x,y,r,t,w,A,z,B,b];for(A=0;Aa&&(this.endTime=a);t=this.minorGridEnabled;var w,a=this.gridAlpha,B;if(this.parseDates&&!this.equalSpacing){this.timeDifference=this.endTime-this.startTime;d=this.choosePeriod(0);e=d.period;u=d.count;q=AmCharts.getPeriodDuration(e,u);qh&&(h=0), k=0,this.end-h+1>=this.autoRotateCount&&(this.labelRotation=this.autoRotateAngle),b=h;b<=this.end+2;b++){p=!1;0<=b&&bh&&(h=0);v=this.end+2;v>=this.data.length&&(v=this.data.length);B=!1;B=!n;this.previousPos=-1E3;20=q){h=this.getCoordinate(b-this.start);A=!1;this.nextPeriod[s]&&(A=this.checkPeriodChange(this.nextPeriod[s],1,m,g,s));t=!1;A&&this.markPeriodChange?(g=this.dateFormatsObject[this.nextPeriod[s]],t=!0):g=this.dateFormatsObject[s];g=AmCharts.formatDate(new Date(m), g);if(b==d&&!n||b==k&&!l)g=" ";B?B=!1:(r||(t=!1),h-this.previousPos>this.safeDistance*Math.cos(this.labelRotation*Math.PI/180)&&(this.labelFunction&&(g=this.labelFunction(g,new Date(m),this,e,u,p)),p=new this.axisItemRenderer(this,h,g,void 0,void 0,void 0,void 0,t),y=p.graphics(),this.pushAxisItem(p),p=y.getBBox().width,AmCharts.isModern||(p-=h),this.previousPos=h+p));p=g=m}else isNaN(w)||(this.checkPeriodChange(e,w,m,C)&&(this.gridAlpha=this.minorGridAlpha,h=this.getCoordinate(b-this.start),t=new this.axisItemRenderer(this, h),this.pushAxisItem(t),C=m),this.gridAlpha=a)}for(b=0;bthis.height+1&&c--:f>this.width+1&&c--;0>f&&c++;return c=AmCharts.fitToBounds(c,0,b.length-1)},dateToCoordinate:function(a){return this.parseDates&&!this.equalSpacing?(a.getTime()-this.startTime)*this.stepWidth:this.parseDates&&this.equalSpacing? (a=this.chart.getClosestIndex(this.data,"time",a.getTime(),!1,0,this.data.length-1),this.getCoordinate(a-this.start)):NaN},categoryToCoordinate:function(a){return this.chart?(a=this.chart.getCategoryIndexByValue(a),this.getCoordinate(a-this.start)):NaN},coordinateToDate:function(a){return this.equalSpacing?(a=this.xToIndex(a),new Date(this.data[a].time)):new Date(this.startTime+a/this.stepWidth)}});