AmCharts.AmStockChart=AmCharts.Class({construct:function(a){this.type="stock";this.cname="AmStockChart";this.version="3.4.8";this.theme=a;this.createEvents("zoomed","rollOverStockEvent","rollOutStockEvent","clickStockEvent","panelRemoved","dataUpdated","init","rendered","drawn");this.colors="#FF6600 #FCD202 #B0DE09 #0D8ECF #2A0CD0 #CD0D74 #CC0000 #00CC00 #0000CC #DDDDDD #999999 #333333 #990000".split(" ");this.firstDayOfWeek=1;this.glueToTheEnd=!1;this.dataSetCounter=-1;this.zoomOutOnDataSetChange= !1;this.panels=[];this.dataSets=[];this.chartCursors=[];this.comparedDataSets=[];this.categoryAxesSettings=new AmCharts.CategoryAxesSettings(a);this.valueAxesSettings=new AmCharts.ValueAxesSettings(a);this.panelsSettings=new AmCharts.PanelsSettings(a);this.chartScrollbarSettings=new AmCharts.ChartScrollbarSettings(a);this.chartCursorSettings=new AmCharts.ChartCursorSettings(a);this.stockEventsSettings=new AmCharts.StockEventsSettings(a);this.legendSettings=new AmCharts.LegendSettings(a);this.balloon= new AmCharts.AmBalloon(a);this.previousEndDate=new Date(0);this.previousStartDate=new Date(0);this.dataSetCount=this.graphCount=0;this.chartCreated=!1;AmCharts.applyTheme(this,a,this.cname)},write:function(a){var b=this.theme,c=this.exportConfig;c&&AmCharts.AmExport&&!this.AmExport&&(this.AmExport=new AmCharts.AmExport(this,c));this.chartRendered=!1;a="object"!=typeof a?document.getElementById(a):a;this.zoomOutOnDataSetChange&&(this.endDate=this.startDate=void 0);this.categoryAxesSettings=AmCharts.processObject(this.categoryAxesSettings, AmCharts.CategoryAxesSettings,b);this.valueAxesSettings=AmCharts.processObject(this.valueAxesSettings,AmCharts.ValueAxesSettings,b);this.chartCursorSettings=AmCharts.processObject(this.chartCursorSettings,AmCharts.ChartCursorSettings,b);this.chartScrollbarSettings=AmCharts.processObject(this.chartScrollbarSettings,AmCharts.ChartScrollbarSettings,b);this.legendSettings=AmCharts.processObject(this.legendSettings,AmCharts.LegendSettings,b);this.panelsSettings=AmCharts.processObject(this.panelsSettings, AmCharts.PanelsSettings,b);this.stockEventsSettings=AmCharts.processObject(this.stockEventsSettings,AmCharts.StockEventsSettings,b);this.dataSetSelector&&(this.dataSetSelector=AmCharts.processObject(this.dataSetSelector,AmCharts.DataSetSelector,b));this.periodSelector&&(this.periodSelector=AmCharts.processObject(this.periodSelector,AmCharts.PeriodSelector,b));a.innerHTML="";this.div=a;this.measure();this.createLayout();this.updateDataSets();this.addDataSetSelector();this.addPeriodSelector();this.addPanels(); this.updatePanels();this.addChartScrollbar();this.updateData();this.skipDefault||this.setDefaultPeriod()},setDefaultPeriod:function(a){var b=this.periodSelector;b&&(this.animationPlayed=!1,b.setDefaultPeriod(a))},validateSize:function(){var a,b=this.panels;this.measurePanels();for(a=0;ac?this.colors[c]:AmCharts.randomColor())}!a&&AmCharts.ifArray(b)&&(this.mainDataSet=this.dataSets[0])},updateEvents:function(a){AmCharts.ifArray(a.stockEvents)&&AmCharts.parseEvents(a,this.panels,this.stockEventsSettings,this.firstDayOfWeek,this,this.dataDateFormat)},getLastDate:function(a){var b=this.dataDateFormat;a=a instanceof Date?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(), a.getMilliseconds()):b?AmCharts.stringToDate(a,b):new Date(a);return new Date(AmCharts.changeDate(a,this.categoryAxesSettings.minPeriod,1,!0).getTime()-1)},getFirstDate:function(a){var b=this.dataDateFormat;a=a instanceof Date?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()):b?AmCharts.stringToDate(a,b):new Date(a);return new Date(AmCharts.resetDateToMin(a,this.categoryAxesSettings.minPeriod,1,this.firstDayOfWeek))},updateData:function(){var a= this.mainDataSet;if(a){var b=this.categoryAxesSettings;-1==AmCharts.getItemIndex(b.minPeriod,b.groupToPeriods)&&b.groupToPeriods.unshift(b.minPeriod);var c=a.dataProvider;if(AmCharts.ifArray(c)){var d=a.categoryField;this.firstDate=this.getFirstDate(c[0][d]);this.lastDate=this.getLastDate(c[c.length-1][d]);this.periodSelector&&this.periodSelector.setRanges(this.firstDate,this.lastDate);a.dataParsed||(AmCharts.parseStockData(a,b.minPeriod,b.groupToPeriods,this.firstDayOfWeek,this.dataDateFormat),a.dataParsed= !0);this.updateComparingData();this.updateEvents(a)}else this.lastDate=this.firstDate=void 0;this.glueToTheEnd&&this.startDate&&this.endDate&&this.lastDate&&(AmCharts.getPeriodDuration(b.minPeriod),this.startDate=new Date(this.startDate.getTime()+(this.lastDate.getTime()-this.endDate.getTime())),this.endDate=this.lastDate,this.updateScrollbar=!0);this.updatePanelsWithNewData()}a={type:"dataUpdated",chart:this};this.fire(a.type,a)},updateComparingData:function(){var a=this.comparedDataSets,b=this.categoryAxesSettings, c;for(c=0;ch.getTime()&&(a=h);b.getTime()h.getTime()&&(b=h);h=AmCharts.getItemIndex(k,g.groupToPeriods);e=f;f=d.choosePeriod(h,a,b);d.currentPeriod=f;h=AmCharts.extractPeriod(f);AmCharts.getPeriodDuration(h.period,h.count);AmCharts.getPeriodDuration(k);1>b.getTime()-a.getTime()&&(a=new Date(b.getTime()-1));k=new Date(a);for(g=0;gd&&0m.getTime()&&(p=AmCharts.getPeriodDuration("DD",1),f=new Date(m.getTime()-p)),f.getTime()a?(d=this.startTime+d*e,e=this.endTime+1*e):(d=this.startTime-d*e,e=this.endTime-1*e);dthis.lastTime&&(e=this.lastTime);d=w[t]||!w[t]){y[t]={};y[t].amCategoryIdField=String(AmCharts.resetDateToMin(l,B,E,d).getTime());var C;for(C=0;Ck&&(s=new Date(l),s=AmCharts.changeDate(s,B,E,!0),s=AmCharts.resetDateToMin(s,B,E,d),w[t]=s.getTime());if(z==k)for(var F in q)q.hasOwnProperty(F)&&(y[t][F]=q[F]);y[t][g]=new Date(l)}else for(B=0;Bv[s+"High"]&&(v[s+"High"]=r),v[s+"Close"]=r,E=AmCharts.getDecimals(v[s+"Sum"]),C=AmCharts.getDecimals(r),v[s+"Sum"]+=r,v[s+"Sum"]=AmCharts.roundTo(v[s+"Sum"],Math.max(E,C)),v[s+"Count"]++,v[s+"Average"]=v[s+"Sum"]/v[s+"Count"])}}}a.agregatedDataProviders=h}; AmCharts.parseEvents=function(a,b,c,d,e,h){var f=a.stockEvents,g=a.agregatedDataProviders,k=b.length,m,p,x,t,w,y,n,u;for(m=0;m=E&&uthis.availableSpace&&(this.stackDown=!0);this.set=a.set();a=0;var c;for(c=0;c