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=.8;this.updateScrollbar=!0;var b=new AmCharts.CategoryAxis(a);b.chart=this;this.categoryAxis=b;this.zoomOutOnDataUpdate=!0;this.mouseWheelZoomEnabled=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?(l=this.endTime-this.startTime,d=this.startTime+c*e,e=this.endTime+f*e,0=h&&(e=h,d=h-l),this.zoomToDates(new Date(d), new Date(e))):(0=l-1&&(c=f=0),d=this.start+c,e=this.end+f,this.zoomToIndexes(d,e)):d?(l=this.endTime-this.startTime,d=this.startTime-c*e,e=this.endTime-f*e,0this.start&&(c=f=0),d=this.start-c,e=this.end-f,this.zoomToIndexes(d,e))}},validateData:function(a){this.marginsUpdated=!1;this.zoomOutOnDataUpdate&&!a&&(this.endTime=this.end=this.startTime=this.start=NaN);AmCharts.AmSerialChart.base.validateData.call(this)}, drawChart:function(){AmCharts.AmSerialChart.base.drawChart.call(this);var a=this.chartData;if(AmCharts.ifArray(a)){var b=this.chartScrollbar;b&&b.draw();if(0c&&(a=b-c,this.updateScrollbar=!0),a!=this.startTime&&b-a>c&& (b=a+c,this.updateScrollbar=!0));var d=this.minSelectedTime;if(0h&&(a=h);bh&&(b=h);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 l=e+Math.round((f-e)/2),h=a[l][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,l=b.numberFormatter;l||(l=this.nf);for(var h=0;hA)r=A;if(isNaN(s)||su)z=u;if(isNaN(y)||yb&&0===m&&(m=180):0>c&&270==m&&(m=90);this.gradientRotation=m;0===d&&0===e&&(this.cornerRadius=p);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,l=this.colors,h=this.alpha,g=this.bwidth,k=this.bcolor,m=this.balpha,p=this.gradientRotation,v=this.cornerRadius,r=this.dashLength,s=this.pattern,n=this.topRadius,w=l,q=l;"object"==typeof l&&(w=l[0],q=l[l.length-1]);var x,t,z,y,B,D,u,A,H,M=h;s&&(h=0);var C,E,F,G,I=this.rotate;if(0Math.abs(d)&&(d=0);1>Math.abs(c)&&(c=0);!isNaN(n)&&(0d&&(g=" A"),h+=g+Math.round(c/2-F)+","+Math.round(d-G)+","+Math.round(c/2+F)+","+ Math.round(d+G)+",0,"+d+","+c+","+d,h+=" L"+c+",0",h+=g+Math.round(c/2+C)+","+Math.round(E)+","+Math.round(c/2-C)+","+Math.round(-E)+","+c+",0,0,0"):(h+="A"+F+","+G+",0,0,0,"+(c-c/2*(1-n))+","+d+"L"+c+",0",h+="A"+C+","+E+",0,0,1,0,0"),C=180),b=b.path(h).attr(l),b.gradient("linearGradient",[w,AmCharts.adjustLuminosity(w,-.3),AmCharts.adjustLuminosity(w,-.3),w],C),I?b.translate(e/2,0):b.translate(0,f/2)):b=0===d?AmCharts.line(b,[0,c],[0,0],k,m,g,r):0===c?AmCharts.line(b,[0,0],[0,d],k,m,g,r):0d?[x,H,t,z,y,B,D,u,A,b]:[u,A,t,z,y,B,x,H,D,b]:I?0d?[x,b,u]:[u,b,x];for(d=0;da&&(this.endTime=a);q=this.minorGridEnabled;var y,a=this.gridAlpha,B;if(this.parseDates&&!this.equalSpacing){this.timeDifference=this.endTime-this.startTime;d=this.choosePeriod(0);e=d.period;v=d.count;r=AmCharts.getPeriodDuration(e,v);rk&&(k=0),l=0,this.end-k+1>=this.autoRotateCount&&(this.labelRotation=this.autoRotateAngle),b=k;b<=this.end+2;b++){n=!1;0<=b&&bthis.end&&"start"==this.tickPosition&&(m=" ");n=new this.axisItemRenderer(this,k,m,x,D,n,void 0,z,tickShift,!1,s.labelColor);n.serialDataItem=s;this.pushAxisItem(n);this.gridAlpha=a}}else if(this.parseDates&&this.equalSpacing){f=this.start; this.startTime=this.data[this.start].time;this.endTime=this.data[this.end].time;this.timeDifference=this.endTime-this.startTime;d=this.choosePeriod(0);e=d.period;v=d.count;r=AmCharts.getPeriodDuration(e,v);rk&&(k=0);w=this.end+2;w>=this.data.length&&(w=this.data.length);B=!1;B=!h;this.previousPos=-1E3;20=r){k=this.getCoordinate(b-this.start);q=!1;this.nextPeriod[s]&&(q=this.checkPeriodChange(this.nextPeriod[s],1,p,m,s));z=!1;q&&this.markPeriodChange?(q=this.dateFormatsObject[this.nextPeriod[s]],z=!0):q=this.dateFormatsObject[s];m=AmCharts.formatDate(new Date(p),q,c);if(b==d&&!h||b==l&&!g)m=" ";B?B=!1:(t||(z=!1),k-this.previousPos>this.safeDistance*Math.cos(this.labelRotation*Math.PI/180)&&(this.labelFunction&&(m=this.labelFunction(m,new Date(p),this,e,v,n)),this.boldLabels&&(z=!0),n=new this.axisItemRenderer(this, k,m,void 0,void 0,void 0,void 0,z),x=n.graphics(),this.pushAxisItem(n),n=x.getBBox().width,AmCharts.isModern||(n-=k),this.previousPos=k+n));n=m=p}else isNaN(y)||(this.checkPeriodChange(e,y,p,D)&&(this.gridAlpha=this.minorGridAlpha,k=this.getCoordinate(b-this.start),q=new this.axisItemRenderer(this,k),this.pushAxisItem(q),D=p),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)}});