AmCharts.AmStockChart=AmCharts.Class({construct:function(){this.version="3.2.0";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;this.valueAxesSettings=new AmCharts.ValueAxesSettings;this.panelsSettings=new AmCharts.PanelsSettings;this.chartScrollbarSettings=new AmCharts.ChartScrollbarSettings;this.chartCursorSettings=new AmCharts.ChartCursorSettings;this.stockEventsSettings=new AmCharts.StockEventsSettings;this.legendSettings=new AmCharts.LegendSettings;this.balloon=new AmCharts.AmBalloon;this.previousEndDate=new Date(0);this.previousStartDate= new Date(0);this.dataSetCount=this.graphCount=0;this.chartCreated=!1},write:function(a){var b=this.exportConfig;b&&AmCharts.AmExport&&!this.AmExport&&(this.AmExport=new AmCharts.AmExport(this,b));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);this.valueAxesSettings=AmCharts.processObject(this.valueAxesSettings, AmCharts.ValueAxesSettings);this.chartCursorSettings=AmCharts.processObject(this.chartCursorSettings,AmCharts.ChartCursorSettings);this.chartScrollbarSettings=AmCharts.processObject(this.chartScrollbarSettings,AmCharts.ChartScrollbarSettings);this.legendSettings=AmCharts.processObject(this.legendSettings,AmCharts.LegendSettings);this.panelsSettings=AmCharts.processObject(this.panelsSettings,AmCharts.PanelsSettings);this.stockEventsSettings=AmCharts.processObject(this.stockEventsSettings,AmCharts.StockEventsSettings); 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;ab?this.colors[b]:AmCharts.randomColor())}},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;ce.getTime()&&(a=e);b.getTime()e.getTime()&&(b=e);h=AmCharts.getItemIndex(f,h.groupToPeriods);e=g;g=c.choosePeriod(h,a,b);c.currentPeriod=g;h=AmCharts.extractPeriod(g);AmCharts.getPeriodDuration(h.period,h.count);AmCharts.getPeriodDuration(f);1>b.getTime()-a.getTime()&&(a=new Date(b.getTime()-1));f=new Date(a);f.getTime()==d.getTime()&&(f=AmCharts.resetDateToMin(a,h.period,h.count,x));for(d=0;dd&&0m.getTime()&&(k=AmCharts.getPeriodDuration("DD",1),g=new Date(m.getTime()-k)),g.getTime()=x[r]||!x[r]){s[r]={};s[r].amCategoryIdField=String(AmCharts.resetDateToMin(l,C,B,d).getTime());var E;for(E=0;Em&&(t=new Date(l),t=AmCharts.changeDate(t,C,B,!0),t=AmCharts.resetDateToMin(t,C,B,d),x[r]=t.getTime());if(z==m)for(var F in p)p.hasOwnProperty(F)&&(s[r][F]=p[F]);s[r][f]=new Date(l)}else for(C=0;Ct[v+"High"]&&(t[v+ "High"]=q),t[v+"Close"]=q,t[v+"Sum"]+=q,t[v+"Count"]++,t[v+"Average"]=t[v+"Sum"]/t[v+"Count"])}}}a.agregatedDataProviders=g}; AmCharts.parseEvents=function(a,b,c,d,e,g){var h=a.stockEvents,f=a.agregatedDataProviders,m=b.length,k,u,y,r,x,s,n,w;for(k=0;k=v&&wthis.availableSpace&&(this.stackDown=!0);this.set=a.set();a=0;var c;for(c=0;c