amcharts.rb 3.4.7.5 → 3.4.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDUwZmRkNjllMmI0ZWEzZGU3NDc2NDM3MzkyYjYzYzk3MzZjMDcwOA==
4
+ OTYyYmMwMjA2ZTRjY2Q3NjBkNjE0ZDk2NjExMTAxYzVmNjY3MzhmOQ==
5
5
  data.tar.gz: !binary |-
6
- YThhNjE5YWVhODcwNTg2MDczMDNhMTU0Y2QxOWFlYjAzMGQ4NGRkMw==
6
+ MWQ5MTYwODUyNDc1YzNlODU1ZWMwZjhkYzRkZTEwZWU2ZmUwMzUwOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWU0M2Y4M2Q4ZjQzZWM4M2QzZDJmODI0NjY0YmNjMDA0ZjIxYjEzZjU5NmZi
10
- MGZkOTBmMzc1MmU1Y2U5YTE3MGFkNjdiNjBhMTRiMTYzY2E2NjdiOTY4ZTJl
11
- ZGZjYzE5MGZjNzExZWYzZTgyZWU4MzdmODQyMTY5NmVjNDUzY2Y=
9
+ MjBiYjk4YjFmZDI4ZGI5OTBlYzgxOTNmZDc5N2M2N2QxOWRlMjBkZTVkOTYz
10
+ ZjMzNTU3Y2U0ZmFkOTk4NGZlOTE1YWQ1ZDhlNzJlNDk3MzE0MTkzYjgxYzEy
11
+ ZDMzNzM4MTU5MzEwMjkzOWJmZGVmYmFiY2E1YTVhNjVlMTNmYjQ=
12
12
  data.tar.gz: !binary |-
13
- MmVkMzQ1OThkMjRmNTI5NzM1ZThkOGNkNGFiNTA5YWQ3NWU2M2RmNmQwNTcy
14
- MjM1ZjI5MThmYzk5YmM5OWIwMzcwNmNhMDFiYzJkMWNhY2U0NGU4OTAwNDE1
15
- MDM5ZDAyOTQxZWFkNjZhODFiM2Y5MDM4YTJkMzQwMGVkNGUxZmQ=
13
+ NGQ1NjkwZWYxMTc5YzQyNDE0MTdlZWJhYjE4MGRlZDJjNmVkZDgxN2RjM2Uw
14
+ MjhkOTUzZTM0Mzg4ZDgwODlmZDFjYzI4YTk2YjAzNmY5NWQxMWU3YjFkN2Zk
15
+ NWEzYTljYTNhZDdkMjc2YTI0OThjMmE1ZmMxZmZiZDZiZjJlMzY=
@@ -35,14 +35,24 @@ AmCharts.RB.Util = {
35
35
  {
36
36
  var str = [];
37
37
 
38
- for(var p in obj)
38
+ if (AmCharts.ifArray(obj))
39
39
  {
40
- var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p];
41
-
42
- str.push(typeof v == "object" ?
43
- AmCharts.RB.Util.to_query_string(v, k) :
44
- encodeURIComponent(k) + "=" + encodeURIComponent(v));
40
+ for (var i = 0; i < obj.length; i++)
41
+ {
42
+ var k = prefix ? prefix + "[]" : "[]", v = obj[i];
43
+ str.push(encodeURIComponent(k) + '=' + encodeURIComponent(v));
44
+ }
45
45
  }
46
+ else {
47
+ for (var p in obj) {
48
+ if (!obj.hasOwnProperty(p)) continue;
49
+ var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p];
50
+
51
+ str.push(typeof v == "object" ?
52
+ AmCharts.RB.Util.to_query_string(v, k) :
53
+ encodeURIComponent(k) + "=" + encodeURIComponent(v));
54
+ }
55
+ }
46
56
 
47
57
  return str.join("&");
48
58
  },
@@ -1,3 +1,3 @@
1
1
  module AmCharts
2
- VERSION = "3.4.7.5"
2
+ VERSION = "3.4.8.0"
3
3
  end
@@ -37,8 +37,8 @@ AmCharts.easeOutElastic=function(a,b,c,d,e){a=1.70158;var f=0,g=d;if(0===b)retur
37
37
  a&&(a="left"),"top"==a&&(a="right"));this.position=a},draw:function(){var a=this.chart;this.allLabels=[];this.counter=0;this.destroy();this.fixAxisPosition();this.labels=[];var b=a.container,c=b.set();a.gridSet.push(c);this.set=c;b=b.set();a.axesLabelsSet.push(b);this.labelsSet=b;this.axisLine=new this.axisRenderer(this);this.autoGridCount?("V"==this.orientation?(a=this.height/this.minVerticalGap,3>a&&(a=3)):a=this.width/this.minHorizontalGap,this.gridCountR=Math.max(a,1)):this.gridCountR=this.gridCount;
38
38
  this.axisWidth=this.axisLine.axisWidth;this.addTitle()},setOrientation:function(a){this.orientation=a?"H":"V"},addTitle:function(){var a=this.title;if(a){var b=this.chart,c=this.titleColor;void 0===c&&(c=b.color);var d=this.titleFontSize;isNaN(d)&&(d=b.fontSize+1);this.titleLabel=AmCharts.text(b.container,a,c,b.fontFamily,d,this.titleAlign,this.titleBold)}},positionTitle:function(){var a=this.titleLabel;if(a){var b,c,d=this.labelsSet,e={};0<d.length()?e=d.getBBox():(e.x=0,e.y=0,e.width=this.viW,e.height=
39
39
  this.viH);d.push(a);var d=e.x,f=e.y;AmCharts.VML&&(this.rotate?d-=this.x:f-=this.y);var g=e.width,e=e.height,h=this.viW,k=this.viH,l=0,m=a.getBBox().height/2,p=this.inside,n=this.titleAlign;switch(this.position){case "top":b="left"==n?-1:"right"==n?h:h/2;c=f-10-m;break;case "bottom":b="left"==n?-1:"right"==n?h:h/2;c=f+e+10+m;break;case "left":b=d-10-m;p&&(b-=5);c="left"==n?k+1:"right"==n?-1:k/2;l=-90;break;case "right":b=d+g+10+m-3,p&&(b+=7),c="left"==n?k+2:"right"==n?-2:k/2,l=-90}this.marginsChanged?
40
- (a.translate(b,c),this.tx=b,this.ty=c):a.translate(this.tx,this.ty);this.marginsChanged=!1;0!==l&&a.rotate(l)}},pushAxisItem:function(a,b){var c=a.graphics();0<c.length()&&(b?this.labelsSet.push(c):this.set.push(c));(c=a.getLabel())&&this.labelsSet.push(c)},addGuide:function(a){this.guides.push(a)},removeGuide:function(a){var b=this.guides,c;for(c=0;c<b.length;c++)b[c]==a&&b.splice(c,1)},handleGuideOver:function(a){clearTimeout(this.chart.hoverInt);var b=a.graphics.getBBox(),c=b.x+b.width/2,b=b.y+
41
- b.height/2,d=a.fillColor;void 0===d&&(d=a.lineColor);this.chart.showBalloon(a.balloonText,d,!0,c,b)},handleGuideOut:function(a){this.chart.hideBalloon()},addEventListeners:function(a,b){var c=this;a.mouseover(function(){c.handleGuideOver(b)});a.mouseout(function(){c.handleGuideOut(b)})},getBBox:function(){var a=this.labelsSet.getBBox();AmCharts.VML||(a={x:a.x+this.x,y:a.y+this.y,width:a.width,height:a.height});return a},destroy:function(){AmCharts.remove(this.set);AmCharts.remove(this.labelsSet);
40
+ (a.translate(b,c),this.tx=b,this.ty=c):a.translate(this.tx,this.ty);this.marginsChanged=!1;0!==l&&a.rotate(l)}},pushAxisItem:function(a,b){var c=a.graphics();0<c.length()&&(b?this.labelsSet.push(c):this.set.push(c));(c=a.getLabel())&&this.labelsSet.push(c)},addGuide:function(a){var b=this.guides;-1==b.indexOf(a)&&b.push(a)},removeGuide:function(a){var b=this.guides,c;for(c=0;c<b.length;c++)b[c]==a&&b.splice(c,1)},handleGuideOver:function(a){clearTimeout(this.chart.hoverInt);var b=a.graphics.getBBox(),
41
+ c=b.x+b.width/2,b=b.y+b.height/2,d=a.fillColor;void 0===d&&(d=a.lineColor);this.chart.showBalloon(a.balloonText,d,!0,c,b)},handleGuideOut:function(a){this.chart.hideBalloon()},addEventListeners:function(a,b){var c=this;a.mouseover(function(){c.handleGuideOver(b)});a.mouseout(function(){c.handleGuideOut(b)})},getBBox:function(){var a=this.labelsSet.getBBox();AmCharts.VML||(a={x:a.x+this.x,y:a.y+this.y,width:a.width,height:a.height});return a},destroy:function(){AmCharts.remove(this.set);AmCharts.remove(this.labelsSet);
42
42
  var a=this.axisLine;a&&AmCharts.remove(a.set);AmCharts.remove(this.grid0)}});AmCharts.ValueAxis=AmCharts.Class({inherits:AmCharts.AxisBase,construct:function(a){this.cname="ValueAxis";this.createEvents("axisChanged","logarithmicAxisFailed","axisSelfZoomed","axisZoomed");AmCharts.ValueAxis.base.construct.call(this,a);this.dataChanged=!0;this.stackType="none";this.position="left";this.unitPosition="right";this.recalculateToPercents=this.includeHidden=this.includeGuidesInMinMax=this.integersOnly=!1;this.durationUnits={DD:"d. ",hh:":",mm:":",ss:""};this.scrollbar=!1;this.baseValue=
43
43
  0;this.radarCategoriesEnabled=!0;this.gridType="polygons";this.useScientificNotation=!1;this.axisTitleOffset=10;this.minMaxMultiplier=1;this.logGridLimit=2;AmCharts.applyTheme(this,a,this.cname)},updateData:function(){0>=this.gridCountR&&(this.gridCountR=1);this.totals=[];this.data=this.chart.chartData;var a=this.chart;"xy"!=a.type&&(this.stackGraphs("smoothedLine"),this.stackGraphs("line"),this.stackGraphs("column"),this.stackGraphs("step"));this.recalculateToPercents&&this.recalculate();this.synchronizationMultiplier&&
44
44
  this.synchronizeWith?(AmCharts.isString(this.synchronizeWith)&&(this.synchronizeWith=a.getValueAxisById(this.synchronizeWith)),this.synchronizeWith&&(this.synchronizeWithAxis(this.synchronizeWith),this.foundGraphs=!0)):(this.foundGraphs=!1,this.getMinMax())},draw:function(){AmCharts.ValueAxis.base.draw.call(this);var a=this.chart,b=this.set;"duration"==this.type&&(this.duration="ss");!0===this.dataChanged&&(this.updateData(),this.dataChanged=!1);if(this.logarithmic&&(0>=this.getMin(0,this.data.length-
@@ -75,41 +75,41 @@ B*Math.PI/180,pa,H=0,F=0,V=0,da=pa=0,ha=0;"V"==Na&&(B=0);var x;G&&(x=a.autoWrap&
75
75
  t+3,H-=da/2*Math.cos(Y)):F+=t+3:0<B?(F=-(da/2)*Math.sin(Y)-t-6,H+=da/2*Math.cos(Y)):F-=t+p+3+r+3),"bottom"==ga?pa=(M?U-t-1:U+r-1)+$:(V=ca,pa=(M?W:W-t-r+1)-$),f&&(H+=f),W=H,0<B&&(W+=da/2*Math.cos(Y)),x&&(ga=0,M&&(ga=da/2*Math.cos(Y)),W+ga>X+2||0>W))x.remove(),x=null}else{0<=b&&b<=U+1&&(0<t&&0<v&&b+k<=U+1&&(ra=AmCharts.line(s,[0,t],[b+k,b+k],u,v,y),q.push(ra)),0<w&&(P=AmCharts.line(s,[0,ca,X+ca],[b,b+W,b+W],E,w,y,z),q.push(P)));P="end";if(!0===M&&"left"==ga||!1===M&&"right"==ga)P="start";F=b-p/2;1==
76
76
  K&&0<I&&!g&&!l&&(d=AmCharts.fitToBounds(b,0,U),ma=AmCharts.fitToBounds(ma,0,U),Y=d-ma,fill=AmCharts.polygon(s,[0,a.width,a.width,0],[0,0,Y,Y],A,I),fill.translate(ca,d-Y+W),q.push(fill));F+=p/2;"right"==ga?(H+=ca+X+$,F+=W,M?(H-=t+4,f||(F-=p/2+3)):(H+=t+4+r,F-=2)):M?(H+=t+4-$,f||(F-=p/2+3),g&&(H+=ca,F+=W)):(H+=-t-r-4-2-$,F-=2);ra&&("right"==ga?(V+=ca+$+X,pa+=W,V=M?V-r:V+r):(V-=$,M||(V-=t+r)));f&&(F+=f);M=-3;"right"==ga&&(M+=W);x&&(F>U+1||F<M)&&(x.remove(),x=null)}ra&&ra.translate(V,pa);!1===a.visible&&
77
77
  (ra&&ra.remove(),x&&(x.remove(),x=null));x&&(x.attr({"text-anchor":P}),x.translate(H,F),0!==B&&x.rotate(-B,a.chart.backgroundColor),a.allLabels.push(x)," "!=c&&(this.label=x));l||(a.counter=0===K?1:0,a.previousCoord=b);0===this.set.node.childNodes.length&&this.set.remove()},graphics:function(){return this.set},getLabel:function(){return this.label}});AmCharts.RecFill=AmCharts.Class({construct:function(a,b,c,d){var e=a.dx,f=a.dy,g=a.orientation,h=0;if(c<b){var k=b;b=c;c=k}var l=d.fillAlpha;isNaN(l)&&(l=0);k=a.chart.container;d=d.fillColor;"V"==g?(b=AmCharts.fitToBounds(b,0,a.viH),c=AmCharts.fitToBounds(c,0,a.viH)):(b=AmCharts.fitToBounds(b,0,a.viW),c=AmCharts.fitToBounds(c,0,a.viW));c-=b;isNaN(c)&&(c=4,h=2,l=0);0>c&&"object"==typeof d&&(d=d.join(",").split(",").reverse());"V"==g?(a=AmCharts.rect(k,a.width,c,d,l),a.translate(e,b-h+f)):(a=AmCharts.rect(k,
78
- c,a.height,d,l),a.translate(b-h+e,f));this.set=k.set([a])},graphics:function(){return this.set},getLabel:function(){}});AmCharts.AmChart=AmCharts.Class({construct:function(a){this.theme=a;this.version="3.4.7";AmCharts.addChart(this);this.createEvents("dataUpdated","init","rendered","drawn");this.height=this.width="100%";this.dataChanged=!0;this.chartCreated=!1;this.previousWidth=this.previousHeight=0;this.backgroundColor="#FFFFFF";this.borderAlpha=this.backgroundAlpha=0;this.color=this.borderColor="#000000";this.fontFamily="Verdana";this.fontSize=11;this.usePrefixes=!1;this.precision=-1;this.percentPrecision=2;this.decimalSeparator=
78
+ c,a.height,d,l),a.translate(b-h+e,f));this.set=k.set([a])},graphics:function(){return this.set},getLabel:function(){}});AmCharts.AmChart=AmCharts.Class({construct:function(a){this.theme=a;this.version="3.4.8";AmCharts.addChart(this);this.createEvents("dataUpdated","init","rendered","drawn");this.height=this.width="100%";this.dataChanged=!0;this.chartCreated=!1;this.previousWidth=this.previousHeight=0;this.backgroundColor="#FFFFFF";this.borderAlpha=this.backgroundAlpha=0;this.color=this.borderColor="#000000";this.fontFamily="Verdana";this.fontSize=11;this.usePrefixes=!1;this.precision=-1;this.percentPrecision=2;this.decimalSeparator=
79
79
  ".";this.thousandsSeparator=",";this.labels=[];this.allLabels=[];this.titles=[];this.marginRight=this.marginLeft=this.autoMarginOffset=0;this.timeOuts=[];this.creditsPosition="top-left";var b=document.createElement("div"),c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.chartDiv=b;b=document.createElement("div");c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.legendDiv=b;this.titleHeight=0;this.hideBalloonTime=150;this.handDrawScatter=2;this.handDrawThickness=
80
80
  1;this.prefixesOfBigNumbers=[{number:1E3,prefix:"k"},{number:1E6,prefix:"M"},{number:1E9,prefix:"G"},{number:1E12,prefix:"T"},{number:1E15,prefix:"P"},{number:1E18,prefix:"E"},{number:1E21,prefix:"Z"},{number:1E24,prefix:"Y"}];this.prefixesOfSmallNumbers=[{number:1E-24,prefix:"y"},{number:1E-21,prefix:"z"},{number:1E-18,prefix:"a"},{number:1E-15,prefix:"f"},{number:1E-12,prefix:"p"},{number:1E-9,prefix:"n"},{number:1E-6,prefix:"\u03bc"},{number:0.001,prefix:"m"}];this.panEventsEnabled=!0;AmCharts.bezierX=
81
81
  3;AmCharts.bezierY=6;this.product="amcharts";this.animations=[];this.balloon=new AmCharts.AmBalloon(this.theme);this.balloon.chart=this;AmCharts.applyTheme(this,a,"AmChart")},drawChart:function(){this.drawBackground();this.redrawLabels();this.drawTitles();this.brr()},drawBackground:function(){AmCharts.remove(this.background);var a=this.container,b=this.backgroundColor,c=this.backgroundAlpha,d=this.set;AmCharts.isModern||0!==c||(c=0.001);var e=this.updateWidth();this.realWidth=e;var f=this.updateHeight();
82
- this.realHeight=f;this.background=b=AmCharts.polygon(a,[0,e-1,e-1,0],[0,0,f-1,f-1],b,c,1,this.borderColor,this.borderAlpha);d.push(b);if(b=this.backgroundImage)this.path&&(b=this.path+b),this.bgImg=a=a.image(b,0,0,e,f),d.push(a)},drawTitles:function(){var a=this.titles;if(AmCharts.ifArray(a)){var b=20,c;for(c=0;c<a.length;c++){var d=a[c],e=d.color;void 0===e&&(e=this.color);var f=d.size;isNaN(d.alpha);var g=this.marginLeft,e=AmCharts.text(this.container,d.text,e,this.fontFamily,f);e.translate(g+(this.realWidth-
83
- this.marginRight-g)/2,b);g=!0;void 0!==d.bold&&(g=d.bold);g&&e.attr({"font-weight":"bold"});e.attr({opacity:d.alpha});b+=f+6;this.freeLabelsSet.push(e)}}},write:function(a){a="object"!=typeof a?document.getElementById(a):a;a.innerHTML="";this.div=a;a.style.overflow="hidden";a.style.textAlign="left";var b=this.chartDiv,c=this.legendDiv,d=this.legend,e=c.style,f=b.style;this.measure();var g,h=document.createElement("div");g=h.style;g.position="relative";this.containerDiv=h;a.appendChild(h);var k=this.exportConfig;
84
- k&&AmCharts.AmExport&&!this.AmExport&&(this.AmExport=new AmCharts.AmExport(this,k));if(d)switch(d=this.addLegend(d,d.divId),d.position){case "bottom":h.appendChild(b);h.appendChild(c);break;case "top":h.appendChild(c);h.appendChild(b);break;case "absolute":g.width=a.style.width;g.height=a.style.height;e.position="absolute";f.position="absolute";void 0!==d.left&&(e.left=d.left+"px");void 0!==d.right&&(e.right=d.right+"px");void 0!==d.top&&(e.top=d.top+"px");void 0!==d.bottom&&(e.bottom=d.bottom+"px");
85
- d.marginLeft=0;d.marginRight=0;h.appendChild(b);h.appendChild(c);break;case "right":g.width=a.style.width;g.height=a.style.height;e.position="relative";f.position="absolute";h.appendChild(b);h.appendChild(c);break;case "left":g.width=a.style.width;g.height=a.style.height;e.position="absolute";f.position="relative";h.appendChild(b);h.appendChild(c);break;case "outside":h.appendChild(b)}else h.appendChild(b);this.listenersAdded||(this.addListeners(),this.listenersAdded=!0);this.initChart()},createLabelsSet:function(){AmCharts.remove(this.labelsSet);
86
- this.labelsSet=this.container.set();this.freeLabelsSet.push(this.labelsSet)},initChart:function(){var a=this.numberFormatter;a&&(isNaN(a.precision)||(this.precision=a.precision),void 0!==a.thousandsSeparator&&(this.thousandsSeparator=a.thousandsSeparator),void 0!==a.decimalSeparator&&(this.decimalSeparator=a.decimalSeparator));(a=this.percentFormatter)&&!isNaN(a.precision)&&(this.percentPrecision=a.precision);this.nf={precision:this.precision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};
87
- this.pf={precision:this.percentPrecision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};this.divIsFixed=AmCharts.findIfFixed(this.chartDiv);this.previousHeight=this.divRealHeight;this.previousWidth=this.divRealWidth;this.destroy();this.startInterval();a=0;document.attachEvent&&!window.opera&&(a=1);this.dmouseX=this.dmouseY=0;var b=document.getElementsByTagName("html")[0];b&&window.getComputedStyle&&(b=window.getComputedStyle(b,null))&&(this.dmouseY=AmCharts.removePx(b.getPropertyValue("margin-top")),
88
- this.dmouseX=AmCharts.removePx(b.getPropertyValue("margin-left")));this.mouseMode=a;a=new AmCharts.AmDraw(this.chartDiv,this.realWidth,this.realHeight,this);a.handDrawn=this.handDrawn;a.handDrawScatter=this.handDrawScatter;a.handDrawThickness=this.handDrawThickness;this.container=a;if(AmCharts.VML||AmCharts.SVG)a=this.container,this.set=a.set(),this.gridSet=a.set(),this.cursorLineSet=a.set(),this.graphsBehindSet=a.set(),this.bulletBehindSet=a.set(),this.columnSet=a.set(),this.graphsSet=a.set(),this.trendLinesSet=
89
- a.set(),this.axesLabelsSet=a.set(),this.axesSet=a.set(),this.cursorSet=a.set(),this.scrollbarsSet=a.set(),this.bulletSet=a.set(),this.freeLabelsSet=a.set(),this.balloonsSet=a.set(),this.balloonsSet.setAttr("id","balloons"),this.zoomButtonSet=a.set(),this.linkSet=a.set(),this.renderFix()},measure:function(){var a=this.div,b=this.chartDiv,c=a.offsetWidth,d=a.offsetHeight,e=this.container;a.clientHeight&&(c=a.clientWidth,d=a.clientHeight);var f=AmCharts.removePx(AmCharts.getStyle(a,"padding-left")),
90
- g=AmCharts.removePx(AmCharts.getStyle(a,"padding-right")),h=AmCharts.removePx(AmCharts.getStyle(a,"padding-top")),k=AmCharts.removePx(AmCharts.getStyle(a,"padding-bottom"));isNaN(f)||(c-=f);isNaN(g)||(c-=g);isNaN(h)||(d-=h);isNaN(k)||(d-=k);f=a.style;a=f.width;f=f.height;-1!=a.indexOf("px")&&(c=AmCharts.removePx(a));-1!=f.indexOf("px")&&(d=AmCharts.removePx(f));a=AmCharts.toCoordinate(this.width,c);f=AmCharts.toCoordinate(this.height,d);this.balloon=AmCharts.processObject(this.balloon,AmCharts.AmBalloon,
91
- this.theme);this.balloon.chart=this;if(a!=this.previousWidth||f!=this.previousHeight)b.style.width=a+"px",b.style.height=f+"px",e&&e.setSize(a,f);this.balloon.setBounds(2,2,a-2,f);this.realWidth=a;this.realHeight=f;this.divRealWidth=c;this.divRealHeight=d},destroy:function(){this.chartDiv.innerHTML="";this.clearTimeOuts();this.interval&&clearInterval(this.interval);this.interval=NaN},clearTimeOuts:function(){var a=this.timeOuts;if(a){var b;for(b=0;b<a.length;b++)clearTimeout(a[b])}this.timeOuts=[]},
92
- clear:function(a){AmCharts.callMethod("clear",[this.chartScrollbar,this.scrollbarV,this.scrollbarH,this.chartCursor]);this.chartCursor=this.scrollbarH=this.scrollbarV=this.chartScrollbar=null;this.clearTimeOuts();this.container&&(this.container.remove(this.chartDiv),this.container.remove(this.legendDiv));a||AmCharts.removeChart(this)},setMouseCursor:function(a){"auto"==a&&AmCharts.isNN&&(a="default");this.chartDiv.style.cursor=a;this.legendDiv.style.cursor=a},redrawLabels:function(){this.labels=[];
93
- var a=this.allLabels;this.createLabelsSet();var b;for(b=0;b<a.length;b++)this.drawLabel(a[b])},drawLabel:function(a){if(this.container){var b=a.y,c=a.text,d=a.align,e=a.size,f=a.color,g=a.rotation,h=a.alpha,k=a.bold,l=AmCharts.toCoordinate(a.x,this.realWidth),b=AmCharts.toCoordinate(b,this.realHeight);l||(l=0);b||(b=0);void 0===f&&(f=this.color);isNaN(e)&&(e=this.fontSize);d||(d="start");"left"==d&&(d="start");"right"==d&&(d="end");"center"==d&&(d="middle",g?b=this.realHeight-b+b/2:l=this.realWidth/
94
- 2-l);void 0===h&&(h=1);void 0===g&&(g=0);b+=e/2;c=AmCharts.text(this.container,c,f,this.fontFamily,e,d,k,h);c.translate(l,b);0!==g&&c.rotate(g);a.url&&(c.setAttr("cursor","pointer"),c.click(function(){AmCharts.getURL(a.url)}));this.labelsSet.push(c);this.labels.push(c)}},addLabel:function(a,b,c,d,e,f,g,h,k,l){a={x:a,y:b,text:c,align:d,size:e,color:f,alpha:h,rotation:g,bold:k,url:l};this.container&&this.drawLabel(a);this.allLabels.push(a)},clearLabels:function(){var a=this.labels,b;for(b=a.length-
95
- 1;0<=b;b--)a[b].remove();this.labels=[];this.allLabels=[]},updateHeight:function(){var a=this.divRealHeight,b=this.legend;if(b){var c=this.legendDiv.offsetHeight,b=b.position;if("top"==b||"bottom"==b){a-=c;if(0>a||isNaN(a))a=0;this.chartDiv.style.height=a+"px"}}return a},updateWidth:function(){var a=this.divRealWidth,b=this.divRealHeight,c=this.legend;if(c){var d=this.legendDiv,e=d.offsetWidth;isNaN(c.width)||(e=c.width);var f=d.offsetHeight,d=d.style,g=this.chartDiv.style,c=c.position;if("right"==
96
- c||"left"==c){a-=e;if(0>a||isNaN(a))a=0;g.width=a+"px";"left"==c?g.left=e+"px":d.left=a+"px";d.top=(b-f)/2+"px"}}return a},getTitleHeight:function(){var a=0,b=this.titles;if(0<b.length){var a=15,c;for(c=0;c<b.length;c++)a+=b[c].size+6}return a},addTitle:function(a,b,c,d,e){isNaN(b)&&(b=this.fontSize+2);a={text:a,size:b,color:c,alpha:d,bold:e};this.titles.push(a);return a},addMouseWheel:function(){var a=this;window.addEventListener&&(window.addEventListener("DOMMouseScroll",function(b){a.handleWheel.call(a,
97
- b)},!1),document.addEventListener("mousewheel",function(b){a.handleWheel.call(a,b)},!1))},handleWheel:function(a){if(this.mouseIsOver){var b=0;a||(a=window.event);a.wheelDelta?b=a.wheelDelta/120:a.detail&&(b=-a.detail/3);b&&this.handleWheelReal(b,a.shiftKey);a.preventDefault&&a.preventDefault()}},handleWheelReal:function(a){},addListeners:function(){var a=this,b=a.chartDiv;document.addEventListener?(a.panEventsEnabled&&"ontouchstart"in document.documentElement&&(b.addEventListener("touchstart",function(b){a.handleTouchMove.call(a,
98
- b);a.handleTouchStart.call(a,b)},!0),b.addEventListener("touchmove",function(b){a.handleTouchMove.call(a,b)},!0),b.addEventListener("touchend",function(b){a.handleTouchEnd.call(a,b)},!0)),b.addEventListener("mousedown",function(b){a.handleMouseDown.call(a,b)},!0),b.addEventListener("mouseover",function(b){a.handleMouseOver.call(a,b)},!0),b.addEventListener("mouseout",function(b){a.handleMouseOut.call(a,b)},!0)):(b.attachEvent("onmousedown",function(b){a.handleMouseDown.call(a,b)}),b.attachEvent("onmouseover",
99
- function(b){a.handleMouseOver.call(a,b)}),b.attachEvent("onmouseout",function(b){a.handleMouseOut.call(a,b)}))},dispDUpd:function(){var a;this.dispatchDataUpdated&&(this.dispatchDataUpdated=!1,a="dataUpdated",this.fire(a,{type:a,chart:this}));this.chartCreated||(a="init",this.fire(a,{type:a,chart:this}));this.chartRendered||(a="rendered",this.fire(a,{type:a,chart:this}),this.chartRendered=!0);a="drawn";this.fire(a,{type:a,chart:this})},validateSize:function(){var a=this;a.measure();var b=a.legend;
100
- if((a.realWidth!=a.previousWidth||a.realHeight!=a.previousHeight)&&0<a.realWidth&&0<a.realHeight){a.sizeChanged=!0;if(b){clearTimeout(a.legendInitTO);var c=setTimeout(function(){b.invalidateSize()},100);a.timeOuts.push(c);a.legendInitTO=c}a.marginsUpdated="xy"!=a.type?!1:!0;clearTimeout(a.initTO);c=setTimeout(function(){a.initChart()},150);a.timeOuts.push(c);a.initTO=c}a.renderFix();b&&b.renderFix()},invalidateSize:function(){this.previousHeight=this.previousWidth=NaN;this.invalidateSizeReal()},invalidateSizeReal:function(){var a=
101
- this;a.marginsUpdated=!1;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateSize()},5);a.timeOuts.push(b);a.validateTO=b},validateData:function(a){this.chartCreated&&(this.dataChanged=!0,this.marginsUpdated="xy"!=this.type?!1:!0,this.initChart(a))},validateNow:function(){this.chartRendered=this.listenersAdded=!1;this.write(this.div)},showItem:function(a){a.hidden=!1;this.initChart()},hideItem:function(a){a.hidden=!0;this.initChart()},hideBalloon:function(){var a=this;clearInterval(a.hoverInt);
102
- clearTimeout(a.balloonTO);a.hoverInt=setTimeout(function(){a.hideBalloonReal.call(a)},a.hideBalloonTime)},cleanChart:function(){},hideBalloonReal:function(){var a=this.balloon;a&&a.hide()},showBalloon:function(a,b,c,d,e){var f=this;clearTimeout(f.balloonTO);clearInterval(f.hoverInt);f.balloonTO=setTimeout(function(){f.showBalloonReal.call(f,a,b,c,d,e)},1)},showBalloonReal:function(a,b,c,d,e){this.handleMouseMove();var f=this.balloon;f.enabled&&(f.followCursor(!1),f.changeColor(b),!c||f.fixedPosition?
103
- (f.setPosition(d,e),f.followCursor(!1)):f.followCursor(!0),a&&f.showBalloon(a))},handleTouchMove:function(a){this.hideBalloon();var b=this.chartDiv;a.touches&&(a=a.touches.item(0),this.mouseX=a.pageX-AmCharts.findPosX(b),this.mouseY=a.pageY-AmCharts.findPosY(b))},handleMouseOver:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!0},handleMouseOut:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!1},handleMouseMove:function(a){if(this.mouseIsOver){var b=this.chartDiv;a||(a=window.event);
104
- var c,d;if(a){this.posX=AmCharts.findPosX(b);this.posY=AmCharts.findPosY(b);switch(this.mouseMode){case 1:c=a.clientX-this.posX;d=a.clientY-this.posY;if(!this.divIsFixed){var b=document.body,e,f;b&&(e=b.scrollLeft,y1=b.scrollTop);if(b=document.documentElement)f=b.scrollLeft,y2=b.scrollTop;e=Math.max(e,f);f=Math.max(y1,y2);c+=e;d+=f}break;case 0:this.divIsFixed?(c=a.clientX-this.posX,d=a.clientY-this.posY):(c=a.pageX-this.posX,d=a.pageY-this.posY)}a.touches&&(a=a.touches.item(0),c=a.pageX-this.posX,
105
- d=a.pageY-this.posY);this.mouseX=c-this.dmouseX;this.mouseY=d-this.dmouseY}}},handleTouchStart:function(a){this.handleMouseDown(a)},handleTouchEnd:function(a){AmCharts.resetMouseOver();this.handleReleaseOutside(a)},handleReleaseOutside:function(a){},handleMouseDown:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!0;a&&a.preventDefault&&a.preventDefault()},addLegend:function(a,b){a=AmCharts.processObject(a,AmCharts.AmLegend,this.theme);a.divId=b;var c;c="object"!=typeof b&&b?document.getElementById(b):
106
- b;this.legend=a;a.chart=this;c?(a.div=c,a.position="outside",a.autoMargins=!1):a.div=this.legendDiv;c=this.handleLegendEvent;this.listenTo(a,"showItem",c);this.listenTo(a,"hideItem",c);this.listenTo(a,"clickMarker",c);this.listenTo(a,"rollOverItem",c);this.listenTo(a,"rollOutItem",c);this.listenTo(a,"rollOverMarker",c);this.listenTo(a,"rollOutMarker",c);this.listenTo(a,"clickLabel",c);return a},removeLegend:function(){this.legend=void 0;this.legendDiv.innerHTML=""},handleResize:function(){(AmCharts.isPercents(this.width)||
107
- AmCharts.isPercents(this.height))&&this.invalidateSizeReal();this.renderFix()},renderFix:function(){if(!AmCharts.VML){var a=this.container;a&&a.renderFix()}},getSVG:function(){if(AmCharts.hasSVG)return this.container},animate:function(a,b,c,d,e,f,g){a["an_"+b]&&AmCharts.removeFromArray(this.animations,a["an_"+b]);c={obj:a,frame:0,attribute:b,from:c,to:d,time:e,effect:f,suffix:g};a["an_"+b]=c;this.animations.push(c);return c},setLegendData:function(a){var b=this.legend;b&&b.setData(a)},startInterval:function(){var a=
108
- this;clearInterval(a.interval);a.interval=setInterval(function(){a.updateAnimations.call(a)},AmCharts.updateRate)},stopAnim:function(a){AmCharts.removeFromArray(this.animations,a)},updateAnimations:function(){var a;this.container&&this.container.update();for(a=this.animations.length-1;0<=a;a--){var b=this.animations[a],c=1E3*b.time/AmCharts.updateRate,d=b.frame+1,e=b.obj,f=b.attribute;if(d<=c){b.frame++;var g=Number(b.from),h=Number(b.to)-g,c=AmCharts[b.effect](0,d,g,h,c);0===h?this.animations.splice(a,
109
- 1):e.node.style[f]=c+b.suffix}else e.node.style[f]=Number(b.to)+b.suffix,this.animations.splice(a,1)}},brr:function(){var a=window.location.hostname.split("."),b;2<=a.length&&(b=a[a.length-2]+"."+a[a.length-1]);this.amLink&&(a=this.amLink.parentNode)&&a.removeChild(this.amLink);a=this.creditsPosition;if("amcharts.com"!=b){var c=b=0,d=this.realWidth,e=this.realHeight;if("serial"==this.type||"xy"==this.type)b=this.marginLeftReal,c=this.marginTopReal,d=b+this.plotAreaWidth,e=c+this.plotAreaHeight;var f=
110
- "http://www.amcharts.com/javascript-charts/",g="JavaScript charts",h="JS chart by amCharts";"ammap"==this.product&&(f="http://www.ammap.com/javascript-maps/",g="Interactive JavaScript maps",h="JS map by amCharts");var k=document.createElement("a"),h=document.createTextNode(h);k.setAttribute("href",f);k.setAttribute("title",g);k.appendChild(h);this.chartDiv.appendChild(k);this.amLink=k;f=k.style;f.position="absolute";f.textDecoration="none";f.color=this.color;f.fontFamily=this.fontFamily;f.fontSize=
111
- this.fontSize+"px";f.opacity=0.7;f.display="block";var g=k.offsetWidth,k=k.offsetHeight,h=5+b,l=c+5;"bottom-left"==a&&(h=5+b,l=e-k-3);"bottom-right"==a&&(h=d-g-5,l=e-k-3);"top-right"==a&&(h=d-g-5,l=c+5);f.left=h+"px";f.top=l+"px"}}});AmCharts.Slice=AmCharts.Class({construct:function(){}});AmCharts.SerialDataItem=AmCharts.Class({construct:function(){}});AmCharts.GraphDataItem=AmCharts.Class({construct:function(){}});
112
- AmCharts.Guide=AmCharts.Class({construct:function(a){this.cname="Guide";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.AmGraph=AmCharts.Class({construct:function(a){this.cname="AmGraph";this.createEvents("rollOverGraphItem","rollOutGraphItem","clickGraphItem","doubleClickGraphItem","rightClickGraphItem","clickGraph","rollOverGraph","rollOutGraph");this.type="line";this.stackable=!0;this.columnCount=1;this.columnIndex=0;this.centerCustomBullets=this.showBalloon=!0;this.maxBulletSize=50;this.minBulletSize=4;this.balloonText="[[value]]";this.hidden=this.scrollbar=this.animationPlayed=!1;this.pointPosition="middle";
82
+ this.realHeight=f;this.background=b=AmCharts.polygon(a,[0,e-1,e-1,0],[0,0,f-1,f-1],b,c,1,this.borderColor,this.borderAlpha);d.push(b);if(b=this.backgroundImage)this.path&&(b=this.path+b),this.bgImg=a=a.image(b,0,0,e,f),d.push(a)},drawTitles:function(){var a=this.titles;if(AmCharts.ifArray(a)){var b=20,c;for(c=0;c<a.length;c++){var d=a[c],e=d.color;void 0===e&&(e=this.color);var f=d.size;isNaN(f)&&(f=this.fontSize+2);isNaN(d.alpha);var g=this.marginLeft,e=AmCharts.text(this.container,d.text,e,this.fontFamily,
83
+ f);e.translate(g+(this.realWidth-this.marginRight-g)/2,b);g=!0;void 0!==d.bold&&(g=d.bold);g&&e.attr({"font-weight":"bold"});e.attr({opacity:d.alpha});b+=f+6;this.freeLabelsSet.push(e)}}},write:function(a){a="object"!=typeof a?document.getElementById(a):a;a.innerHTML="";this.div=a;a.style.overflow="hidden";a.style.textAlign="left";var b=this.chartDiv,c=this.legendDiv,d=this.legend,e=c.style,f=b.style;this.measure();var g,h=document.createElement("div");g=h.style;g.position="relative";this.containerDiv=
84
+ h;a.appendChild(h);var k=this.exportConfig;k&&AmCharts.AmExport&&!this.AmExport&&(this.AmExport=new AmCharts.AmExport(this,k));if(d)switch(d=this.addLegend(d,d.divId),d.position){case "bottom":h.appendChild(b);h.appendChild(c);break;case "top":h.appendChild(c);h.appendChild(b);break;case "absolute":g.width=a.style.width;g.height=a.style.height;e.position="absolute";f.position="absolute";void 0!==d.left&&(e.left=d.left+"px");void 0!==d.right&&(e.right=d.right+"px");void 0!==d.top&&(e.top=d.top+"px");
85
+ void 0!==d.bottom&&(e.bottom=d.bottom+"px");d.marginLeft=0;d.marginRight=0;h.appendChild(b);h.appendChild(c);break;case "right":g.width=a.style.width;g.height=a.style.height;e.position="relative";f.position="absolute";h.appendChild(b);h.appendChild(c);break;case "left":g.width=a.style.width;g.height=a.style.height;e.position="absolute";f.position="relative";h.appendChild(b);h.appendChild(c);break;case "outside":h.appendChild(b)}else h.appendChild(b);this.listenersAdded||(this.addListeners(),this.listenersAdded=
86
+ !0);this.initChart()},createLabelsSet:function(){AmCharts.remove(this.labelsSet);this.labelsSet=this.container.set();this.freeLabelsSet.push(this.labelsSet)},initChart:function(){var a=this.numberFormatter;a&&(isNaN(a.precision)||(this.precision=a.precision),void 0!==a.thousandsSeparator&&(this.thousandsSeparator=a.thousandsSeparator),void 0!==a.decimalSeparator&&(this.decimalSeparator=a.decimalSeparator));(a=this.percentFormatter)&&!isNaN(a.precision)&&(this.percentPrecision=a.precision);this.nf=
87
+ {precision:this.precision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};this.pf={precision:this.percentPrecision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};this.divIsFixed=AmCharts.findIfFixed(this.chartDiv);this.previousHeight=this.divRealHeight;this.previousWidth=this.divRealWidth;this.destroy();this.startInterval();a=0;document.attachEvent&&!window.opera&&(a=1);this.dmouseX=this.dmouseY=0;var b=document.getElementsByTagName("html")[0];
88
+ b&&window.getComputedStyle&&(b=window.getComputedStyle(b,null))&&(this.dmouseY=AmCharts.removePx(b.getPropertyValue("margin-top")),this.dmouseX=AmCharts.removePx(b.getPropertyValue("margin-left")));this.mouseMode=a;a=new AmCharts.AmDraw(this.chartDiv,this.realWidth,this.realHeight,this);a.handDrawn=this.handDrawn;a.handDrawScatter=this.handDrawScatter;a.handDrawThickness=this.handDrawThickness;this.container=a;if(AmCharts.VML||AmCharts.SVG)a=this.container,this.set=a.set(),this.gridSet=a.set(),this.cursorLineSet=
89
+ a.set(),this.graphsBehindSet=a.set(),this.bulletBehindSet=a.set(),this.columnSet=a.set(),this.graphsSet=a.set(),this.trendLinesSet=a.set(),this.axesLabelsSet=a.set(),this.axesSet=a.set(),this.cursorSet=a.set(),this.scrollbarsSet=a.set(),this.bulletSet=a.set(),this.freeLabelsSet=a.set(),this.balloonsSet=a.set(),this.balloonsSet.setAttr("id","balloons"),this.zoomButtonSet=a.set(),this.linkSet=a.set(),this.renderFix()},measure:function(){var a=this.div,b=this.chartDiv,c=a.offsetWidth,d=a.offsetHeight,
90
+ e=this.container;a.clientHeight&&(c=a.clientWidth,d=a.clientHeight);var f=AmCharts.removePx(AmCharts.getStyle(a,"padding-left")),g=AmCharts.removePx(AmCharts.getStyle(a,"padding-right")),h=AmCharts.removePx(AmCharts.getStyle(a,"padding-top")),k=AmCharts.removePx(AmCharts.getStyle(a,"padding-bottom"));isNaN(f)||(c-=f);isNaN(g)||(c-=g);isNaN(h)||(d-=h);isNaN(k)||(d-=k);f=a.style;a=f.width;f=f.height;-1!=a.indexOf("px")&&(c=AmCharts.removePx(a));-1!=f.indexOf("px")&&(d=AmCharts.removePx(f));a=AmCharts.toCoordinate(this.width,
91
+ c);f=AmCharts.toCoordinate(this.height,d);this.balloon=AmCharts.processObject(this.balloon,AmCharts.AmBalloon,this.theme);this.balloon.chart=this;if(a!=this.previousWidth||f!=this.previousHeight)b.style.width=a+"px",b.style.height=f+"px",e&&e.setSize(a,f);this.balloon.setBounds(2,2,a-2,f);this.realWidth=a;this.realHeight=f;this.divRealWidth=c;this.divRealHeight=d},destroy:function(){this.chartDiv.innerHTML="";this.clearTimeOuts();this.interval&&clearInterval(this.interval);this.interval=NaN},clearTimeOuts:function(){var a=
92
+ this.timeOuts;if(a){var b;for(b=0;b<a.length;b++)clearTimeout(a[b])}this.timeOuts=[]},clear:function(a){AmCharts.callMethod("clear",[this.chartScrollbar,this.scrollbarV,this.scrollbarH,this.chartCursor]);this.chartCursor=this.scrollbarH=this.scrollbarV=this.chartScrollbar=null;this.clearTimeOuts();this.interval&&clearInterval(this.interval);this.container&&(this.container.remove(this.chartDiv),this.container.remove(this.legendDiv));a||AmCharts.removeChart(this)},setMouseCursor:function(a){"auto"==
93
+ a&&AmCharts.isNN&&(a="default");this.chartDiv.style.cursor=a;this.legendDiv.style.cursor=a},redrawLabels:function(){this.labels=[];var a=this.allLabels;this.createLabelsSet();var b;for(b=0;b<a.length;b++)this.drawLabel(a[b])},drawLabel:function(a){if(this.container){var b=a.y,c=a.text,d=a.align,e=a.size,f=a.color,g=a.rotation,h=a.alpha,k=a.bold,l=AmCharts.toCoordinate(a.x,this.realWidth),b=AmCharts.toCoordinate(b,this.realHeight);l||(l=0);b||(b=0);void 0===f&&(f=this.color);isNaN(e)&&(e=this.fontSize);
94
+ d||(d="start");"left"==d&&(d="start");"right"==d&&(d="end");"center"==d&&(d="middle",g?b=this.realHeight-b+b/2:l=this.realWidth/2-l);void 0===h&&(h=1);void 0===g&&(g=0);b+=e/2;c=AmCharts.text(this.container,c,f,this.fontFamily,e,d,k,h);c.translate(l,b);0!==g&&c.rotate(g);a.url&&(c.setAttr("cursor","pointer"),c.click(function(){AmCharts.getURL(a.url)}));this.labelsSet.push(c);this.labels.push(c)}},addLabel:function(a,b,c,d,e,f,g,h,k,l){a={x:a,y:b,text:c,align:d,size:e,color:f,alpha:h,rotation:g,bold:k,
95
+ url:l};this.container&&this.drawLabel(a);this.allLabels.push(a)},clearLabels:function(){var a=this.labels,b;for(b=a.length-1;0<=b;b--)a[b].remove();this.labels=[];this.allLabels=[]},updateHeight:function(){var a=this.divRealHeight,b=this.legend;if(b){var c=this.legendDiv.offsetHeight,b=b.position;if("top"==b||"bottom"==b){a-=c;if(0>a||isNaN(a))a=0;this.chartDiv.style.height=a+"px"}}return a},updateWidth:function(){var a=this.divRealWidth,b=this.divRealHeight,c=this.legend;if(c){var d=this.legendDiv,
96
+ e=d.offsetWidth;isNaN(c.width)||(e=c.width);var f=d.offsetHeight,d=d.style,g=this.chartDiv.style,c=c.position;if("right"==c||"left"==c){a-=e;if(0>a||isNaN(a))a=0;g.width=a+"px";"left"==c?g.left=e+"px":d.left=a+"px";d.top=(b-f)/2+"px"}}return a},getTitleHeight:function(){var a=0,b=this.titles;if(0<b.length){var a=15,c;for(c=0;c<b.length;c++){var d=b[c].size;isNaN(d)&&(d=this.fontSize+2);a+=d+6}}return a},addTitle:function(a,b,c,d,e){isNaN(b)&&(b=this.fontSize+2);a={text:a,size:b,color:c,alpha:d,bold:e};
97
+ this.titles.push(a);return a},addMouseWheel:function(){var a=this;window.addEventListener&&(window.addEventListener("DOMMouseScroll",function(b){a.handleWheel.call(a,b)},!1),document.addEventListener("mousewheel",function(b){a.handleWheel.call(a,b)},!1))},handleWheel:function(a){if(this.mouseIsOver){var b=0;a||(a=window.event);a.wheelDelta?b=a.wheelDelta/120:a.detail&&(b=-a.detail/3);b&&this.handleWheelReal(b,a.shiftKey);a.preventDefault&&a.preventDefault()}},handleWheelReal:function(a){},addListeners:function(){var a=
98
+ this,b=a.chartDiv;document.addEventListener?(a.panEventsEnabled&&"ontouchstart"in document.documentElement&&(b.addEventListener("touchstart",function(b){a.handleTouchMove.call(a,b);a.handleTouchStart.call(a,b)},!0),b.addEventListener("touchmove",function(b){a.handleTouchMove.call(a,b)},!0),b.addEventListener("touchend",function(b){a.handleTouchEnd.call(a,b)},!0)),b.addEventListener("mousedown",function(b){a.handleMouseDown.call(a,b)},!0),b.addEventListener("mouseover",function(b){a.handleMouseOver.call(a,
99
+ b)},!0),b.addEventListener("mouseout",function(b){a.handleMouseOut.call(a,b)},!0)):(b.attachEvent("onmousedown",function(b){a.handleMouseDown.call(a,b)}),b.attachEvent("onmouseover",function(b){a.handleMouseOver.call(a,b)}),b.attachEvent("onmouseout",function(b){a.handleMouseOut.call(a,b)}))},dispDUpd:function(){var a;this.dispatchDataUpdated&&(this.dispatchDataUpdated=!1,a="dataUpdated",this.fire(a,{type:a,chart:this}));this.chartCreated||(a="init",this.fire(a,{type:a,chart:this}));this.chartRendered||
100
+ (a="rendered",this.fire(a,{type:a,chart:this}),this.chartRendered=!0);a="drawn";this.fire(a,{type:a,chart:this})},validateSize:function(){var a=this;a.measure();var b=a.legend;if((a.realWidth!=a.previousWidth||a.realHeight!=a.previousHeight)&&0<a.realWidth&&0<a.realHeight){a.sizeChanged=!0;if(b){clearTimeout(a.legendInitTO);var c=setTimeout(function(){b.invalidateSize()},100);a.timeOuts.push(c);a.legendInitTO=c}a.marginsUpdated="xy"!=a.type?!1:!0;clearTimeout(a.initTO);c=setTimeout(function(){a.initChart()},
101
+ 150);a.timeOuts.push(c);a.initTO=c}a.renderFix();b&&b.renderFix()},invalidateSize:function(){this.previousHeight=this.previousWidth=NaN;this.invalidateSizeReal()},invalidateSizeReal:function(){var a=this;a.marginsUpdated=!1;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateSize()},5);a.timeOuts.push(b);a.validateTO=b},validateData:function(a){this.chartCreated&&(this.dataChanged=!0,this.marginsUpdated="xy"!=this.type?!1:!0,this.initChart(a))},validateNow:function(){this.chartRendered=
102
+ this.listenersAdded=!1;this.write(this.div)},showItem:function(a){a.hidden=!1;this.initChart()},hideItem:function(a){a.hidden=!0;this.initChart()},hideBalloon:function(){var a=this;clearInterval(a.hoverInt);clearTimeout(a.balloonTO);a.hoverInt=setTimeout(function(){a.hideBalloonReal.call(a)},a.hideBalloonTime)},cleanChart:function(){},hideBalloonReal:function(){var a=this.balloon;a&&a.hide()},showBalloon:function(a,b,c,d,e){var f=this;clearTimeout(f.balloonTO);clearInterval(f.hoverInt);f.balloonTO=
103
+ setTimeout(function(){f.showBalloonReal.call(f,a,b,c,d,e)},1)},showBalloonReal:function(a,b,c,d,e){this.handleMouseMove();var f=this.balloon;f.enabled&&(f.followCursor(!1),f.changeColor(b),!c||f.fixedPosition?(f.setPosition(d,e),f.followCursor(!1)):f.followCursor(!0),a&&f.showBalloon(a))},handleTouchMove:function(a){this.hideBalloon();var b=this.chartDiv;a.touches&&(a=a.touches.item(0),this.mouseX=a.pageX-AmCharts.findPosX(b),this.mouseY=a.pageY-AmCharts.findPosY(b))},handleMouseOver:function(a){AmCharts.resetMouseOver();
104
+ this.mouseIsOver=!0},handleMouseOut:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!1},handleMouseMove:function(a){if(this.mouseIsOver){var b=this.chartDiv;a||(a=window.event);var c,d;if(a){this.posX=AmCharts.findPosX(b);this.posY=AmCharts.findPosY(b);switch(this.mouseMode){case 1:c=a.clientX-this.posX;d=a.clientY-this.posY;if(!this.divIsFixed){var b=document.body,e,f;b&&(e=b.scrollLeft,y1=b.scrollTop);if(b=document.documentElement)f=b.scrollLeft,y2=b.scrollTop;e=Math.max(e,f);f=Math.max(y1,
105
+ y2);c+=e;d+=f}break;case 0:this.divIsFixed?(c=a.clientX-this.posX,d=a.clientY-this.posY):(c=a.pageX-this.posX,d=a.pageY-this.posY)}a.touches&&(a=a.touches.item(0),c=a.pageX-this.posX,d=a.pageY-this.posY);this.mouseX=c-this.dmouseX;this.mouseY=d-this.dmouseY}}},handleTouchStart:function(a){this.handleMouseDown(a)},handleTouchEnd:function(a){AmCharts.resetMouseOver();this.handleReleaseOutside(a)},handleReleaseOutside:function(a){},handleMouseDown:function(a){AmCharts.resetMouseOver();this.mouseIsOver=
106
+ !0;a&&a.preventDefault&&a.preventDefault()},addLegend:function(a,b){a=AmCharts.processObject(a,AmCharts.AmLegend,this.theme);a.divId=b;var c;c="object"!=typeof b&&b?document.getElementById(b):b;this.legend=a;a.chart=this;c?(a.div=c,a.position="outside",a.autoMargins=!1):a.div=this.legendDiv;c=this.handleLegendEvent;this.listenTo(a,"showItem",c);this.listenTo(a,"hideItem",c);this.listenTo(a,"clickMarker",c);this.listenTo(a,"rollOverItem",c);this.listenTo(a,"rollOutItem",c);this.listenTo(a,"rollOverMarker",
107
+ c);this.listenTo(a,"rollOutMarker",c);this.listenTo(a,"clickLabel",c);return a},removeLegend:function(){this.legend=void 0;this.legendDiv.innerHTML=""},handleResize:function(){(AmCharts.isPercents(this.width)||AmCharts.isPercents(this.height))&&this.invalidateSizeReal();this.renderFix()},renderFix:function(){if(!AmCharts.VML){var a=this.container;a&&a.renderFix()}},getSVG:function(){if(AmCharts.hasSVG)return this.container},animate:function(a,b,c,d,e,f,g){a["an_"+b]&&AmCharts.removeFromArray(this.animations,
108
+ a["an_"+b]);c={obj:a,frame:0,attribute:b,from:c,to:d,time:e,effect:f,suffix:g};a["an_"+b]=c;this.animations.push(c);return c},setLegendData:function(a){var b=this.legend;b&&b.setData(a)},startInterval:function(){var a=this;clearInterval(a.interval);a.interval=setInterval(function(){a.updateAnimations.call(a)},AmCharts.updateRate)},stopAnim:function(a){AmCharts.removeFromArray(this.animations,a)},updateAnimations:function(){var a;this.container&&this.container.update();for(a=this.animations.length-
109
+ 1;0<=a;a--){var b=this.animations[a],c=1E3*b.time/AmCharts.updateRate,d=b.frame+1,e=b.obj,f=b.attribute;if(d<=c){b.frame++;var g=Number(b.from),h=Number(b.to)-g,c=AmCharts[b.effect](0,d,g,h,c);0===h?this.animations.splice(a,1):e.node.style[f]=c+b.suffix}else e.node.style[f]=Number(b.to)+b.suffix,this.animations.splice(a,1)}},brr:function(){var a=window.location.hostname.split("."),b;2<=a.length&&(b=a[a.length-2]+"."+a[a.length-1]);this.amLink&&(a=this.amLink.parentNode)&&a.removeChild(this.amLink);
110
+ a=this.creditsPosition;if("amcharts.com"!=b){var c=b=0,d=this.realWidth,e=this.realHeight;if("serial"==this.type||"xy"==this.type)b=this.marginLeftReal,c=this.marginTopReal,d=b+this.plotAreaWidth,e=c+this.plotAreaHeight;var f="http://www.amcharts.com/javascript-charts/",g="JavaScript charts",h="JS chart by amCharts";"ammap"==this.product&&(f="http://www.ammap.com/javascript-maps/",g="Interactive JavaScript maps",h="JS map by amCharts");var k=document.createElement("a"),h=document.createTextNode(h);
111
+ k.setAttribute("href",f);k.setAttribute("title",g);k.appendChild(h);this.chartDiv.appendChild(k);this.amLink=k;f=k.style;f.position="absolute";f.textDecoration="none";f.color=this.color;f.fontFamily=this.fontFamily;f.fontSize=this.fontSize+"px";f.opacity=0.7;f.display="block";var g=k.offsetWidth,k=k.offsetHeight,h=5+b,l=c+5;"bottom-left"==a&&(h=5+b,l=e-k-3);"bottom-right"==a&&(h=d-g-5,l=e-k-3);"top-right"==a&&(h=d-g-5,l=c+5);f.left=h+"px";f.top=l+"px"}}});AmCharts.Slice=AmCharts.Class({construct:function(){}});
112
+ AmCharts.SerialDataItem=AmCharts.Class({construct:function(){}});AmCharts.GraphDataItem=AmCharts.Class({construct:function(){}});AmCharts.Guide=AmCharts.Class({construct:function(a){this.cname="Guide";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.AmGraph=AmCharts.Class({construct:function(a){this.cname="AmGraph";this.createEvents("rollOverGraphItem","rollOutGraphItem","clickGraphItem","doubleClickGraphItem","rightClickGraphItem","clickGraph","rollOverGraph","rollOutGraph");this.type="line";this.stackable=!0;this.columnCount=1;this.columnIndex=0;this.centerCustomBullets=this.showBalloon=!0;this.maxBulletSize=50;this.minBulletSize=4;this.balloonText="[[value]]";this.hidden=this.scrollbar=this.animationPlayed=!1;this.pointPosition="middle";
113
113
  this.depthCount=1;this.includeInMinMax=!0;this.negativeBase=0;this.visibleInLegend=!0;this.showAllValueLabels=!1;this.showBulletsAt=this.showBalloonAt="close";this.lineThickness=1;this.dashLength=0;this.connect=!0;this.lineAlpha=1;this.bullet="none";this.bulletBorderThickness=2;this.bulletBorderAlpha=0;this.bulletAlpha=1;this.bulletSize=8;this.hideBulletsCount=this.bulletOffset=0;this.labelPosition="top";this.cornerRadiusTop=0;this.cursorBulletAlpha=1;this.gradientOrientation="vertical";this.dy=this.dx=
114
114
  0;this.periodValue="";this.clustered=!0;this.periodSpan=1;this.y=this.x=0;this.minDistance=1;AmCharts.applyTheme(this,a,this.cname)},draw:function(){var a=this.chart;isNaN(this.precision)||(this.numberFormatter?this.numberFormatter.precision=this.precision:this.numberFormatter={precision:this.precision,decimalSeparator:a.decimalSeparator,thousandsSeparator:a.thousandsSeparator});var b=a.container;this.container=b;this.destroy();var c=b.set(),d=b.set();this.behindColumns?(a.graphsBehindSet.push(c),
115
115
  a.bulletBehindSet.push(d)):(a.graphsSet.push(c),a.bulletSet.push(d));var e=this.bulletAxis;AmCharts.isString(e)&&(this.bulletAxis=a.getValueAxisById(e));this.bulletSet=d;this.scrollbar||(e=a.marginLeftReal,a=a.marginTopReal,c.translate(e,a),d.translate(e,a));b=b.set();AmCharts.remove(this.columnsSet);c.push(b);this.set=c;this.columnsSet=b;this.columnsArray=[];this.ownColumns=[];this.allBullets=[];this.animationArray=[];AmCharts.ifArray(this.data)&&(c=!1,"xy"==this.chart.type?this.xAxis.axisCreated&&
@@ -198,9 +198,9 @@ e=0,f=b-a,g=this.height+1,c.setAttr("width",b-a),c.setAttr("x",d));this.clipAndU
198
198
  (l?(a=q-d,a+d>n+f&&(a=n-d+f),0>a?(this.resizingRight=!1,b=this.resizingLeft=!0):(0===a&&(a=0.1),g.setAttr("height",a))):(a=s-c,a+c>p+e&&(a=p-c+e),0>a?(this.resizingRight=!1,b=this.resizingLeft=!0):(0===a&&(a=0.1),g.setAttr("width",a)))),this.resizingLeft&&(l?(c=d,d=q,d<f&&(d=f),d>n+f&&(d=n+f),a=!0===b?c-d:h+c-d,0>a?(this.resizingRight=!0,this.resizingLeft=!1,g.setAttr("y",c+h-f)):(0===a&&(a=0.1),g.setAttr("y",d-f),g.setAttr("height",a))):(d=s,d<e&&(d=e),d>p+e&&(d=p+e),a=!0===b?c-d:k+c-d,0>a?(this.resizingRight=
199
199
  !0,this.resizingLeft=!1,g.setAttr("x",c+k-e)):(0===a&&(a=0.1),g.setAttr("x",d-e),g.setAttr("width",a)))),this.clipDragger(!0))},clipDragger:function(a){var b=this.getDBox();if(b){var c=b.x,d=b.y,e=b.width,b=b.height,f=!1;if(this.rotate){if(c=0,e=this.width+1,this.clipY!=d||this.clipH!=b)f=!0}else if(d=0,b=this.height+1,this.clipX!=c||this.clipW!=e)f=!0;f&&(this.clipAndUpdate(c,d,e,b),a&&(this.updateOnReleaseOnly||this.dispatchScrollbarEvent()))}},maskGraphs:function(){},clipAndUpdate:function(a,b,
200
200
  c,d){this.clipX=a;this.clipY=b;this.clipW=c;this.clipH=d;this.selectedBG.clipRect(a,b,c,d);this.updateDragIconPositions();this.maskGraphs(a,b,c,d)},dispatchScrollbarEvent:function(){if(this.skipEvent)this.skipEvent=!1;else{var a=this.chart;a.hideBalloon();var b=this.getDBox(),c=b.x,d=b.y,e=b.width,b=b.height;this.rotate?(c=d,e=this.height/b):e=this.width/e;a={type:"zoomed",position:c,chart:a,target:this,multiplier:e};this.fire(a.type,a)}},updateDragIconPositions:function(){var a=this.getDBox(),b=
201
- a.x,c=a.y,d=this.iconLeft,e=this.iconRight,f,g,h=this.scrollbarHeight;this.rotate?(f=this.dragIconWidth,g=this.dragIconHeight,d.translate(this.x+(h-g)/2,this.y+c-f/2),e.translate(this.x+(h-g)/2,this.y+c+a.height-f/2)):(f=this.dragIconHeight,g=this.dragIconWidth,d.translate(this.x+b-g/2,this.y+(h-f)/2),e.translate(this.x+b-g/2+a.width,this.y+(h-f)/2))},showDragIcons:function(){this.resizeEnabled&&(this.iconLeft.show(),this.iconRight.show())},hideDragIcons:function(){this.resizingLeft||this.resizingRight||
202
- this.dragging||(this.hideResizeGrips&&(this.iconLeft.hide(),this.iconRight.hide()),this.removeCursors())},removeCursors:function(){this.chart.setMouseCursor("auto")},relativeZoom:function(a,b){this.dragger.stop();this.multiplier=a;this.position=b;this.updateScrollbarSize(b,this.rotate?b+this.height/a:b+this.width/a)},destroy:function(){this.clear();AmCharts.remove(this.set);AmCharts.remove(this.iconRight);AmCharts.remove(this.iconLeft)},clear:function(){clearInterval(this.interval)},handleDragStart:function(){var a=
203
- this.chart;this.dragger.stop();this.removeCursors();this.dragging=!0;var b=this.getDBox();this.rotate?(this.initialCoord=b.y,this.initialMouse=a.mouseY):(this.initialCoord=b.x,this.initialMouse=a.mouseX)},handleDragStop:function(){this.updateOnReleaseOnly&&(this.updateScrollbar(),this.skipEvent=!1,this.dispatchScrollbarEvent());this.dragging=!1;this.mouseIsOver&&this.removeCursors();this.updateScrollbar()},handleDraggerOver:function(){this.handleMouseOver()},leftDragStart:function(){this.dragger.stop();
201
+ a.x,c=a.y,d=this.iconLeft,e=this.iconRight,f,g,h=this.scrollbarHeight;this.rotate?(f=this.dragIconWidth,g=this.dragIconHeight,d.translate(this.x+(h-g)/2,this.y+c-f/2),e.translate(this.x+(h-g)/2,this.y+c+a.height-f/2)):(f=this.dragIconHeight,g=this.dragIconWidth,d.translate(this.x+b-g/2,this.y+(h-f)/2),e.translate(this.x+b-g/2+a.width,this.y+(h-f)/2))},showDragIcons:function(){this.resizeEnabled&&(this.iconLeft.show(),this.iconRight.show())},hideDragIcons:function(){if(!this.resizingLeft&&!this.resizingRight&&
202
+ !this.dragging){if(this.hideResizeGrips||!this.resizeEnabled)this.iconLeft.hide(),this.iconRight.hide();this.removeCursors()}},removeCursors:function(){this.chart.setMouseCursor("auto")},relativeZoom:function(a,b){this.dragger.stop();this.multiplier=a;this.position=b;this.updateScrollbarSize(b,this.rotate?b+this.height/a:b+this.width/a)},destroy:function(){this.clear();AmCharts.remove(this.set);AmCharts.remove(this.iconRight);AmCharts.remove(this.iconLeft)},clear:function(){clearInterval(this.interval)},
203
+ handleDragStart:function(){var a=this.chart;this.dragger.stop();this.removeCursors();this.dragging=!0;var b=this.getDBox();this.rotate?(this.initialCoord=b.y,this.initialMouse=a.mouseY):(this.initialCoord=b.x,this.initialMouse=a.mouseX)},handleDragStop:function(){this.updateOnReleaseOnly&&(this.updateScrollbar(),this.skipEvent=!1,this.dispatchScrollbarEvent());this.dragging=!1;this.mouseIsOver&&this.removeCursors();this.updateScrollbar()},handleDraggerOver:function(){this.handleMouseOver()},leftDragStart:function(){this.dragger.stop();
204
204
  this.resizingLeft=!0},leftDragStop:function(){this.resizingLeft=!1;this.mouseIsOver||this.removeCursors();this.updateOnRelease()},rightDragStart:function(){this.dragger.stop();this.resizingRight=!0},rightDragStop:function(){this.resizingRight=!1;this.mouseIsOver||this.removeCursors();this.updateOnRelease()},iconRollOut:function(){this.removeCursors()},iconRollOver:function(){this.rotate?this.chart.setMouseCursor("n-resize"):this.chart.setMouseCursor("e-resize");this.handleMouseOver()},getDBox:function(){if(this.dragger)return this.dragger.getBBox()},
205
205
  handleBgClick:function(){if(!this.resizingRight&&!this.resizingLeft){this.zooming=!0;var a,b,c=this.scrollDuration,d=this.dragger;a=this.getDBox();var e=a.height,f=a.width;b=this.chart;var g=this.y,h=this.x,k=this.rotate;k?(a="y",b=b.mouseY-e/2-g,b=AmCharts.fitToBounds(b,0,this.height-e)):(a="x",b=b.mouseX-f/2-h,b=AmCharts.fitToBounds(b,0,this.width-f));this.updateOnReleaseOnly?(this.skipEvent=!1,d.setAttr(a,b),this.dispatchScrollbarEvent(),this.clipDragger()):(b=Math.round(b),k?d.animate({y:b},c,
206
206
  ">"):d.animate({x:b},c,">"))}},updateOnRelease:function(){this.updateOnReleaseOnly&&(this.updateScrollbar(),this.skipEvent=!1,this.dispatchScrollbarEvent())},handleReleaseOutside:function(){if(this.set){if(this.resizingLeft||this.resizingRight||this.dragging)this.updateOnRelease(),this.removeCursors();this.mouseIsOver=this.dragging=this.resizingRight=this.resizingLeft=!1;this.hideDragIcons();this.updateScrollbar()}},handleMouseOver:function(){this.mouseIsOver=!0;this.showDragIcons()},handleMouseOut:function(){this.mouseIsOver=
@@ -218,31 +218,32 @@ a.iconRight.toFront()},timeZoom:function(a,b,c){this.startTime=a;this.endTime=b;
218
218
  (this.resizingRight&&d==b&&b++,this.resizingLeft&&d==b&&(0<d?d--:b=1)),this.start=d,this.end=this.dragging?this.start+this.difference:b,e.start=this.start,e.end=this.end,f.parseDates&&(a[this.start]&&(e.startDate=new Date(a[this.start].time)),a[this.end]&&(e.endDate=new Date(a[this.end].time))),this.fire(e.type,e)}},zoomScrollbar:function(){var a,b;a=this.chart;var c=a.chartData,d=this.categoryAxis;d.parseDates&&!d.equalSpacing?(c=d.stepWidth,d=a.firstTime,a=c*(this.startTime-d),b=c*(this.endTime-
219
219
  d)):(a=c[this.start].x[d.id],b=c[this.end].x[d.id],c=d.stepWidth,d.startOnAxis||(d=c/2,a-=d,b+=d));this.stepWidth=c;this.updateScrollbarSize(a,b)},maskGraphs:function(a,b,c,d){var e=this.selectedGraph;e&&e.set.clipRect(a,b,c,d)},handleDragStart:function(){AmCharts.ChartScrollbar.base.handleDragStart.call(this);this.difference=this.end-this.start;this.timeDifference=this.endTime-this.startTime;0>this.timeDifference&&(this.timeDifference=0)},handleBackgroundClick:function(){AmCharts.ChartScrollbar.base.handleBackgroundClick.call(this);
220
220
  this.dragging||(this.difference=this.end-this.start,this.timeDifference=this.endTime-this.startTime,0>this.timeDifference&&(this.timeDifference=0))}});AmCharts.AmBalloon=AmCharts.Class({construct:function(a){this.cname="AmBalloon";this.enabled=!0;this.fillColor="#FFFFFF";this.fillAlpha=0.8;this.borderThickness=2;this.borderColor="#FFFFFF";this.borderAlpha=1;this.cornerRadius=0;this.maximumWidth=220;this.horizontalPadding=8;this.verticalPadding=4;this.pointerWidth=6;this.pointerOrientation="V";this.color="#000000";this.adjustBorderColor=!0;this.show=this.follow=this.showBullet=!1;this.bulletSize=3;this.shadowAlpha=0.4;this.shadowColor="#000000";
221
- this.fadeOutDuration=this.animationDuration=0.3;this.fixedPosition=!1;this.offsetY=6;this.offsetX=1;AmCharts.isModern||(this.offsetY*=1.5);AmCharts.applyTheme(this,a,this.cname)},draw:function(){var a=this.pointToX,b=this.pointToY;this.deltaSignX=this.deltaSignY=1;var c=this.chart;AmCharts.VML&&(this.fadeOutDuration=0);this.xAnim&&c.stopAnim(this.xAnim);this.yAnim&&c.stopAnim(this.yAnim);if(!isNaN(a)){var d=this.follow,e=c.container,f=this.set;AmCharts.remove(f);this.removeDiv();this.set=f=e.set();
222
- c.balloonsSet.push(f);if(this.show){var g=this.l,h=this.t,k=this.r,l=this.b,m=this.balloonColor,p=this.fillColor,n=this.borderColor,s=p;void 0!=m&&(this.adjustBorderColor?s=n=m:p=m);var q=this.horizontalPadding,r=this.verticalPadding,u=this.pointerWidth,v=this.pointerOrientation,t=this.cornerRadius,w=c.fontFamily,y=this.fontSize;void 0==y&&(y=c.fontSize);var m=document.createElement("div"),E=m.style;E.position="absolute";var z=this.minWidth,A="";isNaN(z)||(A="min-width:"+(z-2*q)+"px; ");m.innerHTML=
223
- '<div style="text-align:center; '+A+"max-width:"+this.maxWidth+"px; font-size:"+y+"px; color:"+this.color+"; font-family:"+w+'">'+this.text+"</div>";c.chartDiv.appendChild(m);this.textDiv=m;y=m.offsetWidth;w=m.offsetHeight;m.clientHeight&&(y=m.clientWidth,w=m.clientHeight);w+=2*r;A=y+2*q;!isNaN(z)&&A<z&&(A=z);window.opera&&(w+=2);var I=!1,y=this.offsetY;c.handDrawn&&(y+=c.handDrawScatter+2);"H"!=v?(z=a-A/2,b<h+w+10&&"down"!=v?(I=!0,d&&(b+=y),y=b+u,this.deltaSignY=-1):(d&&(b-=y),y=b-w-u,this.deltaSignY=
224
- 1)):(2*u>w&&(u=w/2),y=b-w/2,a<g+(k-g)/2?(z=a+u,this.deltaSignX=-1):(z=a-A-u,this.deltaSignX=1));y+w>=l&&(y=l-w);y<h&&(y=h);z<g&&(z=g);z+A>k&&(z=k-A);var h=y+r,l=z+q,r=this.shadowAlpha,G=this.shadowColor,q=this.borderThickness,B=this.bulletSize,K;0<t||0===u?(0<r&&(a=AmCharts.rect(e,A,w,p,0,q+1,G,r,this.cornerRadius),AmCharts.isModern?a.translate(1,1):a.translate(4,4),f.push(a)),p=AmCharts.rect(e,A,w,p,this.fillAlpha,q,n,this.borderAlpha,this.cornerRadius),this.showBullet&&(K=AmCharts.circle(e,B,s,
225
- this.fillAlpha),f.push(K))):(s=[],t=[],"H"!=v?(g=a-z,g>A-u&&(g=A-u),g<u&&(g=u),s=[0,g-u,a-z,g+u,A,A,0,0],t=I?[0,0,b-y,0,0,w,w,0]:[w,w,b-y,w,w,0,0,w]):(s=b-y,s>w-u&&(s=w-u),s<u&&(s=u),t=[0,s-u,b-y,s+u,w,w,0,0],s=a<g+(k-g)/2?[0,0,z<a?0:a-z,0,0,A,A,0]:[A,A,z+A>a?A:a-z,A,A,0,0,A]),0<r&&(a=AmCharts.polygon(e,s,t,p,0,q,G,r),a.translate(1,1),f.push(a)),p=AmCharts.polygon(e,s,t,p,this.fillAlpha,q,n,this.borderAlpha));this.bg=p;f.push(p);p.toFront();e=1*this.deltaSignX;E.left=l+"px";E.top=h+"px";f.translate(z-
226
- e,y);p=p.getBBox();this.bottom=y+w+1;this.yPos=p.y+y;K&&K.translate(this.pointToX-z+e,b-y);b=this.animationDuration;0<this.animationDuration&&!d&&!isNaN(this.prevX)&&(f.translate(this.prevX,this.prevY),f.animate({translate:z-e+","+y},b,"easeOutSine"),m&&(E.left=this.prevTX+"px",E.top=this.prevTY+"px",this.xAnim=c.animate({node:m},"left",this.prevTX,l,b,"easeOutSine","px"),this.yAnim=c.animate({node:m},"top",this.prevTY,h,b,"easeOutSine","px")));this.prevX=z-e;this.prevY=y;this.prevTX=l;this.prevTY=
227
- h}}},followMouse:function(){if(this.follow&&this.show){var a=this.chart.mouseX-this.offsetX*this.deltaSignX,b=this.chart.mouseY;this.pointToX=a;this.pointToY=b;if(a!=this.previousX||b!=this.previousY)if(this.previousX=a,this.previousY=b,0===this.cornerRadius)this.draw();else{var c=this.set;if(c){var d=c.getBBox(),a=a-d.width/2,e=b-d.height-10;a<this.l&&(a=this.l);a>this.r-d.width&&(a=this.r-d.width);e<this.t&&(e=b+10);c.translate(a,e);b=this.textDiv.style;b.left=a+this.horizontalPadding+"px";b.top=
228
- e+this.verticalPadding+"px"}}}},changeColor:function(a){this.balloonColor=a},setBounds:function(a,b,c,d){this.l=a;this.t=b;this.r=c;this.b=d;this.destroyTO&&clearTimeout(this.destroyTO)},showBalloon:function(a){this.text=a;this.show=!0;this.destroyTO&&clearTimeout(this.destroyTO);a=this.chart;this.fadeAnim1&&a.stopAnim(this.fadeAnim1);this.fadeAnim2&&a.stopAnim(this.fadeAnim2);this.draw()},hide:function(){var a=this,b=a.fadeOutDuration,c=a.chart;if(0<b){a.destroyTO=setTimeout(function(){a.destroy.call(a)},
221
+ this.fadeOutDuration=this.animationDuration=0.3;this.fixedPosition=!1;this.offsetY=6;this.offsetX=1;this.textAlign="center";AmCharts.isModern||(this.offsetY*=1.5);AmCharts.applyTheme(this,a,this.cname)},draw:function(){var a=this.pointToX,b=this.pointToY;this.deltaSignX=this.deltaSignY=1;var c=this.chart;AmCharts.VML&&(this.fadeOutDuration=0);this.xAnim&&c.stopAnim(this.xAnim);this.yAnim&&c.stopAnim(this.yAnim);if(!isNaN(a)){var d=this.follow,e=c.container,f=this.set;AmCharts.remove(f);this.removeDiv();
222
+ this.set=f=e.set();c.balloonsSet.push(f);if(this.show){var g=this.l,h=this.t,k=this.r,l=this.b,m=this.balloonColor,p=this.fillColor,n=this.borderColor,s=p;void 0!=m&&(this.adjustBorderColor?s=n=m:p=m);var q=this.horizontalPadding,r=this.verticalPadding,u=this.pointerWidth,v=this.pointerOrientation,t=this.cornerRadius,w=c.fontFamily,y=this.fontSize;void 0==y&&(y=c.fontSize);var m=document.createElement("div"),E=m.style;E.position="absolute";var z=this.minWidth,A="";isNaN(z)||(A="min-width:"+(z-2*q)+
223
+ "px; ");m.innerHTML='<div style="text-align:'+this.textAlign+"; "+A+"max-width:"+this.maxWidth+"px; font-size:"+y+"px; color:"+this.color+"; font-family:"+w+'">'+this.text+"</div>";c.chartDiv.appendChild(m);this.textDiv=m;y=m.offsetWidth;w=m.offsetHeight;m.clientHeight&&(y=m.clientWidth,w=m.clientHeight);w+=2*r;A=y+2*q;!isNaN(z)&&A<z&&(A=z);window.opera&&(w+=2);var I=!1,y=this.offsetY;c.handDrawn&&(y+=c.handDrawScatter+2);"H"!=v?(z=a-A/2,b<h+w+10&&"down"!=v?(I=!0,d&&(b+=y),y=b+u,this.deltaSignY=-1):
224
+ (d&&(b-=y),y=b-w-u,this.deltaSignY=1)):(2*u>w&&(u=w/2),y=b-w/2,a<g+(k-g)/2?(z=a+u,this.deltaSignX=-1):(z=a-A-u,this.deltaSignX=1));y+w>=l&&(y=l-w);y<h&&(y=h);z<g&&(z=g);z+A>k&&(z=k-A);var h=y+r,l=z+q,r=this.shadowAlpha,G=this.shadowColor,q=this.borderThickness,B=this.bulletSize,K;0<t||0===u?(0<r&&(a=AmCharts.rect(e,A,w,p,0,q+1,G,r,this.cornerRadius),AmCharts.isModern?a.translate(1,1):a.translate(4,4),f.push(a)),p=AmCharts.rect(e,A,w,p,this.fillAlpha,q,n,this.borderAlpha,this.cornerRadius),this.showBullet&&
225
+ (K=AmCharts.circle(e,B,s,this.fillAlpha),f.push(K))):(s=[],t=[],"H"!=v?(g=a-z,g>A-u&&(g=A-u),g<u&&(g=u),s=[0,g-u,a-z,g+u,A,A,0,0],t=I?[0,0,b-y,0,0,w,w,0]:[w,w,b-y,w,w,0,0,w]):(s=b-y,s>w-u&&(s=w-u),s<u&&(s=u),t=[0,s-u,b-y,s+u,w,w,0,0],s=a<g+(k-g)/2?[0,0,z<a?0:a-z,0,0,A,A,0]:[A,A,z+A>a?A:a-z,A,A,0,0,A]),0<r&&(a=AmCharts.polygon(e,s,t,p,0,q,G,r),a.translate(1,1),f.push(a)),p=AmCharts.polygon(e,s,t,p,this.fillAlpha,q,n,this.borderAlpha));this.bg=p;f.push(p);p.toFront();e=1*this.deltaSignX;E.left=l+"px";
226
+ E.top=h+"px";f.translate(z-e,y);p=p.getBBox();this.bottom=y+w+1;this.yPos=p.y+y;K&&K.translate(this.pointToX-z+e,b-y);b=this.animationDuration;0<this.animationDuration&&!d&&!isNaN(this.prevX)&&(f.translate(this.prevX,this.prevY),f.animate({translate:z-e+","+y},b,"easeOutSine"),m&&(E.left=this.prevTX+"px",E.top=this.prevTY+"px",this.xAnim=c.animate({node:m},"left",this.prevTX,l,b,"easeOutSine","px"),this.yAnim=c.animate({node:m},"top",this.prevTY,h,b,"easeOutSine","px")));this.prevX=z-e;this.prevY=
227
+ y;this.prevTX=l;this.prevTY=h}}},followMouse:function(){if(this.follow&&this.show){var a=this.chart.mouseX-this.offsetX*this.deltaSignX,b=this.chart.mouseY;this.pointToX=a;this.pointToY=b;if(a!=this.previousX||b!=this.previousY)if(this.previousX=a,this.previousY=b,0===this.cornerRadius)this.draw();else{var c=this.set;if(c){var d=c.getBBox(),a=a-d.width/2,e=b-d.height-10;a<this.l&&(a=this.l);a>this.r-d.width&&(a=this.r-d.width);e<this.t&&(e=b+10);c.translate(a,e);b=this.textDiv.style;b.left=a+this.horizontalPadding+
228
+ "px";b.top=e+this.verticalPadding+"px"}}}},changeColor:function(a){this.balloonColor=a},setBounds:function(a,b,c,d){this.l=a;this.t=b;this.r=c;this.b=d;this.destroyTO&&clearTimeout(this.destroyTO)},showBalloon:function(a){this.text=a;this.show=!0;this.destroyTO&&clearTimeout(this.destroyTO);a=this.chart;this.fadeAnim1&&a.stopAnim(this.fadeAnim1);this.fadeAnim2&&a.stopAnim(this.fadeAnim2);this.draw()},hide:function(){var a=this,b=a.fadeOutDuration,c=a.chart;if(0<b){a.destroyTO=setTimeout(function(){a.destroy.call(a)},
229
229
  1E3*b);a.follow=!1;a.show=!1;var d=a.set;d&&(d.setAttr("opacity",a.fillAlpha),a.fadeAnim1=d.animate({opacity:0},b,"easeInSine"));a.textDiv&&(a.fadeAnim2=c.animate({node:a.textDiv},"opacity",1,0,b,"easeInSine",""))}else a.show=!1,a.follow=!1,a.destroy()},setPosition:function(a,b,c){this.pointToX=a;this.pointToY=b;c&&(a==this.previousX&&b==this.previousY||this.draw());this.previousX=a;this.previousY=b},followCursor:function(a){var b=this;(b.follow=a)?(b.pShowBullet=b.showBullet,b.showBullet=!1):void 0!==
230
230
  b.pShowBullet&&(b.showBullet=b.pShowBullet);clearInterval(b.interval);var c=b.chart.mouseX,d=b.chart.mouseY;!isNaN(c)&&a&&(b.pointToX=c-b.offsetX*b.deltaSignX,b.pointToY=d,b.followMouse(),b.interval=setInterval(function(){b.followMouse.call(b)},40))},removeDiv:function(){if(this.textDiv){var a=this.textDiv.parentNode;a&&a.removeChild(this.textDiv)}},destroy:function(){clearInterval(this.interval);AmCharts.remove(this.set);this.removeDiv();this.set=null}});AmCharts.AmCoordinateChart=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(a){AmCharts.AmCoordinateChart.base.construct.call(this,a);this.theme=a;this.createEvents("rollOverGraphItem","rollOutGraphItem","clickGraphItem","doubleClickGraphItem","rightClickGraphItem","clickGraph","rollOverGraph","rollOutGraph");this.startAlpha=1;this.startDuration=0;this.startEffect="elastic";this.sequencedAnimation=!0;this.colors="#FF6600 #FCD202 #B0DE09 #0D8ECF #2A0CD0 #CD0D74 #CC0000 #00CC00 #0000CC #DDDDDD #999999 #333333 #990000".split(" ");
231
- this.balloonDateFormat="MMM DD, YYYY";this.valueAxes=[];this.graphs=[];this.gridAboveGraphs=!1;AmCharts.applyTheme(this,a,"AmCoordinateChart")},initChart:function(){AmCharts.AmCoordinateChart.base.initChart.call(this);var a=this.categoryAxis;a&&(this.categoryAxis=AmCharts.processObject(a,AmCharts.CategoryAxis,this.theme));this.processValueAxes();this.createValueAxes();this.processGraphs();AmCharts.VML&&(this.startAlpha=1);this.setLegendData(this.graphs);this.gridAboveGraphs&&this.gridSet.toFront()},
232
- createValueAxes:function(){if(0===this.valueAxes.length){var a=new AmCharts.ValueAxis;this.addValueAxis(a)}},parseData:function(){this.processValueAxes();this.processGraphs()},parseSerialData:function(){var a=this.graphs,b,c={},d=this.seriesIdField;d||(d=this.categoryField);this.chartData=[];var e=this.dataProvider;if(e){var f=!1,g,h=this.categoryAxis,k;h&&(f=h.parseDates,k=h.forceShowField,g=h.categoryFunction);var l,m,p,n;f&&(b=AmCharts.extractPeriod(h.minPeriod),l=b.period,m=b.count,n=AmCharts.getPeriodDuration(l,
233
- m));var s={};this.lookupTable=s;var q,r=this.dataDateFormat,u;for(q=0;q<e.length;q++){var v={},t=e[q];b=t[this.categoryField];v.dataContext=t;v.category=g?g(b,t,h):String(b);k&&(v.forceShow=t[k]);s[t[d]]=v;f&&(b=h.categoryFunction?h.categoryFunction(b,t,h):b instanceof Date?"fff"==h.minPeriod?AmCharts.useUTC?new Date(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds()):new Date(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),
234
- b.getMinutes(),b.getSeconds(),b.getMilliseconds()):new Date(b):r?AmCharts.stringToDate(b,r):new Date(b),b=AmCharts.resetDateToMin(b,l,m,h.firstDayOfWeek),v.category=b,v.time=b.getTime());var w=this.valueAxes;v.axes={};v.x={};var y;for(y=0;y<w.length;y++){var E=w[y].id;v.axes[E]={};v.axes[E].graphs={};var z;for(z=0;z<a.length;z++){b=a[z];var A=b.id,I=b.periodValue;if(b.valueAxis.id==E){v.axes[E].graphs[A]={};var G={};G.index=q;var B=t;b.dataProvider&&(B=c);G.values=this.processValues(B,b,I);!b.connect&&
235
- u&&v.time-p>1.1*n&&(u.gap=!0);this.processFields(b,G,B);G.category=v.category;G.serialDataItem=v;G.graph=b;v.axes[E].graphs[A]=G}}}this.chartData[q]=v;p=v.time;u=G}}for(c=0;c<a.length;c++)b=a[c],b.dataProvider&&this.parseGraphData(b)},processValues:function(a,b,c){var d={},e,f=!1;"candlestick"!=b.type&&"ohlc"!=b.type||""===c||(f=!0);e=Number(a[b.valueField+c]);isNaN(e)||(d.value=e);e=Number(a[b.errorField+c]);isNaN(e)||(d.error=e);f&&(c="Open");e=Number(a[b.openField+c]);isNaN(e)||(d.open=e);f&&(c=
236
- "Close");e=Number(a[b.closeField+c]);isNaN(e)||(d.close=e);f&&(c="Low");e=Number(a[b.lowField+c]);isNaN(e)||(d.low=e);f&&(c="High");e=Number(a[b.highField+c]);isNaN(e)||(d.high=e);return d},parseGraphData:function(a){var b=a.dataProvider,c=a.seriesIdField;c||(c=this.seriesIdField);c||(c=this.categoryField);var d;for(d=0;d<b.length;d++){var e=b[d],f=this.lookupTable[String(e[c])],g=a.valueAxis.id;f&&(g=f.axes[g].graphs[a.id],g.serialDataItem=f,g.values=this.processValues(e,a,a.periodValue),this.processFields(a,
237
- g,e))}},addValueAxis:function(a){a.chart=this;this.valueAxes.push(a);this.validateData()},removeValueAxesAndGraphs:function(){var a=this.valueAxes,b;for(b=a.length-1;-1<b;b--)this.removeValueAxis(a[b])},removeValueAxis:function(a){var b=this.graphs,c;for(c=b.length-1;0<=c;c--){var d=b[c];d&&d.valueAxis==a&&this.removeGraph(d)}b=this.valueAxes;for(c=b.length-1;0<=c;c--)b[c]==a&&b.splice(c,1);this.validateData()},addGraph:function(a){this.graphs.push(a);this.chooseGraphColor(a,this.graphs.length-1);
238
- this.validateData()},removeGraph:function(a){var b=this.graphs,c;for(c=b.length-1;0<=c;c--)b[c]==a&&(b.splice(c,1),a.destroy());this.validateData()},processValueAxes:function(){var a=this.valueAxes,b;for(b=0;b<a.length;b++){var c=a[b],c=AmCharts.processObject(c,AmCharts.ValueAxis,this.theme);a[b]=c;c.chart=this;c.id||(c.id="valueAxisAuto"+b+"_"+(new Date).getTime());void 0===c.usePrefixes&&(c.usePrefixes=this.usePrefixes)}},processGraphs:function(){var a=this.graphs,b;for(b=0;b<a.length;b++){var c=
239
- a[b],c=AmCharts.processObject(c,AmCharts.AmGraph,this.theme);a[b]=c;this.chooseGraphColor(c,b);c.chart=this;AmCharts.isString(c.valueAxis)&&(c.valueAxis=this.getValueAxisById(c.valueAxis));c.valueAxis||(c.valueAxis=this.valueAxes[0]);c.id||(c.id="graphAuto"+b+"_"+(new Date).getTime())}},formatString:function(a,b,c){var d=b.graph,e=d.valueAxis;e.duration&&b.values.value&&(e=AmCharts.formatDuration(b.values.value,e.duration,"",e.durationUnits,e.maxInterval,e.numberFormatter),a=a.split("[[value]]").join(e));
240
- a=AmCharts.massReplace(a,{"[[title]]":d.title,"[[description]]":b.description});a=c?AmCharts.fixNewLines(a):AmCharts.fixBrakes(a);return a=AmCharts.cleanFromEmpty(a)},getBalloonColor:function(a,b,c){var d=a.lineColor,e=a.balloonColor;c&&(e=d);c=a.fillColorsR;"object"==typeof c?d=c[0]:void 0!==c&&(d=c);b.isNegative&&(c=a.negativeLineColor,a=a.negativeFillColors,"object"==typeof a?c=a[0]:void 0!==a&&(c=a),void 0!==c&&(d=c));void 0!==b.color&&(d=b.color);void 0===e&&(e=d);return e},getGraphById:function(a){return AmCharts.getObjById(this.graphs,
241
- a)},getValueAxisById:function(a){return AmCharts.getObjById(this.valueAxes,a)},processFields:function(a,b,c){if(a.itemColors){var d=a.itemColors,e=b.index;b.color=e<d.length?d[e]:AmCharts.randomColor()}d="lineColor color alpha fillColors description bullet customBullet bulletSize bulletConfig url labelColor dashLength pattern".split(" ");for(e=0;e<d.length;e++){var f=d[e],g=a[f+"Field"];g&&(g=c[g],AmCharts.isDefined(g)&&(b[f]=g))}b.dataContext=c},chooseGraphColor:function(a,b){if(a.lineColor)a.lineColorR=
242
- a.lineColor;else{var c;c=this.colors.length>b?this.colors[b]:AmCharts.randomColor();a.lineColorR=c}a.fillColorsR=a.fillColors?a.fillColors:a.lineColorR;a.bulletBorderColorR=a.bulletBorderColor?a.bulletBorderColor:a.useLineColorForBulletBorder?a.lineColorR:a.bulletColor;a.bulletColorR=a.bulletColor?a.bulletColor:a.lineColorR;if(c=this.patterns)a.pattern=c[b]},handleLegendEvent:function(a){var b=a.type;a=a.dataItem;if(!this.legend.data&&a){var c=a.hidden,d=a.showBalloon;switch(b){case "clickMarker":d?
243
- this.hideGraphsBalloon(a):this.showGraphsBalloon(a);break;case "clickLabel":d?this.hideGraphsBalloon(a):this.showGraphsBalloon(a);break;case "rollOverItem":c||this.highlightGraph(a);break;case "rollOutItem":c||this.unhighlightGraph();break;case "hideItem":this.hideGraph(a);break;case "showItem":this.showGraph(a)}}},highlightGraph:function(a){var b=this.graphs,c,d=0.2;this.legend&&(d=this.legend.rollOverGraphAlpha);if(1!=d)for(c=0;c<b.length;c++){var e=b[c];e!=a&&e.changeOpacity(d)}},unhighlightGraph:function(){var a;
244
- this.legend&&(a=this.legend.rollOverGraphAlpha);if(1!=a){a=this.graphs;var b;for(b=0;b<a.length;b++)a[b].changeOpacity(1)}},showGraph:function(a){a.hidden=!1;this.dataChanged=!0;this.marginsUpdated=!1;this.chartCreated&&this.initChart()},hideGraph:function(a){this.dataChanged=!0;this.marginsUpdated=!1;a.hidden=!0;this.chartCreated&&this.initChart()},hideGraphsBalloon:function(a){a.showBalloon=!1;this.updateLegend()},showGraphsBalloon:function(a){a.showBalloon=!0;this.updateLegend()},updateLegend:function(){this.legend&&
245
- this.legend.invalidateSize()},resetAnimation:function(){var a=this.graphs;if(a){var b;for(b=0;b<a.length;b++)a[b].animationPlayed=!1}},animateAgain:function(){this.resetAnimation();this.validateNow()}});AmCharts.AmSlicedChart=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(a){this.createEvents("rollOverSlice","rollOutSlice","clickSlice","pullOutSlice","pullInSlice","rightClickSlice");AmCharts.AmSlicedChart.base.construct.call(this,a);this.colors="#FF0F00 #FF6600 #FF9E01 #FCD202 #F8FF01 #B0DE09 #04D215 #0D8ECF #0D52D1 #2A0CD0 #8A0CCF #CD0D74 #754DEB #DDDDDD #999999 #333333 #000000 #57032A #CA9726 #990000 #4B0C25".split(" ");this.alpha=1;this.groupPercent=0;this.groupedTitle="Other";this.groupedPulled=
231
+ this.balloonDateFormat="MMM DD, YYYY";this.valueAxes=[];this.graphs=[];this.guides=[];this.gridAboveGraphs=!1;AmCharts.applyTheme(this,a,"AmCoordinateChart")},initChart:function(){AmCharts.AmCoordinateChart.base.initChart.call(this);var a=this.categoryAxis;a&&(this.categoryAxis=AmCharts.processObject(a,AmCharts.CategoryAxis,this.theme));this.processValueAxes();this.createValueAxes();this.processGraphs();this.processGuides();AmCharts.VML&&(this.startAlpha=1);this.setLegendData(this.graphs);this.gridAboveGraphs&&
232
+ this.gridSet.toFront()},createValueAxes:function(){if(0===this.valueAxes.length){var a=new AmCharts.ValueAxis;this.addValueAxis(a)}},parseData:function(){this.processValueAxes();this.processGraphs()},parseSerialData:function(){var a=this.graphs,b,c={},d=this.seriesIdField;d||(d=this.categoryField);this.chartData=[];var e=this.dataProvider;if(e){var f=!1,g,h=this.categoryAxis,k;h&&(f=h.parseDates,k=h.forceShowField,g=h.categoryFunction);var l,m,p,n;f&&(b=AmCharts.extractPeriod(h.minPeriod),l=b.period,
233
+ m=b.count,n=AmCharts.getPeriodDuration(l,m));var s={};this.lookupTable=s;var q,r=this.dataDateFormat,u;for(q=0;q<e.length;q++){var v={},t=e[q];b=t[this.categoryField];v.dataContext=t;v.category=g?g(b,t,h):String(b);k&&(v.forceShow=t[k]);s[t[d]]=v;f&&(b=h.categoryFunction?h.categoryFunction(b,t,h):b instanceof Date?"fff"==h.minPeriod?AmCharts.useUTC?new Date(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds()):new Date(b.getFullYear(),
234
+ b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()):new Date(b):r?AmCharts.stringToDate(b,r):new Date(b),b=AmCharts.resetDateToMin(b,l,m,h.firstDayOfWeek),v.category=b,v.time=b.getTime());var w=this.valueAxes;v.axes={};v.x={};var y;for(y=0;y<w.length;y++){var E=w[y].id;v.axes[E]={};v.axes[E].graphs={};var z;for(z=0;z<a.length;z++){b=a[z];var A=b.id,I=b.periodValue;if(b.valueAxis.id==E){v.axes[E].graphs[A]={};var G={};G.index=q;var B=t;b.dataProvider&&(B=c);G.values=
235
+ this.processValues(B,b,I);!b.connect&&u&&v.time-p>1.1*n&&(u.gap=!0);this.processFields(b,G,B);G.category=v.category;G.serialDataItem=v;G.graph=b;v.axes[E].graphs[A]=G}}}this.chartData[q]=v;p=v.time;u=G}}for(c=0;c<a.length;c++)b=a[c],b.dataProvider&&this.parseGraphData(b)},processValues:function(a,b,c){var d={},e,f=!1;"candlestick"!=b.type&&"ohlc"!=b.type||""===c||(f=!0);e=Number(a[b.valueField+c]);isNaN(e)||(d.value=e);e=Number(a[b.errorField+c]);isNaN(e)||(d.error=e);f&&(c="Open");e=Number(a[b.openField+
236
+ c]);isNaN(e)||(d.open=e);f&&(c="Close");e=Number(a[b.closeField+c]);isNaN(e)||(d.close=e);f&&(c="Low");e=Number(a[b.lowField+c]);isNaN(e)||(d.low=e);f&&(c="High");e=Number(a[b.highField+c]);isNaN(e)||(d.high=e);return d},parseGraphData:function(a){var b=a.dataProvider,c=a.seriesIdField;c||(c=this.seriesIdField);c||(c=this.categoryField);var d;for(d=0;d<b.length;d++){var e=b[d],f=this.lookupTable[String(e[c])],g=a.valueAxis.id;f&&(g=f.axes[g].graphs[a.id],g.serialDataItem=f,g.values=this.processValues(e,
237
+ a,a.periodValue),this.processFields(a,g,e))}},addValueAxis:function(a){a.chart=this;this.valueAxes.push(a);this.validateData()},removeValueAxesAndGraphs:function(){var a=this.valueAxes,b;for(b=a.length-1;-1<b;b--)this.removeValueAxis(a[b])},removeValueAxis:function(a){var b=this.graphs,c;for(c=b.length-1;0<=c;c--){var d=b[c];d&&d.valueAxis==a&&this.removeGraph(d)}b=this.valueAxes;for(c=b.length-1;0<=c;c--)b[c]==a&&b.splice(c,1);this.validateData()},addGraph:function(a){this.graphs.push(a);this.chooseGraphColor(a,
238
+ this.graphs.length-1);this.validateData()},removeGraph:function(a){var b=this.graphs,c;for(c=b.length-1;0<=c;c--)b[c]==a&&(b.splice(c,1),a.destroy());this.validateData()},processValueAxes:function(){var a=this.valueAxes,b;for(b=0;b<a.length;b++){var c=a[b],c=AmCharts.processObject(c,AmCharts.ValueAxis,this.theme);a[b]=c;c.chart=this;c.id||(c.id="valueAxisAuto"+b+"_"+(new Date).getTime());void 0===c.usePrefixes&&(c.usePrefixes=this.usePrefixes)}},processGuides:function(){var a=this.guides,b=this.categoryAxis;
239
+ if(a)for(var c=0;c<a.length;c++){var d=a[c];(void 0!==d.category||void 0!==d.date)&&b&&b.addGuide(d);d.valueAxis?d.valueAxis.addGuide(d):isNaN(d.value)||this.valueAxes[0].addGuide(d)}},processGraphs:function(){var a=this.graphs,b;for(b=0;b<a.length;b++){var c=a[b],c=AmCharts.processObject(c,AmCharts.AmGraph,this.theme);a[b]=c;this.chooseGraphColor(c,b);c.chart=this;AmCharts.isString(c.valueAxis)&&(c.valueAxis=this.getValueAxisById(c.valueAxis));c.valueAxis||(c.valueAxis=this.valueAxes[0]);c.id||(c.id=
240
+ "graphAuto"+b+"_"+(new Date).getTime())}},formatString:function(a,b,c){var d=b.graph,e=d.valueAxis;e.duration&&b.values.value&&(e=AmCharts.formatDuration(b.values.value,e.duration,"",e.durationUnits,e.maxInterval,e.numberFormatter),a=a.split("[[value]]").join(e));a=AmCharts.massReplace(a,{"[[title]]":d.title,"[[description]]":b.description});a=c?AmCharts.fixNewLines(a):AmCharts.fixBrakes(a);return a=AmCharts.cleanFromEmpty(a)},getBalloonColor:function(a,b,c){var d=a.lineColor,e=a.balloonColor;c&&
241
+ (e=d);c=a.fillColorsR;"object"==typeof c?d=c[0]:void 0!==c&&(d=c);b.isNegative&&(c=a.negativeLineColor,a=a.negativeFillColors,"object"==typeof a?c=a[0]:void 0!==a&&(c=a),void 0!==c&&(d=c));void 0!==b.color&&(d=b.color);void 0===e&&(e=d);return e},getGraphById:function(a){return AmCharts.getObjById(this.graphs,a)},getValueAxisById:function(a){return AmCharts.getObjById(this.valueAxes,a)},processFields:function(a,b,c){if(a.itemColors){var d=a.itemColors,e=b.index;b.color=e<d.length?d[e]:AmCharts.randomColor()}d=
242
+ "lineColor color alpha fillColors description bullet customBullet bulletSize bulletConfig url labelColor dashLength pattern".split(" ");for(e=0;e<d.length;e++){var f=d[e],g=a[f+"Field"];g&&(g=c[g],AmCharts.isDefined(g)&&(b[f]=g))}b.dataContext=c},chooseGraphColor:function(a,b){if(a.lineColor)a.lineColorR=a.lineColor;else{var c;c=this.colors.length>b?this.colors[b]:AmCharts.randomColor();a.lineColorR=c}a.fillColorsR=a.fillColors?a.fillColors:a.lineColorR;a.bulletBorderColorR=a.bulletBorderColor?a.bulletBorderColor:
243
+ a.useLineColorForBulletBorder?a.lineColorR:a.bulletColor;a.bulletColorR=a.bulletColor?a.bulletColor:a.lineColorR;if(c=this.patterns)a.pattern=c[b]},handleLegendEvent:function(a){var b=a.type;a=a.dataItem;if(!this.legend.data&&a){var c=a.hidden,d=a.showBalloon;switch(b){case "clickMarker":d?this.hideGraphsBalloon(a):this.showGraphsBalloon(a);break;case "clickLabel":d?this.hideGraphsBalloon(a):this.showGraphsBalloon(a);break;case "rollOverItem":c||this.highlightGraph(a);break;case "rollOutItem":c||
244
+ this.unhighlightGraph();break;case "hideItem":this.hideGraph(a);break;case "showItem":this.showGraph(a)}}},highlightGraph:function(a){var b=this.graphs,c,d=0.2;this.legend&&(d=this.legend.rollOverGraphAlpha);if(1!=d)for(c=0;c<b.length;c++){var e=b[c];e!=a&&e.changeOpacity(d)}},unhighlightGraph:function(){var a;this.legend&&(a=this.legend.rollOverGraphAlpha);if(1!=a){a=this.graphs;var b;for(b=0;b<a.length;b++)a[b].changeOpacity(1)}},showGraph:function(a){a.hidden=!1;this.dataChanged=!0;this.marginsUpdated=
245
+ !1;this.chartCreated&&this.initChart()},hideGraph:function(a){this.dataChanged=!0;this.marginsUpdated=!1;a.hidden=!0;this.chartCreated&&this.initChart()},hideGraphsBalloon:function(a){a.showBalloon=!1;this.updateLegend()},showGraphsBalloon:function(a){a.showBalloon=!0;this.updateLegend()},updateLegend:function(){this.legend&&this.legend.invalidateSize()},resetAnimation:function(){var a=this.graphs;if(a){var b;for(b=0;b<a.length;b++)a[b].animationPlayed=!1}},animateAgain:function(){this.resetAnimation();
246
+ this.validateNow()}});AmCharts.AmSlicedChart=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(a){this.createEvents("rollOverSlice","rollOutSlice","clickSlice","pullOutSlice","pullInSlice","rightClickSlice");AmCharts.AmSlicedChart.base.construct.call(this,a);this.colors="#FF0F00 #FF6600 #FF9E01 #FCD202 #F8FF01 #B0DE09 #04D215 #0D8ECF #0D52D1 #2A0CD0 #8A0CCF #CD0D74 #754DEB #DDDDDD #999999 #333333 #000000 #57032A #CA9726 #990000 #4B0C25".split(" ");this.alpha=1;this.groupPercent=0;this.groupedTitle="Other";this.groupedPulled=
246
247
  !1;this.groupedAlpha=1;this.marginLeft=0;this.marginBottom=this.marginTop=10;this.marginRight=0;this.hoverAlpha=1;this.outlineColor="#FFFFFF";this.outlineAlpha=0;this.outlineThickness=1;this.startAlpha=0;this.startDuration=1;this.startEffect="bounce";this.sequencedAnimation=!0;this.pullOutDuration=1;this.pullOutEffect="bounce";this.pullOnHover=this.pullOutOnlyOne=!1;this.labelsEnabled=!0;this.labelTickColor="#000000";this.labelTickAlpha=0.2;this.hideLabelsPercent=0;this.urlTarget="_self";this.autoMarginOffset=
247
248
  10;this.gradientRatio=[];AmCharts.applyTheme(this,a,"AmSlicedChart")},initChart:function(){AmCharts.AmSlicedChart.base.initChart.call(this);this.dataChanged&&(this.parseData(),this.dispatchDataUpdated=!0,this.dataChanged=!1,this.setLegendData(this.chartData));this.drawChart()},handleLegendEvent:function(a){var b=a.type;a=a.dataItem;if(!this.legend.data&&a){var c=a.hidden;switch(b){case "clickMarker":c||this.clickSlice(a);break;case "clickLabel":c||this.clickSlice(a);break;case "rollOverItem":c||this.rollOverSlice(a,
248
249
  !1);break;case "rollOutItem":c||this.rollOutSlice(a);break;case "hideItem":this.hideSlice(a);break;case "showItem":this.showSlice(a)}}},invalidateVisibility:function(){this.recalculatePercents();this.initChart();var a=this.legend;a&&a.invalidateSize()},addEventListeners:function(a,b){var c=this;a.mouseover(function(a){c.rollOverSlice(b,!0,a)}).mouseout(function(a){c.rollOutSlice(b,a)}).touchend(function(a){c.rollOverSlice(b,a);c.panEventsEnabled&&c.clickSlice(b,a)}).touchstart(function(a){c.rollOverSlice(b,
@@ -1,93 +1,93 @@
1
- AmCharts.AmStockChart=AmCharts.Class({construct:function(a){this.type="stock";this.cname="AmStockChart";this.version="3.4.7";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=
2
- !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=
3
- 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,
4
- 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,
5
- 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();
6
- 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;a<b.length;a++)panel=b[a],panel.invalidateSize()},updateDataSets:function(){var a=this.mainDataSet,b=this.dataSets,c;for(c=0;c<b.length;c++){var d=b[c],d=AmCharts.processObject(d,AmCharts.DataSet);b[c]=d;d.id||(this.dataSetCount++,
7
- d.id="ds"+this.dataSetCount);void 0===d.color&&(d.color=this.colors.length-1>c?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(),
8
- 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=
9
- 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=
10
- !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,
11
- c;for(c=0;c<a.length;c++){var d=a[c];d.dataParsed||(AmCharts.parseStockData(d,b.minPeriod,b.groupToPeriods,this.firstDayOfWeek,this.dataDateFormat),d.dataParsed=!0);this.updateEvents(d)}},createLayout:function(){var a=this.div,b,c,d=document.createElement("div");d.style.position="relative";this.containerDiv=d;a.appendChild(d);if(a=this.periodSelector)b=a.position;if(a=this.dataSetSelector)c=a.position;if("left"==b||"left"==c)a=document.createElement("div"),a.style.cssFloat="left",a.style.styleFloat=
12
- "left",a.style.width="0px",a.style.position="absolute",d.appendChild(a),this.leftContainer=a;if("right"==b||"right"==c)b=document.createElement("div"),b.style.cssFloat="right",b.style.styleFloat="right",b.style.width="0px",d.appendChild(b),this.rightContainer=b;b=document.createElement("div");d.appendChild(b);this.centerContainer=b;d=document.createElement("div");b.appendChild(d);this.panelsContainer=d},addPanels:function(){this.measurePanels();for(var a=this.panels,b=0;b<a.length;b++){var c=a[b],
13
- c=AmCharts.processObject(c,AmCharts.StockPanel,this.theme);a[b]=c;this.addStockPanel(c,b)}this.panelsAdded=!0},measurePanels:function(){this.measure();var a=this.chartScrollbarSettings,b=this.divRealHeight,c=this.panelsSettings.panelSpacing;a.enabled&&(b-=a.height);(a=this.periodSelector)&&!a.vertical&&(a=a.offsetHeight,b-=a+c);(a=this.dataSetSelector)&&!a.vertical&&(a=a.offsetHeight,b-=a+c);a=this.panels;this.panelsContainer.style.height=b+"px";this.chartCursors=[];var d=0,e,h;for(e=0;e<a.length;e++){h=
14
- a[e];var f=h.percentHeight;isNaN(f)&&(f=100/a.length,h.percentHeight=f);d+=f}this.panelsHeight=Math.max(b-c*(a.length-1),0);for(e=0;e<a.length;e++)h=a[e],h.percentHeight=h.percentHeight/d*100,h.panelBox&&(h.panelBox.style.height=Math.round(h.percentHeight*this.panelsHeight/100)+"px")},addStockPanel:function(a,b){var c=this.panelsSettings,d=document.createElement("div");d.className="amChartsPanel";0<b&&!this.panels[b-1].showCategoryAxis&&(d.style.marginTop=c.panelSpacing+"px");a.panelBox=d;a.stockChart=
15
- this;a.id||(a.id="stockPanel"+b);a.pathToImages=this.pathToImages;d.style.height=Math.round(a.percentHeight*this.panelsHeight/100)+"px";d.style.width="100%";this.panelsContainer.appendChild(d);0<c.backgroundAlpha&&(d.style.backgroundColor=c.backgroundColor);if(d=a.stockLegend)d.container=void 0,d.title=a.title,d.marginLeft=c.marginLeft,d.marginRight=c.marginRight,d.verticalGap=3,d.position="top",AmCharts.copyProperties(this.legendSettings,d),a.addLegend(d,d.divId);a.zoomOutText="";a.removeChartCursor();
16
- this.addCursor(a)},enableCursors:function(a){var b=this.chartCursors,c;for(c=0;c<b.length;c++)b[c].enabled=a},updatePanels:function(){var a=this.panels,b;for(b=0;b<a.length;b++)this.updatePanel(a[b]);this.mainDataSet&&this.updateGraphs();this.currentPeriod=void 0},updatePanel:function(a){a.seriesIdField="amCategoryIdField";a.dataProvider=[];a.chartData=[];a.graphs=[];var b=a.categoryAxis,c=this.categoryAxesSettings;AmCharts.copyProperties(this.panelsSettings,a);AmCharts.copyProperties(c,b);b.parseDates=
17
- !0;a.zoomOutOnDataUpdate=!1;a.mouseWheelScrollEnabled=this.mouseWheelScrollEnabled;a.showCategoryAxis?"top"==b.position?a.marginTop=c.axisHeight:a.marginBottom=c.axisHeight:(a.categoryAxis.labelsEnabled=!1,a.chartCursor&&(a.chartCursor.categoryBalloonEnabled=!1));var c=a.valueAxes,d=c.length,e;0===d&&(e=new AmCharts.ValueAxis(this.theme),a.addValueAxis(e));b=new AmCharts.AmBalloon(this.theme);AmCharts.copyProperties(this.balloon,b);a.balloon=b;c=a.valueAxes;d=c.length;for(b=0;b<d;b++)e=c[b],AmCharts.copyProperties(this.valueAxesSettings,
18
- e);a.listenersAdded=!1;a.write(a.panelBox)},zoom:function(a,b){this.zoomChart(a,b)},zoomOut:function(){this.zoomChart(this.firstDate,this.lastDate)},updatePanelsWithNewData:function(){var a=this.mainDataSet,b=this.scrollbarChart;if(a){var c=this.panels;this.currentPeriod=void 0;var d;for(d=0;d<c.length;d++){var e=c[d];e.categoryField=a.categoryField;0===a.dataProvider.length&&(e.dataProvider=[]);e.scrollbarChart=b}b&&(c=this.categoryAxesSettings,d=c.minPeriod,b.categoryField=a.categoryField,0<a.dataProvider.length?
19
- (e=this.chartScrollbarSettings.usePeriod,b.dataProvider=e?a.agregatedDataProviders[e]:a.agregatedDataProviders[d]):b.dataProvider=[],e=b.categoryAxis,e.minPeriod=d,e.firstDayOfWeek=this.firstDayOfWeek,e.equalSpacing=c.equalSpacing,e.markPeriodChange=c.markPeriodChange,b.bbsetr=!0,b.validateData());0<a.dataProvider.length&&this.zoomChart(this.startDate,this.endDate)}this.panelDataInvalidated=!1},addChartScrollbar:function(){var a=this.chartScrollbarSettings,b=this.scrollbarChart;b&&(b.clear(),b.destroy());
20
- if(a.enabled){var c=this.panelsSettings,d=this.categoryAxesSettings,b=new AmCharts.AmSerialChart(this.theme);b.pathToImages=this.pathToImages;b.autoMargins=!1;this.scrollbarChart=b;b.id="scrollbarChart";b.scrollbarOnly=!0;b.zoomOutText="";b.panEventsEnabled=this.panelsSettings.panEventsEnabled;b.marginLeft=c.marginLeft;b.marginRight=c.marginRight;b.marginTop=0;b.marginBottom=0;var c=d.dateFormats,e=b.categoryAxis;e.boldPeriodBeginning=d.boldPeriodBeginning;c&&(e.dateFormats=d.dateFormats);e.labelsEnabled=
21
- !1;e.parseDates=!0;d=a.graph;if(AmCharts.isString(d)){c=this.panels;for(e=0;e<c.length;e++){var h=AmCharts.getObjById(c[e].stockGraphs,a.graph);h&&(d=h)}a.graph=d}var f;d&&(f=new AmCharts.AmGraph(this.theme),f.valueField=d.valueField,f.periodValue=d.periodValue,f.type=d.type,f.connect=d.connect,b.addGraph(f));d=new AmCharts.ChartScrollbar(this.theme);b.addChartScrollbar(d);AmCharts.copyProperties(a,d);d.scrollbarHeight=a.height;d.graph=f;this.listenTo(d,"zoomed",this.handleScrollbarZoom);f=document.createElement("div");
22
- f.style.height=a.height+"px";d=this.periodSelectorContainer;c=this.periodSelector;e=this.centerContainer;"bottom"==a.position?c?"bottom"==c.position?e.insertBefore(f,d):e.appendChild(f):e.appendChild(f):c?"top"==c.position?e.insertBefore(f,d.nextSibling):e.insertBefore(f,e.firstChild):e.insertBefore(f,e.firstChild);b.write(f)}},handleScrollbarZoom:function(a){if(this.skipScrollbarEvent)this.skipScrollbarEvent=!1;else{var b=a.endDate,c={};c.startDate=a.startDate;c.endDate=b;this.updateScrollbar=!1;
23
- this.handleZoom(c)}},addPeriodSelector:function(){var a=this.periodSelector;if(a){var b=this.categoryAxesSettings.minPeriod;a.minDuration=AmCharts.getPeriodDuration(b);a.minPeriod=b;a.chart=this;var c=this.dataSetSelector,d,b=this.dssContainer;c&&(d=c.position);var c=this.panelsSettings.panelSpacing,e=document.createElement("div");this.periodSelectorContainer=e;var h=this.leftContainer,f=this.rightContainer,g=this.centerContainer,k=this.panelsContainer,m=a.width+2*c+"px";switch(a.position){case "left":h.style.width=
24
- a.width+"px";h.appendChild(e);g.style.paddingLeft=m;break;case "right":g.style.marginRight=m;f.appendChild(e);f.style.width=a.width+"px";break;case "top":k.style.clear="both";g.insertBefore(e,k);e.style.paddingBottom=c+"px";e.style.overflow="hidden";break;case "bottom":e.style.marginTop=c+"px","bottom"==d?g.insertBefore(e,b):g.appendChild(e)}this.listenTo(a,"changed",this.handlePeriodSelectorZoom);a.write(e)}},addDataSetSelector:function(){var a=this.dataSetSelector;if(a){a.chart=this;a.dataProvider=
25
- this.dataSets;var b=a.position,c=this.panelsSettings.panelSpacing,d=document.createElement("div");this.dssContainer=d;var e=this.leftContainer,h=this.rightContainer,f=this.centerContainer,g=this.panelsContainer,c=a.width+2*c+"px";switch(b){case "left":e.style.width=a.width+"px";e.appendChild(d);f.style.paddingLeft=c;break;case "right":f.style.marginRight=c;h.appendChild(d);h.style.width=a.width+"px";break;case "top":g.style.clear="both";f.insertBefore(d,g);d.style.overflow="hidden";break;case "bottom":f.appendChild(d)}a.write(d)}},
26
- handlePeriodSelectorZoom:function(a){var b=this.scrollbarChart;b&&(b.updateScrollbar=!0);a.predefinedPeriod?(this.predefinedStart=a.startDate,this.predefinedEnd=a.endDate):this.predefinedEnd=this.predefinedStart=null;this.zoomChart(a.startDate,a.endDate)},addCursor:function(a){var b=this.chartCursorSettings;if(b.enabled){var c=new AmCharts.ChartCursor(this.theme);AmCharts.copyProperties(b,c);a.removeChartCursor();a.addChartCursor(c);this.listenTo(c,"changed",this.handleCursorChange);this.listenTo(c,
27
- "onHideCursor",this.hideChartCursor);this.listenTo(c,"zoomed",this.handleCursorZoom);this.chartCursors.push(c)}},hideChartCursor:function(){var a=this.chartCursors,b;for(b=0;b<a.length;b++){var c=a[b];c.hideCursor(!1);(c=c.chart)&&c.updateLegendValues()}},handleCursorZoom:function(a){var b=this.scrollbarChart;b&&(b.updateScrollbar=!0);var b={},c;if(this.categoryAxesSettings.equalSpacing){var d=this.mainDataSet.categoryField,e=this.mainDataSet.agregatedDataProviders[this.currentPeriod];c=new Date(e[a.start][d]);
28
- a=new Date(e[a.end][d])}else c=new Date(a.start),a=new Date(a.end);b.startDate=c;b.endDate=a;this.handleZoom(b)},handleZoom:function(a){this.zoomChart(a.startDate,a.endDate)},zoomChart:function(a,b){var c=this,d=c.firstDate,e=c.lastDate,h=c.currentPeriod,f=c.categoryAxesSettings,g=f.minPeriod,k=c.panelsSettings,m=c.periodSelector,q=c.panels,x=c.comparedGraphs,t=c.scrollbarChart,y=c.firstDayOfWeek;if(d&&e){a||(a=d);b||(b=e);if(h){var u=AmCharts.extractPeriod(h);a.getTime()==b.getTime()&&u!=g&&(b=AmCharts.changeDate(b,
29
- u.period,u.count),b.setTime(b.getTime()-1))}a.getTime()<d.getTime()&&(a=d);a.getTime()>e.getTime()&&(a=e);b.getTime()<d.getTime()&&(b=d);b.getTime()>e.getTime()&&(b=e);e=AmCharts.getItemIndex(g,f.groupToPeriods);d=h;h=c.choosePeriod(e,a,b);c.currentPeriod=h;e=AmCharts.extractPeriod(h);AmCharts.getPeriodDuration(e.period,e.count);AmCharts.getPeriodDuration(g);1>b.getTime()-a.getTime()&&(a=new Date(b.getTime()-1));g=new Date(a);for(f=0;f<q.length;f++){u=q[f];if(h!=d){var n;for(n=0;n<x.length;n++){var w=
30
- x[n].graph;w.dataProvider=w.dataSet.agregatedDataProviders[h]}n=u.categoryAxis;n.firstDayOfWeek=y;n.minPeriod=h;u.dataProvider=c.mainDataSet.agregatedDataProviders[h];if(n=u.chartCursor)n.categoryBalloonDateFormat=c.chartCursorSettings.categoryBalloonDateFormat(e.period),u.showCategoryAxis||(n.categoryBalloonEnabled=!1);u.startTime=g.getTime();u.endTime=b.getTime();u.validateData(!0)}n=!1;u.chartCursor&&u.chartCursor.panning&&(n=!0);n||(u.startTime=void 0,u.endTime=void 0,u.zoomToDates(g,b));0<k.startDuration&&
31
- c.animationPlayed?(u.startDuration=0,u.animateAgain()):0<k.startDuration&&u.animateAgain()}c.animationPlayed=!0;AmCharts.extractPeriod(h);k=new Date(b);t&&c.updateScrollbar&&(t.zoomToDates(a,k),c.skipScrollbarEvent=!0,setTimeout(function(){c.resetSkip.call(c)},100));c.updateScrollbar=!0;c.startDate=a;c.endDate=b;m&&m.zoom(a,b);if(a.getTime()!=c.previousStartDate.getTime()||b.getTime()!=c.previousEndDate.getTime())m={type:"zoomed"},m.startDate=a,m.endDate=b,m.chart=c,m.period=h,c.fire(m.type,m),c.previousStartDate=
32
- new Date(a),c.previousEndDate=new Date(b)}c.eventsHidden&&c.showHideEvents(!1);c.chartCreated||(h="init",c.fire(h,{type:h,chart:c}));c.chartRendered||(h="rendered",c.fire(h,{type:h,chart:c}),c.chartRendered=!0);h="drawn";c.fire(h,{type:h,chart:c});c.chartCreated=!0;c.animationPlayed=!0},resetSkip:function(){this.skipScrollbarEvent=!1},updateGraphs:function(){this.getSelections();if(0<this.dataSets.length){var a=this.panels;this.comparedGraphs=[];var b;for(b=0;b<a.length;b++){var c=a[b],d=c.valueAxes,
33
- e;for(e=0;e<d.length;e++){var h=d[e];h.prevLog&&(h.logarithmic=h.prevLog);h.recalculateToPercents="always"==c.recalculateToPercents?!0:!1}d=this.mainDataSet;e=this.comparedDataSets;h=c.stockGraphs;c.graphs=[];var f;for(f=0;f<h.length;f++){var g=h[f],g=AmCharts.processObject(g,AmCharts.StockGraph,this.theme);h[f]=g;if(!g.title||g.resetTitleOnDataSetChange)g.title=d.title,g.resetTitleOnDataSetChange=!0;g.useDataSetColors&&(g.lineColor=d.color,g.fillColors=void 0,g.bulletColor=void 0);c.addGraph(g);
34
- var k=!1;"always"==c.recalculateToPercents&&(k=!0);var m=c.stockLegend,q,x,t,y;m&&(m=AmCharts.processObject(m,AmCharts.StockLegend,this.theme),c.stockLegend=m,q=m.valueTextComparing,x=m.valueTextRegular,t=m.periodValueTextComparing,y=m.periodValueTextRegular);if(g.comparable){var u=e.length;0<u&&g.valueAxis.logarithmic&&"never"!=c.recalculateToPercents&&(g.valueAxis.logarithmic=!1,g.valueAxis.prevLog=!0);0<u&&"whenComparing"==c.recalculateToPercents&&(g.valueAxis.recalculateToPercents=!0);m&&g.valueAxis&&
35
- !0===g.valueAxis.recalculateToPercents&&(k=!0);var n;for(n=0;n<u;n++){var w=e[n],p=g.comparedGraphs[w.id];p||(p=new AmCharts.AmGraph(this.theme),p.id="comparedGraph"+n+"_"+w.id);p.periodValue=g.periodValue;p.dataSet=w;p.behindColumns=g.behindColumns;g.comparedGraphs[w.id]=p;p.seriesIdField="amCategoryIdField";p.connect=g.connect;var l=g.compareField;l||(l=g.valueField);var D=!1,A=w.fieldMappings,z;for(z=0;z<A.length;z++)A[z].toField==l&&(D=!0);if(D){p.valueField=l;p.title=w.title;p.lineColor=w.color;
36
- g.compareGraphType&&(p.type=g.compareGraphType);l=g.compareGraphLineThickness;isNaN(l)||(p.lineThickness=l);l=g.compareGraphDashLength;isNaN(l)||(p.dashLength=l);l=g.compareGraphLineAlpha;isNaN(l)||(p.lineAlpha=l);l=g.compareGraphCornerRadiusTop;isNaN(l)||(p.cornerRadiusTop=l);l=g.compareGraphCornerRadiusBottom;isNaN(l)||(p.cornerRadiusBottom=l);l=g.compareGraphBalloonColor;isNaN(l)||(p.balloonColor=l);if(l=g.compareGraphFillColors)p.fillColors=l;if(l=g.compareGraphNegativeFillColors)p.negativeFillColors=
37
- l;if(l=g.compareGraphFillAlphas)p.fillAlphas=l;if(l=g.compareGraphNegativeFillAlphas)p.negativeFillAlphas=l;if(l=g.compareGraphBullet)p.bullet=l;if(l=g.compareGraphNumberFormatter)p.numberFormatter=l;l=g.compareGraphPrecision;isNaN(l)||(p.precision=l);if(l=g.compareGraphBalloonText)p.balloonText=l;l=g.compareGraphBulletSize;isNaN(l)||(p.bulletSize=l);l=g.compareGraphBulletAlpha;isNaN(l)||(p.bulletAlpha=l);l=g.compareGraphBulletBorderAlpha;isNaN(l)||(p.bulletBorderAlpha=l);if(l=g.compareGraphBulletBorderColor)p.bulletBorderColor=
38
- l;l=g.compareGraphBulletBorderThickness;isNaN(l)||(p.bulletBorderThickness=l);p.visibleInLegend=g.compareGraphVisibleInLegend;p.balloonFunction=g.compareGraphBalloonFunction;p.hideBulletsCount=g.hideBulletsCount;p.valueAxis=g.valueAxis;m&&(k&&q?(p.legendValueText=q,p.legendPeriodValueText=t):(x&&(p.legendValueText=x),y&&(p.legendPeriodValueText=y)));c.addGraph(p);this.comparedGraphs.push({graph:p,dataSet:w})}}}m&&(k&&q?(g.legendValueText=q,g.legendPeriodValueText=t):(x&&(g.legendValueText=x),y&&(g.legendPeriodValueText=
39
- y)))}}}},choosePeriod:function(a,b,c){var d=this.categoryAxesSettings,e=d.groupToPeriods,h=e[a],e=e[a+1],f=AmCharts.extractPeriod(h),f=AmCharts.getPeriodDuration(f.period,f.count),g=b.getTime(),k=c.getTime(),d=d.maxSeries;return(k-g)/f>d&&0<d&&e?this.choosePeriod(a+1,b,c):h},handleCursorChange:function(a){var b=a.target,c=a.position;a=a.zooming;var d=this.chartCursors,e;for(e=0;e<d.length;e++){var h=d[e];h!=b&&c&&(h.isZooming(a),h.previousMousePosition=NaN,h.forceShow=!0,h.setPosition(c,!1))}},getSelections:function(){var a=
40
- [],b=this.dataSets,c;for(c=0;c<b.length;c++){var d=b[c];d.compared&&a.push(d)}this.comparedDataSets=a;b=this.panels;for(c=0;c<b.length;c++)d=b[c],"never"!=d.recalculateToPercents&&0<a.length?d.hideDrawingIcons(!0):d.drawingIconsEnabled&&d.hideDrawingIcons(!1)},addPanel:function(a){this.panels.push(a);AmCharts.removeChart(a);AmCharts.addChart(a)},addPanelAt:function(a,b){this.panels.splice(b,0,a);AmCharts.removeChart(a);AmCharts.addChart(a)},removePanel:function(a){var b=this.panels,c;for(c=b.length-
41
- 1;0<=c;c--)if(b[c]==a){var d={type:"panelRemoved",panel:a,chart:this};this.fire(d.type,d);b.splice(c,1);a.destroy();a.clear()}},validateData:function(){this.resetDataParsed();this.updateDataSets();this.mainDataSet.compared=!1;this.updateGraphs();this.updateData();var a=this.dataSetSelector;a&&a.write(a.div)},resetDataParsed:function(){var a=this.dataSets,b;for(b=0;b<a.length;b++)a[b].dataParsed=!1},validateNow:function(){this.skipDefault=!0;this.chartRendered=!1;this.clear(!0);this.write(this.div)},
42
- hideStockEvents:function(){this.showHideEvents(!1);this.eventsHidden=!0},showStockEvents:function(){this.showHideEvents(!0);this.eventsHidden=!1},showHideEvents:function(a){var b=this.panels,c;for(c=0;c<b.length;c++){var d=b[c].graphs,e;for(e=0;e<d.length;e++){var h=d[e];!0===a?h.showBullets():h.hideBullets()}}},invalidateSize:function(){var a=this;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateNow()},5);a.validateTO=b},measure:function(){var a=this.div,b=a.offsetWidth,c=a.offsetHeight;
43
- a.clientHeight&&(b=a.clientWidth,c=a.clientHeight);this.divRealWidth=b;this.divRealHeight=c},clear:function(a){var b=this.panels,c;if(b)for(c=0;c<b.length;c++){var d=b[c];a||(d.cleanChart(),d.destroy());d.clear(a)}(b=this.scrollbarChart)&&b.clear();if(b=this.div)b.innerHTML="";a||(this.div=null,AmCharts.deleteObject(this))}});AmCharts.StockEvent=AmCharts.Class({construct:function(){}});AmCharts.DataSet=AmCharts.Class({construct:function(){this.cname="DataSet";this.fieldMappings=[];this.dataProvider=[];this.agregatedDataProviders=[];this.stockEvents=[];this.compared=!1;this.showInCompare=this.showInSelect=!0}});AmCharts.PeriodSelector=AmCharts.Class({construct:function(a){this.cname="PeriodSelector";this.theme=a;this.createEvents("changed");this.inputFieldsEnabled=!0;this.position="bottom";this.width=180;this.fromText="From: ";this.toText="to: ";this.periodsText="Zoom: ";this.periods=[];this.inputFieldWidth=100;this.dateFormat="DD-MM-YYYY";this.hideOutOfScopePeriods=!0;AmCharts.applyTheme(this,a,this.cname)},zoom:function(a,b){this.inputFieldsEnabled&&(this.startDateField.value=AmCharts.formatDate(a,this.dateFormat),
44
- this.endDateField.value=AmCharts.formatDate(b,this.dateFormat));this.markButtonAsSelected()},write:function(a){var b=this;a.className="amChartsPeriodSelector";var c=b.width,d=b.position;b.width=void 0;b.position=void 0;AmCharts.applyStyles(a.style,b);b.width=c;b.position=d;b.div=a;a.innerHTML="";c=b.theme;d=b.position;d="top"==d||"bottom"==d?!1:!0;b.vertical=d;var e=0,h=0;if(b.inputFieldsEnabled){var f=document.createElement("div");a.appendChild(f);var g=document.createTextNode(b.fromText);f.appendChild(g);
45
- d?AmCharts.addBr(f):(f.style.styleFloat="left",f.style.display="inline");var k=document.createElement("input");k.className="amChartsInputField";c&&AmCharts.applyStyles(k.style,c.PeriodInputField);k.style.textAlign="center";k.onblur=function(a){b.handleCalChange(a)};AmCharts.isNN&&k.addEventListener("keypress",function(a){b.handleCalendarChange.call(b,a)},!0);AmCharts.isIE&&k.attachEvent("onkeypress",function(a){b.handleCalendarChange.call(b,a)});f.appendChild(k);b.startDateField=k;if(d)g=b.width-
46
- 6+"px",AmCharts.addBr(f);else{var g=b.inputFieldWidth+"px",m=document.createTextNode(" ");f.appendChild(m)}k.style.width=g;k=document.createTextNode(b.toText);f.appendChild(k);d&&AmCharts.addBr(f);k=document.createElement("input");k.className="amChartsInputField";c&&AmCharts.applyStyles(k.style,c.PeriodInputField);k.style.textAlign="center";k.onblur=function(){b.handleCalChange()};AmCharts.isNN&&k.addEventListener("keypress",function(a){b.handleCalendarChange.call(b,a)},!0);AmCharts.isIE&&k.attachEvent("onkeypress",
47
- function(a){b.handleCalendarChange.call(b,a)});f.appendChild(k);b.endDateField=k;d?AmCharts.addBr(f):e=k.offsetHeight+2;g&&(k.style.width=g)}f=b.periods;if(AmCharts.ifArray(f)){g=document.createElement("div");d||(g.style.cssFloat="right",g.style.styleFloat="right",g.style.display="inline");a.appendChild(g);d&&AmCharts.addBr(g);a=document.createTextNode(b.periodsText);g.appendChild(a);b.periodContainer=g;var q;for(a=0;a<f.length;a++)k=f[a],q=document.createElement("input"),q.type="button",q.value=
48
- k.label,q.period=k.period,q.count=k.count,q.periodObj=k,q.className="amChartsButton",c&&AmCharts.applyStyles(q.style,c.PeriodButton),d&&(q.style.width=b.width-1+"px"),q.style.boxSizing="border-box",g.appendChild(q),b.addEventListeners(q),k.button=q;!d&&q&&(h=q.offsetHeight);b.offsetHeight=Math.max(e,h)}},addEventListeners:function(a){var b=this;AmCharts.isNN&&a.addEventListener("click",function(a){b.handlePeriodChange.call(b,a)},!0);AmCharts.isIE&&a.attachEvent("onclick",function(a){b.handlePeriodChange.call(b,
49
- a)})},getPeriodDates:function(){var a=this.periods,b;for(b=0;b<a.length;b++)this.selectPeriodButton(a[b],!0)},handleCalendarChange:function(a){13==a.keyCode&&this.handleCalChange(a)},handleCalChange:function(a){var b=this.dateFormat,c=AmCharts.stringToDate(this.startDateField.value,b),b=this.chart.getLastDate(AmCharts.stringToDate(this.endDateField.value,b));try{this.startDateField.blur(),this.endDateField.blur()}catch(d){}if(c&&b){var e={type:"changed"};e.startDate=c;e.endDate=b;e.chart=this.chart;
50
- e.event=a;this.fire(e.type,e)}},handlePeriodChange:function(a){this.selectPeriodButton((a.srcElement?a.srcElement:a.target).periodObj,!1,a)},setRanges:function(a,b){this.firstDate=a;this.lastDate=b;this.getPeriodDates()},selectPeriodButton:function(a,b,c){var d=a.button,e=d.count,h=d.period,f,g,k=this.firstDate,m=this.lastDate,q,x=this.theme;k&&m&&("MAX"==h?(f=k,g=m):"YTD"==h?(f=new Date,f.setMonth(0,1),f.setHours(0,0,0,0),0===e&&f.setDate(f.getDate()-1),g=this.lastDate):"YYYY"==h||"MM"==h?this.selectFromStart?
51
- (f=k,g=new Date(k),g.setMonth(g.getMonth()+e)):(f=new Date(m),AmCharts.changeDate(f,h,e,!1),f.setDate(f.getDate()-1),g=m):(q=AmCharts.getPeriodDuration(h,e),this.selectFromStart?(f=k,g=new Date(k.getTime()+q-1)):(f=new Date(m.getTime()-q+1),g=m)),a.startTime=f.getTime(),this.hideOutOfScopePeriods&&(b&&a.startTime<k.getTime()?d.style.display="none":d.style.display="inline"),f.getTime()>m.getTime()&&(q=AmCharts.getPeriodDuration("DD",1),f=new Date(m.getTime()-q)),f.getTime()<k.getTime()&&(f=k),"YTD"==
52
- h&&(a.startTime=f.getTime()),a.endTime=g.getTime(),b||(this.skipMark=!0,this.unselectButtons(),d.className="amChartsButtonSelected",x&&AmCharts.applyStyles(d.style,x.PeriodButtonSelected),a={type:"changed"},a.startDate=f,a.endDate=g,a.predefinedPeriod=h,a.chart=this.chart,a.count=e,a.event=c,this.fire(a.type,a)))},markButtonAsSelected:function(){if(!this.skipMark){var a=this.chart,b=this.periods,c=a.startDate.getTime(),a=a.endDate.getTime(),d=this.theme;this.unselectButtons();var e;for(e=b.length-
53
- 1;0<=e;e--){var h=b[e],f=h.button;h.startTime&&h.endTime&&c==h.startTime&&a==h.endTime&&(this.unselectButtons(),f.className="amChartsButtonSelected",d&&AmCharts.applyStyles(f.style,d.PeriodButtonSelected))}}this.skipMark=!1},unselectButtons:function(){var a=this.periods,b,c=this.theme;for(b=a.length-1;0<=b;b--){var d=a[b].button;d.className="amChartsButton";c&&AmCharts.applyStyles(d.style,c.PeriodButton)}},setDefaultPeriod:function(){var a=this.periods,b;for(b=0;b<a.length;b++){var c=a[b];c.selected&&
54
- this.selectPeriodButton(c)}}});AmCharts.StockGraph=AmCharts.Class({inherits:AmCharts.AmGraph,construct:function(a){AmCharts.StockGraph.base.construct.call(this,a);this.cname="StockGraph";this.useDataSetColors=!0;this.periodValue="Close";this.compareGraphType="line";this.compareGraphVisibleInLegend=!0;this.comparable=this.resetTitleOnDataSetChange=!1;this.comparedGraphs={};this.showEventsOnComparedGraphs=!1;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.StockPanel=AmCharts.Class({inherits:AmCharts.AmSerialChart,construct:function(a){AmCharts.StockPanel.base.construct.call(this,a);this.cname="StockPanel";this.theme=a;this.showCategoryAxis=!0;this.recalculateToPercents="whenComparing";this.panelHeaderPaddingBottom=this.panelHeaderPaddingLeft=this.panelHeaderPaddingRight=this.panelHeaderPaddingTop=0;this.trendLineAlpha=1;this.trendLineColor="#00CC00";this.trendLineColorHover="#CC0000";this.trendLineThickness=2;this.trendLineDashLength=0;this.stockGraphs=
55
- [];this.drawingIconsEnabled=!1;this.iconSize=18;this.autoMargins=this.allowTurningOff=this.eraseAll=this.erasingEnabled=this.drawingEnabled=!1;AmCharts.applyTheme(this,a,this.cname)},initChart:function(a){AmCharts.StockPanel.base.initChart.call(this,a);this.drawingIconsEnabled&&this.createDrawIcons();(a=this.chartCursor)&&this.listenTo(a,"draw",this.handleDraw)},addStockGraph:function(a){this.stockGraphs.push(a);return a},removeStockGraph:function(a){var b=this.stockGraphs,c;for(c=b.length-1;0<=c;c--)b[c]==
56
- a&&b.splice(c,1)},createDrawIcons:function(){var a=this,b=a.iconSize,c=a.container,d=a.pathToImages,e=a.realWidth-2*b-1-a.marginRight,h=AmCharts.rect(c,b,b,"#000",0.005),f=AmCharts.rect(c,b,b,"#000",0.005);f.translate(b+1,0);var g=c.image(d+"pencilIcon.gif",0,0,b,b);a.pencilButton=g;f.setAttr("cursor","pointer");h.setAttr("cursor","pointer");h.mouseup(function(){a.handlePencilClick()});var k=c.image(d+"pencilIconH.gif",0,0,b,b);a.pencilButtonPushed=k;a.drawingEnabled||k.hide();var m=c.image(d+"eraserIcon.gif",
57
- b+1,0,b,b);a.eraserButton=m;f.mouseup(function(){a.handleEraserClick()});h.touchend&&(h.touchend(function(){a.handlePencilClick()}),f.touchend(function(){a.handleEraserClick()}));b=c.image(d+"eraserIconH.gif",b+1,0,b,b);a.eraserButtonPushed=b;a.erasingEnabled||b.hide();c=c.set([g,k,m,b,h,f]);c.translate(e,1);this.hideIcons&&c.hide()},handlePencilClick:function(){var a=!this.drawingEnabled;this.disableDrawing(!a);this.erasingEnabled=!1;this.eraserButtonPushed.hide();a?this.pencilButtonPushed.show():
58
- (this.pencilButtonPushed.hide(),this.setMouseCursor("auto"))},disableDrawing:function(a){this.drawingEnabled=!a;var b=this.chartCursor;this.stockChart.enableCursors(a);b&&b.enableDrawing(!a)},handleEraserClick:function(){this.disableDrawing(!0);this.pencilButtonPushed.hide();if(this.eraseAll){var a=this.trendLines,b;for(b=a.length-1;0<=b;b--){var c=a[b];c.isProtected||this.removeTrendLine(c)}this.validateNow()}else(this.erasingEnabled=a=!this.erasingEnabled)?(this.eraserButtonPushed.show(),this.setTrendColorHover(this.trendLineColorHover),
59
- this.setMouseCursor("auto")):(this.eraserButtonPushed.hide(),this.setTrendColorHover())},setTrendColorHover:function(a){var b=this.trendLines,c;for(c=b.length-1;0<=c;c--){var d=b[c];d.isProtected||(d.rollOverColor=a)}},handleDraw:function(a){var b=this.drawOnAxis;AmCharts.isString(b)&&(b=this.getValueAxisById(b));b||(b=this.valueAxes[0]);this.drawOnAxis=b;var c=this.categoryAxis,d=a.initialX,e=a.finalX,h=a.initialY;a=a.finalY;var f=new AmCharts.TrendLine(this.theme);f.initialDate=c.coordinateToDate(d);
60
- f.finalDate=c.coordinateToDate(e);f.initialValue=b.coordinateToValue(h);f.finalValue=b.coordinateToValue(a);f.lineAlpha=this.trendLineAlpha;f.lineColor=this.trendLineColor;f.lineThickness=this.trendLineThickness;f.dashLength=this.trendLineDashLength;f.valueAxis=b;f.categoryAxis=c;this.addTrendLine(f);this.listenTo(f,"click",this.handleTrendClick);this.validateNow()},hideDrawingIcons:function(a){(this.hideIcons=a)&&this.disableDrawing(a)},handleTrendClick:function(a){this.erasingEnabled&&(a=a.trendLine,
61
- this.eraseAll||a.isProtected||this.removeTrendLine(a),this.validateNow())},handleWheelReal:function(a,b){var c=this.scrollbarChart;if(!this.wheelBusy&&c){var d=1;b&&(d=-1);var c=c.chartScrollbar,e=this.categoryAxis.minDuration();0>a?(d=this.startTime+d*e,e=this.endTime+1*e):(d=this.startTime-d*e,e=this.endTime-1*e);d<this.firstTime&&(d=this.firstTime);e>this.lastTime&&(e=this.lastTime);d<e&&c.timeZoom(d,e,!0)}}});AmCharts.CategoryAxesSettings=AmCharts.Class({construct:function(a){this.cname="CategoryAxesSettings";this.minPeriod="DD";this.equalSpacing=!1;this.axisHeight=28;this.tickLength=this.axisAlpha=0;this.gridCount=10;this.maxSeries=150;this.groupToPeriods="ss 10ss 30ss mm 10mm 30mm hh DD WW MM YYYY".split(" ");this.markPeriodChange=this.autoGridCount=!0;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.ChartCursorSettings=AmCharts.Class({construct:function(a){this.cname="ChartCursorSettings";this.enabled=!0;this.bulletsEnabled=this.valueBalloonsEnabled=!1;this.categoryBalloonDateFormats=[{period:"YYYY",format:"YYYY"},{period:"MM",format:"MMM, YYYY"},{period:"WW",format:"MMM DD, YYYY"},{period:"DD",format:"MMM DD, YYYY"},{period:"hh",format:"JJ:NN"},{period:"mm",format:"JJ:NN"},{period:"ss",format:"JJ:NN:SS"},{period:"fff",format:"JJ:NN:SS"}];AmCharts.applyTheme(this,a,this.cname)},categoryBalloonDateFormat:function(a){var b=
62
- this.categoryBalloonDateFormats,c,d;for(d=0;d<b.length;d++)b[d].period==a&&(c=b[d].format);return c}});AmCharts.ChartScrollbarSettings=AmCharts.Class({construct:function(a){this.cname="ChartScrollbarSettings";this.height=40;this.enabled=!0;this.color="#FFFFFF";this.updateOnReleaseOnly=this.autoGridCount=!0;this.hideResizeGrips=!1;this.position="bottom";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.LegendSettings=AmCharts.Class({construct:function(a){this.cname="LegendSettings";this.marginBottom=this.marginTop=0;this.usePositiveNegativeOnPercentsOnly=!0;this.positiveValueColor="#00CC00";this.negativeValueColor="#CC0000";this.autoMargins=this.equalWidths=this.textClickEnabled=!1;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.PanelsSettings=AmCharts.Class({construct:function(a){this.cname="PanelsSettings";this.marginBottom=this.marginTop=this.marginRight=this.marginLeft=0;this.backgroundColor="#FFFFFF";this.backgroundAlpha=0;this.panelSpacing=8;this.panEventsEnabled=!0;this.creditsPosition="top-right";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.StockEventsSettings=AmCharts.Class({construct:function(a){this.cname="StockEventsSettings";this.type="sign";this.backgroundAlpha=1;this.backgroundColor="#DADADA";this.borderAlpha=1;this.borderColor="#888888";this.balloonColor=this.rollOverColor="#CC0000";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.ValueAxesSettings=AmCharts.Class({construct:function(a){this.cname="ValueAxesSettings";this.tickLength=0;this.showFirstLabel=this.autoGridCount=this.inside=!0;this.showLastLabel=!1;this.axisAlpha=0;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.getItemIndex=function(a,b){var c=-1,d;for(d=0;d<b.length;d++)a==b[d]&&(c=d);return c};AmCharts.addBr=function(a){a.appendChild(document.createElement("br"))};AmCharts.applyStyles=function(a,b){if(b&&a)for(var c in a){var d=c,e=b[d];if(void 0!==e)try{a[d]=e}catch(h){}}};
63
- AmCharts.parseStockData=function(a,b,c,d,e){(new Date).getTime();var h={},f=a.dataProvider,g=a.categoryField;if(g){var k=AmCharts.getItemIndex(b,c),m=c.length,q,x=f.length,t,y={};for(q=k;q<m;q++)t=c[q],h[t]=[];var u={},n=a.fieldMappings,w=n.length;for(q=0;q<x;q++){var p=f[q],l=p[g],l=l instanceof Date?"fff"==b?AmCharts.useUTC?new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()):new Date(l.getFullYear(),l.getMonth(),
64
- l.getDate(),l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()):new Date(l):e?AmCharts.stringToDate(l,e):new Date(l),D=l.getTime(),A={};for(t=0;t<w;t++)A[n[t].toField]=p[n[t].fromField];var z;for(z=k;z<m;z++){t=c[z];var s=AmCharts.extractPeriod(t),B=s.period,E=s.count,v,r;if(z==k||D>=y[t]||!y[t]){u[t]={};u[t].amCategoryIdField=String(AmCharts.resetDateToMin(l,B,E,d).getTime());var C;for(C=0;C<w;C++)s=n[C].toField,v=u[t],r=Number(A[s]),v[s+"Count"]=0,v[s+"Sum"]=0,isNaN(r)||(v[s+"Open"]=
65
- r,v[s+"Sum"]=r,v[s+"High"]=r,v[s+"Low"]=r,v[s+"Close"]=r,v[s+"Count"]=1,v[s+"Average"]=r);v.dataContext=p;h[t].push(u[t]);z>k&&(s=new Date(l),s=AmCharts.changeDate(s,B,E,!0),s=AmCharts.resetDateToMin(s,B,E,d),y[t]=s.getTime());if(z==k)for(var F in p)p.hasOwnProperty(F)&&(u[t][F]=p[F]);u[t][g]=new Date(l)}else for(B=0;B<w;B++)s=n[B].toField,v=u[t],q==x-1&&(v[g]=new Date(l)),r=Number(A[s]),isNaN(r)||(isNaN(v[s+"Low"])&&(v[s+"Low"]=r),r<v[s+"Low"]&&(v[s+"Low"]=r),isNaN(v[s+"High"])&&(v[s+"High"]=r),
66
- r>v[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};
67
- AmCharts.parseEvents=function(a,b,c,d,e,h){var f=a.stockEvents,g=a.agregatedDataProviders,k=b.length,m,q,x,t,y,u,n,w;for(m=0;m<k;m++){u=b[m];y=u.graphs;x=y.length;var p;for(q=0;q<x;q++)t=y[q],t.customBulletField="amCustomBullet"+t.id+"_"+u.id,t.bulletConfigField="amCustomBulletConfig"+t.id+"_"+u.id;for(var l=0;l<f.length;l++)if(n=f[l],p=n.graph,AmCharts.isString(p)&&(p=AmCharts.getObjById(y,p)))n.graph=p}for(var D in g)if(g.hasOwnProperty(D)){p=g[D];var A=AmCharts.extractPeriod(D),z=p.length,s;for(s=
68
- 0;s<z;s++){var B=p[s];m=B[a.categoryField];w=m instanceof Date;h&&!w&&(m=AmCharts.stringToDate(m,h));var E=m.getTime();y=A.period;var l=A.count,v;v="fff"==y?m.getTime()+1:AmCharts.resetDateToMin(AmCharts.changeDate(new Date(m),A.period,A.count),y,l,d).getTime();for(m=0;m<k;m++)for(u=b[m],y=u.graphs,x=y.length,q=0;q<x;q++){t=y[q];var r={};r.eventDispatcher=e;r.eventObjects=[];r.letters=[];r.descriptions=[];r.shapes=[];r.backgroundColors=[];r.backgroundAlphas=[];r.borderColors=[];r.borderAlphas=[];
69
- r.colors=[];r.rollOverColors=[];r.showOnAxis=[];for(l=0;l<f.length;l++){n=f[l];w=n.date instanceof Date;h&&!w&&(n.date=AmCharts.stringToDate(n.date,h));w=n.date.getTime();var C=!1;n.graph&&(n.graph.showEventsOnComparedGraphs&&n.graph.comparedGraphs[a.id]&&(C=!0),(t==n.graph||C)&&w>=E&&w<v&&(r.eventObjects.push(n),r.letters.push(n.text),r.descriptions.push(n.description),n.type?r.shapes.push(n.type):r.shapes.push(c.type),void 0!==n.backgroundColor?r.backgroundColors.push(n.backgroundColor):r.backgroundColors.push(c.backgroundColor),
70
- isNaN(n.backgroundAlpha)?r.backgroundAlphas.push(c.backgroundAlpha):r.backgroundAlphas.push(n.backgroundAlpha),isNaN(n.borderAlpha)?r.borderAlphas.push(c.borderAlpha):r.borderAlphas.push(n.borderAlpha),void 0!==n.borderColor?r.borderColors.push(n.borderColor):r.borderColors.push(c.borderColor),void 0!==n.rollOverColor?r.rollOverColors.push(n.rollOverColor):r.rollOverColors.push(c.rollOverColor),r.colors.push(n.color),!n.panel&&n.graph&&(n.panel=n.graph.chart),r.showOnAxis.push(n.showOnAxis),r.date=
71
- new Date(n.date)));0<r.shapes.length&&(n="amCustomBullet"+t.id+"_"+u.id,w="amCustomBulletConfig"+t.id+"_"+u.id,B[n]=AmCharts.StackedBullet,B[w]=r)}}}}};AmCharts.StockLegend=AmCharts.Class({inherits:AmCharts.AmLegend,construct:function(a){AmCharts.StockLegend.base.construct.call(this,a);this.cname="StockLegend";this.valueTextComparing="[[percents.value]]%";this.valueTextRegular="[[value]]";AmCharts.applyTheme(this,a,this.cname)},drawLegend:function(){var a=this;AmCharts.StockLegend.base.drawLegend.call(a);var b=a.chart;if(b.allowTurningOff){var c=a.container,d=c.image(b.pathToImages+"xIcon.gif",b.realWidth-17,3,17,17),b=c.image(b.pathToImages+"xIconH.gif",
72
- b.realWidth-17,3,17,17);b.hide();a.xButtonHover=b;d.mouseup(function(){a.handleXClick()}).mouseover(function(){a.handleXOver()});b.mouseup(function(){a.handleXClick()}).mouseout(function(){a.handleXOut()})}},handleXOver:function(){this.xButtonHover.show()},handleXOut:function(){this.xButtonHover.hide()},handleXClick:function(){var a=this.chart,b=a.stockChart;b.removePanel(a);b.validateNow()}});AmCharts.DataSetSelector=AmCharts.Class({construct:function(a){this.cname="DataSetSelector";this.theme=a;this.createEvents("dataSetSelected","dataSetCompared","dataSetUncompared");this.position="left";this.selectText="Select:";this.comboBoxSelectText="Select...";this.compareText="Compare to:";this.width=180;this.dataProvider=[];this.listHeight=150;this.listCheckBoxSize=14;this.rollOverBackgroundColor="#b2e1ff";this.selectedBackgroundColor="#7fceff";AmCharts.applyTheme(this,a,this.cname)},write:function(a){var b=
73
- this,c,d=b.theme;a.className="amChartsDataSetSelector";var e=b.width;c=b.position;b.width=void 0;b.position=void 0;AmCharts.applyStyles(a.style,b);b.div=a;b.width=e;b.position=c;a.innerHTML="";var e=b.position,h;h="top"==e||"bottom"==e?!1:!0;b.vertical=h;var f;h&&(f=b.width+"px");var e=b.dataProvider,g,k;if(1<b.countDataSets("showInSelect")){c=document.createTextNode(b.selectText);a.appendChild(c);h&&AmCharts.addBr(a);var m=document.createElement("select");f&&(m.style.width=f);b.selectCB=m;d&&AmCharts.applyStyles(m.style,
74
- d.DataSetSelect);a.appendChild(m);AmCharts.isNN&&m.addEventListener("change",function(a){b.handleDataSetChange.call(b,a)},!0);AmCharts.isIE&&m.attachEvent("onchange",function(a){b.handleDataSetChange.call(b,a)});for(c=0;c<e.length;c++)if(g=e[c],!0===g.showInSelect){k=document.createElement("option");k.text=g.title;k.value=c;g==b.chart.mainDataSet&&(k.selected=!0);try{m.add(k,null)}catch(q){m.add(k)}}b.offsetHeight=m.offsetHeight}if(0<b.countDataSets("showInCompare")&&1<e.length)if(h?(AmCharts.addBr(a),
75
- AmCharts.addBr(a)):(c=document.createTextNode(" "),a.appendChild(c)),c=document.createTextNode(b.compareText),a.appendChild(c),k=b.listCheckBoxSize,h){AmCharts.addBr(a);f=document.createElement("div");a.appendChild(f);f.className="amChartsCompareList";d&&AmCharts.applyStyles(f.style,d.DataSetCompareList);f.style.overflow="auto";f.style.overflowX="hidden";f.style.width=b.width-2+"px";f.style.maxHeight=b.listHeight+"px";for(c=0;c<e.length;c++)g=e[c],!0===g.showInCompare&&g!=b.chart.mainDataSet&&(d=
76
- document.createElement("div"),d.style.padding="4px",d.style.position="relative",d.name="amCBContainer",d.dataSet=g,d.style.height=k+"px",g.compared&&(d.style.backgroundColor=b.selectedBackgroundColor),f.appendChild(d),h=document.createElement("div"),h.style.width=k+"px",h.style.height=k+"px",h.style.position="absolute",h.style.backgroundColor=g.color,d.appendChild(h),h=document.createElement("div"),h.style.width="100%",h.style.position="absolute",h.style.left=k+10+"px",d.appendChild(h),g=document.createTextNode(g.title),
77
- h.style.whiteSpace="nowrap",h.style.cursor="default",h.appendChild(g),b.addEventListeners(d));AmCharts.addBr(a);AmCharts.addBr(a)}else{d=document.createElement("select");b.compareCB=d;f&&(d.style.width=f);a.appendChild(d);AmCharts.isNN&&d.addEventListener("change",function(a){b.handleCBSelect.call(b,a)},!0);AmCharts.isIE&&d.attachEvent("onchange",function(a){b.handleCBSelect.call(b,a)});k=document.createElement("option");k.text=b.comboBoxSelectText;try{d.add(k,null)}catch(x){d.add(k)}for(c=0;c<e.length;c++)if(g=
78
- e[c],!0===g.showInCompare&&g!=b.chart.mainDataSet){k=document.createElement("option");k.text=g.title;k.value=c;g.compared&&(k.selected=!0);try{d.add(k,null)}catch(t){d.add(k)}}b.offsetHeight=d.offsetHeight}},addEventListeners:function(a){var b=this;AmCharts.isNN&&(a.addEventListener("mouseover",function(a){b.handleRollOver.call(b,a)},!0),a.addEventListener("mouseout",function(a){b.handleRollOut.call(b,a)},!0),a.addEventListener("click",function(a){b.handleClick.call(b,a)},!0));AmCharts.isIE&&(a.attachEvent("onmouseout",
79
- function(a){b.handleRollOut.call(b,a)}),a.attachEvent("onmouseover",function(a){b.handleRollOver.call(b,a)}),a.attachEvent("onclick",function(a){b.handleClick.call(b,a)}))},handleDataSetChange:function(){var a=this.selectCB,a=this.dataProvider[a.options[a.selectedIndex].value],b=this.chart;b.mainDataSet=a;b.zoomOutOnDataSetChange&&(b.startDate=void 0,b.endDate=void 0);b.validateData();a={type:"dataSetSelected",dataSet:a,chart:this.chart};this.fire(a.type,a)},handleRollOver:function(a){a=this.getRealDiv(a);
80
- a.dataSet.compared||(a.style.backgroundColor=this.rollOverBackgroundColor)},handleRollOut:function(a){a=this.getRealDiv(a);a.dataSet.compared||(a.style.removeProperty&&a.style.removeProperty("background-color"),a.style.removeAttribute&&a.style.removeAttribute("backgroundColor"))},handleCBSelect:function(a){var b=this.compareCB,c=this.dataProvider,d,e;for(d=0;d<c.length;d++)e=c[d],e.compared&&(a={type:"dataSetUncompared",dataSet:e}),e.compared=!1;c=b.selectedIndex;0<c&&(e=this.dataProvider[b.options[c].value],
81
- e.compared||(a={type:"dataSetCompared",dataSet:e}),e.compared=!0);b=this.chart;b.validateData();a.chart=b;this.fire(a.type,a)},handleClick:function(a){a=this.getRealDiv(a).dataSet;!0===a.compared?(a.compared=!1,a={type:"dataSetUncompared",dataSet:a}):(a.compared=!0,a={type:"dataSetCompared",dataSet:a});var b=this.chart;b.validateData();a.chart=b;this.fire(a.type,a)},getRealDiv:function(a){a||(a=window.event);a=a.currentTarget?a.currentTarget:a.srcElement;"amCBContainer"==a.parentNode.name&&(a=a.parentNode);
82
- return a},countDataSets:function(a){var b=this.dataProvider,c=0,d;for(d=0;d<b.length;d++)!0===b[d][a]&&c++;return c}});AmCharts.StackedBullet=AmCharts.Class({construct:function(){this.fontSize=11;this.stackDown=!1;this.mastHeight=8;this.shapes=[];this.backgroundColors=[];this.backgroundAlphas=[];this.borderAlphas=[];this.borderColors=[];this.colors=[];this.rollOverColors=[];this.showOnAxiss=[];this.textColor="#000000";this.nextY=0;this.size=16},parseConfig:function(){var a=this.bulletConfig;this.eventObjects=a.eventObjects;this.letters=a.letters;this.shapes=a.shapes;this.backgroundColors=a.backgroundColors;this.backgroundAlphas=
83
- a.backgroundAlphas;this.borderColors=a.borderColors;this.borderAlphas=a.borderAlphas;this.colors=a.colors;this.rollOverColors=a.rollOverColors;this.date=a.date;this.showOnAxiss=a.showOnAxis;this.axisCoordinate=a.minCoord},write:function(a){this.parseConfig();this.container=a;this.bullets=[];if(this.graph){var b=this.graph.fontSize;b&&(this.fontSize=b)}b=this.letters.length;(this.mastHeight+2*(this.fontSize/2+2))*b>this.availableSpace&&(this.stackDown=!0);this.set=a.set();a=0;var c;for(c=0;c<b;c++)this.shape=
84
- this.shapes[c],this.backgroundColor=this.backgroundColors[c],this.backgroundAlpha=this.backgroundAlphas[c],this.borderAlpha=this.borderAlphas[c],this.borderColor=this.borderColors[c],this.rollOverColor=this.rollOverColors[c],this.showOnAxis=this.showOnAxiss[c],this.color=this.colors[c],this.addLetter(this.letters[c],a,c),this.showOnAxis||a++},addLetter:function(a,b,c){var d=this.container;b=d.set();var e=-1,h=this.stackDown;this.showOnAxis&&(this.stackDown=this.graph.valueAxis.reversed?!0:!1);this.stackDown&&
85
- (e=1);var f=0,g=0,k=0,m,k=this.fontSize,q=this.mastHeight,x=this.shape,t=this.textColor;void 0!==this.color&&(t=this.color);void 0===a&&(a="");a=AmCharts.text(d,a,t,this.chart.fontFamily,this.fontSize);d=a.getBBox();this.labelWidth=t=d.width;this.labelHeight=d.height;d=0;switch(x){case "sign":m=this.drawSign(b);f=q+4+k/2;d=q+k+4;1==e&&(f-=4);break;case "flag":m=this.drawFlag(b);g=t/2+3;f=q+4+k/2;d=q+k+4;1==e&&(f-=4);break;case "pin":m=this.drawPin(b);f=6+k/2;d=k+8;break;case "triangleUp":m=this.drawTriangleUp(b);
86
- f=-k-1;d=k+4;e=-1;break;case "triangleDown":m=this.drawTriangleDown(b);f=k+1;d=k+4;e=-1;break;case "triangleLeft":m=this.drawTriangleLeft(b);g=k;d=k+4;e=-1;break;case "triangleRight":m=this.drawTriangleRight(b);g=-k;e=-1;d=k+4;break;case "arrowUp":m=this.drawArrowUp(b);a.hide();break;case "arrowDown":m=this.drawArrowDown(b);a.hide();d=k+4;break;case "text":e=-1;m=this.drawTextBackground(b,a);f=this.labelHeight+3;d=k+10;break;case "round":m=this.drawCircle(b)}this.bullets[c]=m;this.showOnAxis?(m=isNaN(this.nextAxisY)?
87
- this.axisCoordinate:this.nextY,k=f*e,this.nextAxisY=m+e*d):(m=this.nextY,k=f*e);a.translate(g,k);b.push(a);b.translate(0,m);this.addEventListeners(b,c);this.nextY=m+e*d;this.stackDown=h},addEventListeners:function(a,b){var c=this;a.click(function(){c.handleClick(b)}).mouseover(function(){c.handleMouseOver(b)}).touchend(function(){c.handleMouseOver(b,!0)}).mouseout(function(){c.handleMouseOut(b)})},drawPin:function(a){var b=-1;this.stackDown&&(b=1);var c=this.fontSize+4;return this.drawRealPolygon(a,
88
- [0,c/2,c/2,-c/2,-c/2,0],[0,b*c/4,b*(c+c/4),b*(c+c/4),b*c/4,0])},drawSign:function(a){var b=-1;this.stackDown&&(b=1);var c=this.mastHeight*b,d=this.fontSize/2+2,e=AmCharts.line(this.container,[0,0],[0,c],this.borderColor,this.borderAlpha,1),h=AmCharts.circle(this.container,d,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);h.translate(0,c+d*b);a.push(e);a.push(h);this.set.push(a);return h},drawFlag:function(a){var b=-1;this.stackDown&&(b=1);var c=this.fontSize+4,d=this.labelWidth+
89
- 6,e=this.mastHeight,b=1==b?b*e:b*e-c,e=AmCharts.line(this.container,[0,0],[0,b],this.borderColor,this.borderAlpha,1),c=AmCharts.polygon(this.container,[0,d,d,0],[0,0,c,c],this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);c.translate(0,b);a.push(e);a.push(c);this.set.push(a);return c},drawTriangleUp:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b/2,-b/2,0],[0,b,b,0])},drawArrowUp:function(a){var b=this.size,c=b/2,d=b/4;return this.drawRealPolygon(a,
90
- [0,c,d,d,-d,-d,-c,0],[0,c,c,b,b,c,c,0])},drawArrowDown:function(a){var b=this.size,c=b/2,d=b/4;return this.drawRealPolygon(a,[0,c,d,d,-d,-d,-c,0],[0,-c,-c,-b,-b,-c,-c,0])},drawTriangleDown:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b/2,-b/2,0],[0,-b,-b,0])},drawTriangleLeft:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b,b,0],[0,-b/2,b/2])},drawTriangleRight:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,-b,-b,0],[0,-b/2,b/2,0])},drawRealPolygon:function(a,
91
- b,c){b=AmCharts.polygon(this.container,b,c,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);a.push(b);this.set.push(a);return b},drawCircle:function(a){shape=AmCharts.circle(this.container,this.fontSize/2,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);a.push(shape);this.set.push(a);return shape},drawTextBackground:function(a,b){var c=b.getBBox(),d=-c.width/2-5,e=c.width/2+5,c=-c.height-12;return this.drawRealPolygon(a,[d,-5,0,5,e,e,d,d],
92
- [-5,-5,0,-5,-5,c,c,-5])},handleMouseOver:function(a,b){b||this.bullets[a].attr({fill:this.rollOverColors[a]});var c=this.eventObjects[a],d={type:"rollOverStockEvent",eventObject:c,graph:this.graph,date:this.date},e=this.bulletConfig.eventDispatcher;d.chart=e;e.fire(d.type,d);c.url&&this.bullets[a].setAttr("cursor","pointer");this.chart.showBalloon(AmCharts.fixNewLines(c.description),e.stockEventsSettings.balloonColor,!0)},handleClick:function(a){a=this.eventObjects[a];var b={type:"clickStockEvent",
1
+ 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=
2
+ !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=
3
+ 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,
4
+ 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,
5
+ 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();
6
+ 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;a<b.length;a++)panel=b[a],panel.invalidateSize()},updateDataSets:function(){var a=this.mainDataSet,b=this.dataSets,c;for(c=0;c<b.length;c++){var d=b[c],d=AmCharts.processObject(d,AmCharts.DataSet);b[c]=d;d.id||(this.dataSetCount++,
7
+ d.id="ds"+this.dataSetCount);void 0===d.color&&(d.color=this.colors.length-1>c?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(),
8
+ 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=
9
+ 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=
10
+ !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,
11
+ c;for(c=0;c<a.length;c++){var d=a[c];d.dataParsed||(AmCharts.parseStockData(d,b.minPeriod,b.groupToPeriods,this.firstDayOfWeek,this.dataDateFormat),d.dataParsed=!0);this.updateEvents(d)}},createLayout:function(){var a=this.div,b,c,d=document.createElement("div");d.style.position="relative";this.containerDiv=d;a.appendChild(d);if(a=this.periodSelector)b=a.position;if(a=this.dataSetSelector)c=a.position;if("left"==b||"left"==c)a=document.createElement("div"),a.style.cssFloat="left",a.style.styleFloat=
12
+ "left",a.style.width="0px",a.style.position="absolute",d.appendChild(a),this.leftContainer=a;if("right"==b||"right"==c)b=document.createElement("div"),b.style.cssFloat="right",b.style.styleFloat="right",b.style.width="0px",d.appendChild(b),this.rightContainer=b;b=document.createElement("div");d.appendChild(b);this.centerContainer=b;d=document.createElement("div");b.appendChild(d);this.panelsContainer=d},addPanels:function(){this.measurePanels();for(var a=this.panels,b=0;b<a.length;b++){var c=a[b],
13
+ c=AmCharts.processObject(c,AmCharts.StockPanel,this.theme);a[b]=c;this.addStockPanel(c,b)}this.panelsAdded=!0},measurePanels:function(){this.measure();var a=this.chartScrollbarSettings,b=this.divRealHeight,c=this.panelsSettings.panelSpacing;a.enabled&&(b-=a.height);(a=this.periodSelector)&&!a.vertical&&(a=a.offsetHeight,b-=a+c);(a=this.dataSetSelector)&&!a.vertical&&(a=a.offsetHeight,b-=a+c);a=this.panels;this.panelsContainer.style.height=b+"px";this.chartCursors=[];var d=0,e,h;for(e=0;e<a.length;e++){h=
14
+ a[e];var f=h.percentHeight;isNaN(f)&&(f=100/a.length,h.percentHeight=f);d+=f}this.panelsHeight=Math.max(b-c*(a.length-1),0);for(e=0;e<a.length;e++)h=a[e],h.percentHeight=h.percentHeight/d*100,h.panelBox&&(h.panelBox.style.height=Math.round(h.percentHeight*this.panelsHeight/100)+"px")},addStockPanel:function(a,b){var c=this.panelsSettings,d=document.createElement("div");d.className="amChartsPanel";0<b&&!this.panels[b-1].showCategoryAxis&&(d.style.marginTop=c.panelSpacing+"px");a.panelBox=d;a.stockChart=
15
+ this;a.id||(a.id="stockPanel"+b);a.pathToImages=this.pathToImages;d.style.height=Math.round(a.percentHeight*this.panelsHeight/100)+"px";d.style.width="100%";this.panelsContainer.appendChild(d);0<c.backgroundAlpha&&(d.style.backgroundColor=c.backgroundColor);if(d=a.stockLegend)d.container=void 0,d.title=a.title,d.marginLeft=c.marginLeft,d.marginRight=c.marginRight,d.verticalGap=3,d.position="top",AmCharts.copyProperties(this.legendSettings,d),a.addLegend(d,d.divId);a.zoomOutText="";a.removeChartCursor();
16
+ this.addCursor(a)},enableCursors:function(a){var b=this.chartCursors,c;for(c=0;c<b.length;c++)b[c].enabled=a},updatePanels:function(){var a=this.panels,b;for(b=0;b<a.length;b++)this.updatePanel(a[b]);this.mainDataSet&&this.updateGraphs();this.currentPeriod=void 0},updatePanel:function(a){a.seriesIdField="amCategoryIdField";a.dataProvider=[];a.chartData=[];a.graphs=[];var b=a.categoryAxis,c=this.categoryAxesSettings;AmCharts.copyProperties(this.panelsSettings,a);AmCharts.copyProperties(c,b);b.parseDates=
17
+ !0;a.zoomOutOnDataUpdate=!1;a.mouseWheelScrollEnabled=this.mouseWheelScrollEnabled;a.showCategoryAxis?"top"==b.position?a.marginTop=c.axisHeight:a.marginBottom=c.axisHeight:(a.categoryAxis.labelsEnabled=!1,a.chartCursor&&(a.chartCursor.categoryBalloonEnabled=!1));var c=a.valueAxes,d=c.length,e;0===d&&(e=new AmCharts.ValueAxis(this.theme),a.addValueAxis(e));b=new AmCharts.AmBalloon(this.theme);AmCharts.copyProperties(this.balloon,b);a.balloon=b;c=a.valueAxes;d=c.length;for(b=0;b<d;b++)e=c[b],AmCharts.copyProperties(this.valueAxesSettings,
18
+ e);a.listenersAdded=!1;a.write(a.panelBox)},zoom:function(a,b){this.zoomChart(a,b)},zoomOut:function(){this.zoomChart(this.firstDate,this.lastDate)},updatePanelsWithNewData:function(){var a=this.mainDataSet,b=this.scrollbarChart;if(a){var c=this.panels;this.currentPeriod=void 0;var d;for(d=0;d<c.length;d++){var e=c[d];e.categoryField=a.categoryField;0===a.dataProvider.length&&(e.dataProvider=[]);e.scrollbarChart=b}b&&(c=this.categoryAxesSettings,d=c.minPeriod,b.categoryField=a.categoryField,0<a.dataProvider.length?
19
+ (e=this.chartScrollbarSettings.usePeriod,b.dataProvider=e?a.agregatedDataProviders[e]:a.agregatedDataProviders[d]):b.dataProvider=[],e=b.categoryAxis,e.minPeriod=d,e.firstDayOfWeek=this.firstDayOfWeek,e.equalSpacing=c.equalSpacing,e.markPeriodChange=c.markPeriodChange,b.bbsetr=!0,b.validateData());0<a.dataProvider.length&&this.zoomChart(this.startDate,this.endDate)}this.panelDataInvalidated=!1},addChartScrollbar:function(){var a=this.chartScrollbarSettings,b=this.scrollbarChart;b&&(b.clear(),b.destroy());
20
+ if(a.enabled){var c=this.panelsSettings,d=this.categoryAxesSettings,b=new AmCharts.AmSerialChart(this.theme);b.pathToImages=this.pathToImages;b.autoMargins=!1;this.scrollbarChart=b;b.id="scrollbarChart";b.scrollbarOnly=!0;b.zoomOutText="";b.panEventsEnabled=this.panelsSettings.panEventsEnabled;b.marginLeft=c.marginLeft;b.marginRight=c.marginRight;b.marginTop=0;b.marginBottom=0;var c=d.dateFormats,e=b.categoryAxis;e.boldPeriodBeginning=d.boldPeriodBeginning;c&&(e.dateFormats=d.dateFormats);e.labelsEnabled=
21
+ !1;e.parseDates=!0;d=a.graph;if(AmCharts.isString(d)){c=this.panels;for(e=0;e<c.length;e++){var h=AmCharts.getObjById(c[e].stockGraphs,a.graph);h&&(d=h)}a.graph=d}var f;d&&(f=new AmCharts.AmGraph(this.theme),f.valueField=d.valueField,f.periodValue=d.periodValue,f.type=d.type,f.connect=d.connect,b.addGraph(f));d=new AmCharts.ChartScrollbar(this.theme);b.addChartScrollbar(d);AmCharts.copyProperties(a,d);d.scrollbarHeight=a.height;d.graph=f;this.listenTo(d,"zoomed",this.handleScrollbarZoom);f=document.createElement("div");
22
+ f.style.height=a.height+"px";d=this.periodSelectorContainer;c=this.periodSelector;e=this.centerContainer;"bottom"==a.position?c?"bottom"==c.position?e.insertBefore(f,d):e.appendChild(f):e.appendChild(f):c?"top"==c.position?e.insertBefore(f,d.nextSibling):e.insertBefore(f,e.firstChild):e.insertBefore(f,e.firstChild);b.write(f)}},handleScrollbarZoom:function(a){if(this.skipScrollbarEvent)this.skipScrollbarEvent=!1;else{var b=a.endDate,c={};c.startDate=a.startDate;c.endDate=b;this.updateScrollbar=!1;
23
+ this.handleZoom(c)}},addPeriodSelector:function(){var a=this.periodSelector;if(a){var b=this.categoryAxesSettings.minPeriod;a.minDuration=AmCharts.getPeriodDuration(b);a.minPeriod=b;a.chart=this;var c=this.dataSetSelector,d,b=this.dssContainer;c&&(d=c.position);var c=this.panelsSettings.panelSpacing,e=document.createElement("div");this.periodSelectorContainer=e;var h=this.leftContainer,f=this.rightContainer,g=this.centerContainer,k=this.panelsContainer,m=a.width+2*c+"px";switch(a.position){case "left":h.style.width=
24
+ a.width+"px";h.appendChild(e);g.style.paddingLeft=m;break;case "right":g.style.marginRight=m;f.appendChild(e);f.style.width=a.width+"px";break;case "top":k.style.clear="both";g.insertBefore(e,k);e.style.paddingBottom=c+"px";e.style.overflow="hidden";break;case "bottom":e.style.marginTop=c+"px","bottom"==d?g.insertBefore(e,b):g.appendChild(e)}this.listenTo(a,"changed",this.handlePeriodSelectorZoom);a.write(e)}},addDataSetSelector:function(){var a=this.dataSetSelector;if(a){a.chart=this;a.dataProvider=
25
+ this.dataSets;var b=a.position,c=this.panelsSettings.panelSpacing,d=document.createElement("div");this.dssContainer=d;var e=this.leftContainer,h=this.rightContainer,f=this.centerContainer,g=this.panelsContainer,c=a.width+2*c+"px";switch(b){case "left":e.style.width=a.width+"px";e.appendChild(d);f.style.paddingLeft=c;break;case "right":f.style.marginRight=c;h.appendChild(d);h.style.width=a.width+"px";break;case "top":g.style.clear="both";f.insertBefore(d,g);d.style.overflow="hidden";break;case "bottom":f.appendChild(d)}a.write(d)}},
26
+ handlePeriodSelectorZoom:function(a){var b=this.scrollbarChart;b&&(b.updateScrollbar=!0);a.predefinedPeriod?(this.predefinedStart=a.startDate,this.predefinedEnd=a.endDate):this.predefinedEnd=this.predefinedStart=null;this.zoomChart(a.startDate,a.endDate)},addCursor:function(a){var b=this.chartCursorSettings;if(b.enabled){var c=new AmCharts.ChartCursor(this.theme);AmCharts.copyProperties(b,c);a.removeChartCursor();a.addChartCursor(c);this.listenTo(c,"changed",this.handleCursorChange);this.listenTo(c,
27
+ "onHideCursor",this.hideChartCursor);this.listenTo(c,"zoomed",this.handleCursorZoom);this.chartCursors.push(c)}},hideChartCursor:function(){var a=this.chartCursors,b;for(b=0;b<a.length;b++){var c=a[b];c.hideCursor(!1);(c=c.chart)&&c.updateLegendValues()}},handleCursorZoom:function(a){var b=this.scrollbarChart;b&&(b.updateScrollbar=!0);var b={},c;if(this.categoryAxesSettings.equalSpacing){var d=this.mainDataSet.categoryField,e=this.mainDataSet.agregatedDataProviders[this.currentPeriod];c=new Date(e[a.start][d]);
28
+ a=new Date(e[a.end][d])}else c=new Date(a.start),a=new Date(a.end);b.startDate=c;b.endDate=a;this.handleZoom(b)},handleZoom:function(a){this.zoomChart(a.startDate,a.endDate)},zoomChart:function(a,b){var c=new Date(a),d=this,e=d.firstDate,h=d.lastDate,f=d.currentPeriod,g=d.categoryAxesSettings,k=g.minPeriod,m=d.panelsSettings,p=d.periodSelector,x=d.panels,t=d.comparedGraphs,w=d.scrollbarChart,y=d.firstDayOfWeek;if(e&&h){a||(a=e);b||(b=h);if(f){var n=AmCharts.extractPeriod(f);a.getTime()==b.getTime()&&
29
+ n!=k&&(b=AmCharts.changeDate(b,n.period,n.count),b.setTime(b.getTime()-1))}a.getTime()<e.getTime()&&(a=e);a.getTime()>h.getTime()&&(a=h);b.getTime()<e.getTime()&&(b=e);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;g<x.length;g++){n=x[g];if(f!=e){var u;
30
+ for(u=0;u<t.length;u++){var q=t[u].graph;q.dataProvider=q.dataSet.agregatedDataProviders[f]}u=n.categoryAxis;u.firstDayOfWeek=y;u.minPeriod=f;n.dataProvider=d.mainDataSet.agregatedDataProviders[f];if(u=n.chartCursor)u.categoryBalloonDateFormat=d.chartCursorSettings.categoryBalloonDateFormat(h.period),n.showCategoryAxis||(u.categoryBalloonEnabled=!1);n.startTime=k.getTime();n.endTime=b.getTime();n.validateData(!0)}u=!1;n.chartCursor&&n.chartCursor.panning&&(u=!0);u||(n.startTime=void 0,n.endTime=void 0,
31
+ n.zoomToDates(c,b));0<m.startDuration&&d.animationPlayed?(n.startDuration=0,n.animateAgain()):0<m.startDuration&&n.animateAgain()}d.animationPlayed=!0;AmCharts.extractPeriod(f);c=new Date(b);w&&d.updateScrollbar&&(w.zoomToDates(a,c),d.skipScrollbarEvent=!0,setTimeout(function(){d.resetSkip.call(d)},100));d.updateScrollbar=!0;d.startDate=a;d.endDate=b;p&&p.zoom(a,b);if(a.getTime()!=d.previousStartDate.getTime()||b.getTime()!=d.previousEndDate.getTime())p={type:"zoomed"},p.startDate=a,p.endDate=b,p.chart=
32
+ d,p.period=f,d.fire(p.type,p),d.previousStartDate=new Date(a),d.previousEndDate=new Date(b)}d.eventsHidden&&d.showHideEvents(!1);d.chartCreated||(f="init",d.fire(f,{type:f,chart:d}));d.chartRendered||(f="rendered",d.fire(f,{type:f,chart:d}),d.chartRendered=!0);f="drawn";d.fire(f,{type:f,chart:d});d.chartCreated=!0;d.animationPlayed=!0},resetSkip:function(){this.skipScrollbarEvent=!1},updateGraphs:function(){this.getSelections();if(0<this.dataSets.length){var a=this.panels;this.comparedGraphs=[];var b;
33
+ for(b=0;b<a.length;b++){var c=a[b],d=c.valueAxes,e;for(e=0;e<d.length;e++){var h=d[e];h.prevLog&&(h.logarithmic=h.prevLog);h.recalculateToPercents="always"==c.recalculateToPercents?!0:!1}d=this.mainDataSet;e=this.comparedDataSets;h=c.stockGraphs;c.graphs=[];var f;for(f=0;f<h.length;f++){var g=h[f],g=AmCharts.processObject(g,AmCharts.StockGraph,this.theme);h[f]=g;if(!g.title||g.resetTitleOnDataSetChange)g.title=d.title,g.resetTitleOnDataSetChange=!0;g.useDataSetColors&&(g.lineColor=d.color,g.fillColors=
34
+ void 0,g.bulletColor=void 0);c.addGraph(g);var k=!1;"always"==c.recalculateToPercents&&(k=!0);var m=c.stockLegend,p,x,t,w;m&&(m=AmCharts.processObject(m,AmCharts.StockLegend,this.theme),c.stockLegend=m,p=m.valueTextComparing,x=m.valueTextRegular,t=m.periodValueTextComparing,w=m.periodValueTextRegular);if(g.comparable){var y=e.length;0<y&&g.valueAxis.logarithmic&&"never"!=c.recalculateToPercents&&(g.valueAxis.logarithmic=!1,g.valueAxis.prevLog=!0);0<y&&"whenComparing"==c.recalculateToPercents&&(g.valueAxis.recalculateToPercents=
35
+ !0);m&&g.valueAxis&&!0===g.valueAxis.recalculateToPercents&&(k=!0);var n;for(n=0;n<y;n++){var u=e[n],q=g.comparedGraphs[u.id];q||(q=new AmCharts.AmGraph(this.theme),q.id="comparedGraph"+n+"_"+u.id);q.periodValue=g.periodValue;q.dataSet=u;q.behindColumns=g.behindColumns;g.comparedGraphs[u.id]=q;q.seriesIdField="amCategoryIdField";q.connect=g.connect;var l=g.compareField;l||(l=g.valueField);var D=!1,A=u.fieldMappings,z;for(z=0;z<A.length;z++)A[z].toField==l&&(D=!0);if(D){q.valueField=l;q.title=u.title;
36
+ q.lineColor=u.color;g.compareGraphType&&(q.type=g.compareGraphType);l=g.compareGraphLineThickness;isNaN(l)||(q.lineThickness=l);l=g.compareGraphDashLength;isNaN(l)||(q.dashLength=l);l=g.compareGraphLineAlpha;isNaN(l)||(q.lineAlpha=l);l=g.compareGraphCornerRadiusTop;isNaN(l)||(q.cornerRadiusTop=l);l=g.compareGraphCornerRadiusBottom;isNaN(l)||(q.cornerRadiusBottom=l);l=g.compareGraphBalloonColor;isNaN(l)||(q.balloonColor=l);if(l=g.compareGraphFillColors)q.fillColors=l;if(l=g.compareGraphNegativeFillColors)q.negativeFillColors=
37
+ l;if(l=g.compareGraphFillAlphas)q.fillAlphas=l;if(l=g.compareGraphNegativeFillAlphas)q.negativeFillAlphas=l;if(l=g.compareGraphBullet)q.bullet=l;if(l=g.compareGraphNumberFormatter)q.numberFormatter=l;l=g.compareGraphPrecision;isNaN(l)||(q.precision=l);if(l=g.compareGraphBalloonText)q.balloonText=l;l=g.compareGraphBulletSize;isNaN(l)||(q.bulletSize=l);l=g.compareGraphBulletAlpha;isNaN(l)||(q.bulletAlpha=l);l=g.compareGraphBulletBorderAlpha;isNaN(l)||(q.bulletBorderAlpha=l);if(l=g.compareGraphBulletBorderColor)q.bulletBorderColor=
38
+ l;l=g.compareGraphBulletBorderThickness;isNaN(l)||(q.bulletBorderThickness=l);q.visibleInLegend=g.compareGraphVisibleInLegend;q.balloonFunction=g.compareGraphBalloonFunction;q.hideBulletsCount=g.hideBulletsCount;q.valueAxis=g.valueAxis;m&&(k&&p?(q.legendValueText=p,q.legendPeriodValueText=t):(x&&(q.legendValueText=x),w&&(q.legendPeriodValueText=w)));c.showComparedOnTop?c.graphs.push(q):c.graphs.unshift(q);this.comparedGraphs.push({graph:q,dataSet:u})}}}m&&(k&&p?(g.legendValueText=p,g.legendPeriodValueText=
39
+ t):(x&&(g.legendValueText=x),w&&(g.legendPeriodValueText=w)))}}}},choosePeriod:function(a,b,c){var d=this.categoryAxesSettings,e=d.groupToPeriods,h=e[a],e=e[a+1],f=AmCharts.extractPeriod(h),f=AmCharts.getPeriodDuration(f.period,f.count),g=b.getTime(),k=c.getTime(),d=d.maxSeries;return(k-g)/f>d&&0<d&&e?this.choosePeriod(a+1,b,c):h},handleCursorChange:function(a){var b=a.target,c=a.position;a=a.zooming;var d=this.chartCursors,e;for(e=0;e<d.length;e++){var h=d[e];h!=b&&c&&(h.isZooming(a),h.previousMousePosition=
40
+ NaN,h.forceShow=!0,h.setPosition(c,!1))}},getSelections:function(){var a=[],b=this.dataSets,c;for(c=0;c<b.length;c++){var d=b[c];d.compared&&a.push(d)}this.comparedDataSets=a;b=this.panels;for(c=0;c<b.length;c++)d=b[c],"never"!=d.recalculateToPercents&&0<a.length?d.hideDrawingIcons(!0):d.drawingIconsEnabled&&d.hideDrawingIcons(!1)},addPanel:function(a){this.panels.push(a);AmCharts.removeChart(a);AmCharts.addChart(a)},addPanelAt:function(a,b){this.panels.splice(b,0,a);AmCharts.removeChart(a);AmCharts.addChart(a)},
41
+ removePanel:function(a){var b=this.panels,c;for(c=b.length-1;0<=c;c--)if(b[c]==a){var d={type:"panelRemoved",panel:a,chart:this};this.fire(d.type,d);b.splice(c,1);a.destroy();a.clear()}},validateData:function(){this.resetDataParsed();this.updateDataSets();this.mainDataSet.compared=!1;this.updateGraphs();this.updateData();var a=this.dataSetSelector;a&&a.write(a.div)},resetDataParsed:function(){var a=this.dataSets,b;for(b=0;b<a.length;b++)a[b].dataParsed=!1},validateNow:function(){this.skipDefault=
42
+ !0;this.chartRendered=!1;this.clear(!0);this.write(this.div)},hideStockEvents:function(){this.showHideEvents(!1);this.eventsHidden=!0},showStockEvents:function(){this.showHideEvents(!0);this.eventsHidden=!1},showHideEvents:function(a){var b=this.panels,c;for(c=0;c<b.length;c++){var d=b[c].graphs,e;for(e=0;e<d.length;e++){var h=d[e];!0===a?h.showBullets():h.hideBullets()}}},invalidateSize:function(){var a=this;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateNow()},5);a.validateTO=
43
+ b},measure:function(){var a=this.div,b=a.offsetWidth,c=a.offsetHeight;a.clientHeight&&(b=a.clientWidth,c=a.clientHeight);this.divRealWidth=b;this.divRealHeight=c},clear:function(a){var b=this.panels,c;if(b)for(c=0;c<b.length;c++){var d=b[c];a||(d.cleanChart(),d.destroy());d.clear(a)}(b=this.scrollbarChart)&&b.clear();if(b=this.div)b.innerHTML="";a||(this.div=null,AmCharts.deleteObject(this))}});AmCharts.StockEvent=AmCharts.Class({construct:function(){}});AmCharts.DataSet=AmCharts.Class({construct:function(){this.cname="DataSet";this.fieldMappings=[];this.dataProvider=[];this.agregatedDataProviders=[];this.stockEvents=[];this.compared=!1;this.showInCompare=this.showInSelect=!0}});AmCharts.PeriodSelector=AmCharts.Class({construct:function(a){this.cname="PeriodSelector";this.theme=a;this.createEvents("changed");this.inputFieldsEnabled=!0;this.position="bottom";this.width=180;this.fromText="From: ";this.toText="to: ";this.periodsText="Zoom: ";this.periods=[];this.inputFieldWidth=100;this.dateFormat="DD-MM-YYYY";this.hideOutOfScopePeriods=!0;AmCharts.applyTheme(this,a,this.cname)},zoom:function(a,b){this.inputFieldsEnabled&&(this.startDateField.value=AmCharts.formatDate(a,this.dateFormat),
44
+ this.endDateField.value=AmCharts.formatDate(b,this.dateFormat));this.markButtonAsSelected()},write:function(a){var b=this;a.className="amChartsPeriodSelector";var c=b.width,d=b.position;b.width=void 0;b.position=void 0;AmCharts.applyStyles(a.style,b);b.width=c;b.position=d;b.div=a;a.innerHTML="";c=b.theme;d=b.position;d="top"==d||"bottom"==d?!1:!0;b.vertical=d;var e=0,h=0;if(b.inputFieldsEnabled){var f=document.createElement("div");a.appendChild(f);var g=document.createTextNode(b.fromText);f.appendChild(g);
45
+ d?AmCharts.addBr(f):(f.style.styleFloat="left",f.style.display="inline");var k=document.createElement("input");k.className="amChartsInputField";c&&AmCharts.applyStyles(k.style,c.PeriodInputField);k.style.textAlign="center";k.onblur=function(a){b.handleCalChange(a)};AmCharts.isNN&&k.addEventListener("keypress",function(a){b.handleCalendarChange.call(b,a)},!0);AmCharts.isIE&&k.attachEvent("onkeypress",function(a){b.handleCalendarChange.call(b,a)});f.appendChild(k);b.startDateField=k;if(d)g=b.width-
46
+ 6+"px",AmCharts.addBr(f);else{var g=b.inputFieldWidth+"px",m=document.createTextNode(" ");f.appendChild(m)}k.style.width=g;k=document.createTextNode(b.toText);f.appendChild(k);d&&AmCharts.addBr(f);k=document.createElement("input");k.className="amChartsInputField";c&&AmCharts.applyStyles(k.style,c.PeriodInputField);k.style.textAlign="center";k.onblur=function(){b.handleCalChange()};AmCharts.isNN&&k.addEventListener("keypress",function(a){b.handleCalendarChange.call(b,a)},!0);AmCharts.isIE&&k.attachEvent("onkeypress",
47
+ function(a){b.handleCalendarChange.call(b,a)});f.appendChild(k);b.endDateField=k;d?AmCharts.addBr(f):e=k.offsetHeight+2;g&&(k.style.width=g)}f=b.periods;if(AmCharts.ifArray(f)){g=document.createElement("div");d||(g.style.cssFloat="right",g.style.styleFloat="right",g.style.display="inline");a.appendChild(g);d&&AmCharts.addBr(g);a=document.createTextNode(b.periodsText);g.appendChild(a);b.periodContainer=g;var p;for(a=0;a<f.length;a++)k=f[a],p=document.createElement("input"),p.type="button",p.value=
48
+ k.label,p.period=k.period,p.count=k.count,p.periodObj=k,p.className="amChartsButton",c&&AmCharts.applyStyles(p.style,c.PeriodButton),d&&(p.style.width=b.width-1+"px"),p.style.boxSizing="border-box",g.appendChild(p),b.addEventListeners(p),k.button=p;!d&&p&&(h=p.offsetHeight);b.offsetHeight=Math.max(e,h)}},addEventListeners:function(a){var b=this;AmCharts.isNN&&a.addEventListener("click",function(a){b.handlePeriodChange.call(b,a)},!0);AmCharts.isIE&&a.attachEvent("onclick",function(a){b.handlePeriodChange.call(b,
49
+ a)})},getPeriodDates:function(){var a=this.periods,b;for(b=0;b<a.length;b++)this.selectPeriodButton(a[b],!0)},handleCalendarChange:function(a){13==a.keyCode&&this.handleCalChange(a)},handleCalChange:function(a){var b=this.dateFormat,c=AmCharts.stringToDate(this.startDateField.value,b),b=this.chart.getLastDate(AmCharts.stringToDate(this.endDateField.value,b));try{this.startDateField.blur(),this.endDateField.blur()}catch(d){}if(c&&b){var e={type:"changed"};e.startDate=c;e.endDate=b;e.chart=this.chart;
50
+ e.event=a;this.fire(e.type,e)}},handlePeriodChange:function(a){this.selectPeriodButton((a.srcElement?a.srcElement:a.target).periodObj,!1,a)},setRanges:function(a,b){this.firstDate=a;this.lastDate=b;this.getPeriodDates()},selectPeriodButton:function(a,b,c){var d=a.button,e=d.count,h=d.period,f,g,k=this.firstDate,m=this.lastDate,p,x=this.theme;k&&m&&("MAX"==h?(f=k,g=m):"YTD"==h?(f=new Date,f.setMonth(0,1),f.setHours(0,0,0,0),0===e&&f.setDate(f.getDate()-1),g=this.lastDate):"YYYY"==h||"MM"==h?this.selectFromStart?
51
+ (f=k,g=new Date(k),g.setMonth(g.getMonth()+e)):(f=new Date(m),AmCharts.changeDate(f,h,e,!1),f.setDate(f.getDate()-1),g=m):(p=AmCharts.getPeriodDuration(h,e),this.selectFromStart?(f=k,g=new Date(k.getTime()+p-1)):(f=new Date(m.getTime()-p+1),g=m)),a.startTime=f.getTime(),this.hideOutOfScopePeriods&&(b&&a.startTime<k.getTime()?d.style.display="none":d.style.display="inline"),f.getTime()>m.getTime()&&(p=AmCharts.getPeriodDuration("DD",1),f=new Date(m.getTime()-p)),f.getTime()<k.getTime()&&(f=k),"YTD"==
52
+ h&&(a.startTime=f.getTime()),a.endTime=g.getTime(),b||(this.skipMark=!0,this.unselectButtons(),d.className="amChartsButtonSelected",x&&AmCharts.applyStyles(d.style,x.PeriodButtonSelected),a={type:"changed"},a.startDate=f,a.endDate=g,a.predefinedPeriod=h,a.chart=this.chart,a.count=e,a.event=c,this.fire(a.type,a)))},markButtonAsSelected:function(){if(!this.skipMark){var a=this.chart,b=this.periods,c=a.startDate.getTime(),a=a.endDate.getTime(),d=this.theme;this.unselectButtons();var e;for(e=b.length-
53
+ 1;0<=e;e--){var h=b[e],f=h.button;h.startTime&&h.endTime&&c==h.startTime&&a==h.endTime&&(this.unselectButtons(),f.className="amChartsButtonSelected",d&&AmCharts.applyStyles(f.style,d.PeriodButtonSelected))}}this.skipMark=!1},unselectButtons:function(){var a=this.periods,b,c=this.theme;for(b=a.length-1;0<=b;b--){var d=a[b].button;d.className="amChartsButton";c&&AmCharts.applyStyles(d.style,c.PeriodButton)}},setDefaultPeriod:function(){var a=this.periods,b;for(b=0;b<a.length;b++){var c=a[b];c.selected&&
54
+ this.selectPeriodButton(c)}}});AmCharts.StockGraph=AmCharts.Class({inherits:AmCharts.AmGraph,construct:function(a){AmCharts.StockGraph.base.construct.call(this,a);this.cname="StockGraph";this.useDataSetColors=!0;this.periodValue="Close";this.compareGraphType="line";this.compareGraphVisibleInLegend=!0;this.comparable=this.resetTitleOnDataSetChange=!1;this.comparedGraphs={};this.showEventsOnComparedGraphs=!1;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.StockPanel=AmCharts.Class({inherits:AmCharts.AmSerialChart,construct:function(a){AmCharts.StockPanel.base.construct.call(this,a);this.cname="StockPanel";this.theme=a;this.showCategoryAxis=this.showComparedOnTop=!0;this.recalculateToPercents="whenComparing";this.panelHeaderPaddingBottom=this.panelHeaderPaddingLeft=this.panelHeaderPaddingRight=this.panelHeaderPaddingTop=0;this.trendLineAlpha=1;this.trendLineColor="#00CC00";this.trendLineColorHover="#CC0000";this.trendLineThickness=2;this.trendLineDashLength=
55
+ 0;this.stockGraphs=[];this.drawingIconsEnabled=!1;this.iconSize=18;this.autoMargins=this.allowTurningOff=this.eraseAll=this.erasingEnabled=this.drawingEnabled=!1;AmCharts.applyTheme(this,a,this.cname)},initChart:function(a){AmCharts.StockPanel.base.initChart.call(this,a);this.drawingIconsEnabled&&this.createDrawIcons();(a=this.chartCursor)&&this.listenTo(a,"draw",this.handleDraw)},addStockGraph:function(a){this.stockGraphs.push(a);return a},removeStockGraph:function(a){var b=this.stockGraphs,c;for(c=
56
+ b.length-1;0<=c;c--)b[c]==a&&b.splice(c,1)},createDrawIcons:function(){var a=this,b=a.iconSize,c=a.container,d=a.pathToImages,e=a.realWidth-2*b-1-a.marginRight,h=AmCharts.rect(c,b,b,"#000",0.005),f=AmCharts.rect(c,b,b,"#000",0.005);f.translate(b+1,0);var g=c.image(d+"pencilIcon.gif",0,0,b,b);a.pencilButton=g;f.setAttr("cursor","pointer");h.setAttr("cursor","pointer");h.mouseup(function(){a.handlePencilClick()});var k=c.image(d+"pencilIconH.gif",0,0,b,b);a.pencilButtonPushed=k;a.drawingEnabled||k.hide();
57
+ var m=c.image(d+"eraserIcon.gif",b+1,0,b,b);a.eraserButton=m;f.mouseup(function(){a.handleEraserClick()});h.touchend&&(h.touchend(function(){a.handlePencilClick()}),f.touchend(function(){a.handleEraserClick()}));b=c.image(d+"eraserIconH.gif",b+1,0,b,b);a.eraserButtonPushed=b;a.erasingEnabled||b.hide();c=c.set([g,k,m,b,h,f]);c.translate(e,1);this.hideIcons&&c.hide()},handlePencilClick:function(){var a=!this.drawingEnabled;this.disableDrawing(!a);this.erasingEnabled=!1;this.eraserButtonPushed.hide();
58
+ a?this.pencilButtonPushed.show():(this.pencilButtonPushed.hide(),this.setMouseCursor("auto"))},disableDrawing:function(a){this.drawingEnabled=!a;var b=this.chartCursor;this.stockChart.enableCursors(a);b&&b.enableDrawing(!a)},handleEraserClick:function(){this.disableDrawing(!0);this.pencilButtonPushed.hide();if(this.eraseAll){var a=this.trendLines,b;for(b=a.length-1;0<=b;b--){var c=a[b];c.isProtected||this.removeTrendLine(c)}this.validateNow()}else(this.erasingEnabled=a=!this.erasingEnabled)?(this.eraserButtonPushed.show(),
59
+ this.setTrendColorHover(this.trendLineColorHover),this.setMouseCursor("auto")):(this.eraserButtonPushed.hide(),this.setTrendColorHover())},setTrendColorHover:function(a){var b=this.trendLines,c;for(c=b.length-1;0<=c;c--){var d=b[c];d.isProtected||(d.rollOverColor=a)}},handleDraw:function(a){var b=this.drawOnAxis;AmCharts.isString(b)&&(b=this.getValueAxisById(b));b||(b=this.valueAxes[0]);this.drawOnAxis=b;var c=this.categoryAxis,d=a.initialX,e=a.finalX,h=a.initialY;a=a.finalY;var f=new AmCharts.TrendLine(this.theme);
60
+ f.initialDate=c.coordinateToDate(d);f.finalDate=c.coordinateToDate(e);f.initialValue=b.coordinateToValue(h);f.finalValue=b.coordinateToValue(a);f.lineAlpha=this.trendLineAlpha;f.lineColor=this.trendLineColor;f.lineThickness=this.trendLineThickness;f.dashLength=this.trendLineDashLength;f.valueAxis=b;f.categoryAxis=c;this.addTrendLine(f);this.listenTo(f,"click",this.handleTrendClick);this.validateNow()},hideDrawingIcons:function(a){(this.hideIcons=a)&&this.disableDrawing(a)},handleTrendClick:function(a){this.erasingEnabled&&
61
+ (a=a.trendLine,this.eraseAll||a.isProtected||this.removeTrendLine(a),this.validateNow())},handleWheelReal:function(a,b){var c=this.scrollbarChart;if(!this.wheelBusy&&c){var d=1;b&&(d=-1);var c=c.chartScrollbar,e=this.categoryAxis.minDuration();0>a?(d=this.startTime+d*e,e=this.endTime+1*e):(d=this.startTime-d*e,e=this.endTime-1*e);d<this.firstTime&&(d=this.firstTime);e>this.lastTime&&(e=this.lastTime);d<e&&c.timeZoom(d,e,!0)}}});AmCharts.CategoryAxesSettings=AmCharts.Class({construct:function(a){this.cname="CategoryAxesSettings";this.minPeriod="DD";this.equalSpacing=!1;this.axisHeight=28;this.tickLength=this.axisAlpha=0;this.gridCount=10;this.maxSeries=150;this.groupToPeriods="ss 10ss 30ss mm 10mm 30mm hh DD WW MM YYYY".split(" ");this.markPeriodChange=this.autoGridCount=!0;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.ChartCursorSettings=AmCharts.Class({construct:function(a){this.cname="ChartCursorSettings";this.enabled=!0;this.bulletsEnabled=this.valueBalloonsEnabled=!1;this.categoryBalloonDateFormats=[{period:"YYYY",format:"YYYY"},{period:"MM",format:"MMM, YYYY"},{period:"WW",format:"MMM DD, YYYY"},{period:"DD",format:"MMM DD, YYYY"},{period:"hh",format:"JJ:NN"},{period:"mm",format:"JJ:NN"},{period:"ss",format:"JJ:NN:SS"},{period:"fff",format:"JJ:NN:SS"}];AmCharts.applyTheme(this,a,this.cname)},categoryBalloonDateFormat:function(a){var b=
62
+ this.categoryBalloonDateFormats,c,d;for(d=0;d<b.length;d++)b[d].period==a&&(c=b[d].format);return c}});AmCharts.ChartScrollbarSettings=AmCharts.Class({construct:function(a){this.cname="ChartScrollbarSettings";this.height=40;this.enabled=!0;this.color="#FFFFFF";this.updateOnReleaseOnly=this.autoGridCount=!0;this.hideResizeGrips=!1;this.position="bottom";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.LegendSettings=AmCharts.Class({construct:function(a){this.cname="LegendSettings";this.marginBottom=this.marginTop=0;this.usePositiveNegativeOnPercentsOnly=!0;this.positiveValueColor="#00CC00";this.negativeValueColor="#CC0000";this.autoMargins=this.equalWidths=this.textClickEnabled=!1;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.PanelsSettings=AmCharts.Class({construct:function(a){this.cname="PanelsSettings";this.marginBottom=this.marginTop=this.marginRight=this.marginLeft=0;this.backgroundColor="#FFFFFF";this.backgroundAlpha=0;this.panelSpacing=8;this.panEventsEnabled=!0;this.creditsPosition="top-right";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.StockEventsSettings=AmCharts.Class({construct:function(a){this.cname="StockEventsSettings";this.type="sign";this.backgroundAlpha=1;this.backgroundColor="#DADADA";this.borderAlpha=1;this.borderColor="#888888";this.balloonColor=this.rollOverColor="#CC0000";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.ValueAxesSettings=AmCharts.Class({construct:function(a){this.cname="ValueAxesSettings";this.tickLength=0;this.showFirstLabel=this.autoGridCount=this.inside=!0;this.showLastLabel=!1;this.axisAlpha=0;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.getItemIndex=function(a,b){var c=-1,d;for(d=0;d<b.length;d++)a==b[d]&&(c=d);return c};AmCharts.addBr=function(a){a.appendChild(document.createElement("br"))};AmCharts.applyStyles=function(a,b){if(b&&a)for(var c in a){var d=c,e=b[d];if(void 0!==e)try{a[d]=e}catch(h){}}};
63
+ AmCharts.parseStockData=function(a,b,c,d,e){(new Date).getTime();var h={},f=a.dataProvider,g=a.categoryField;if(g){var k=AmCharts.getItemIndex(b,c),m=c.length,p,x=f.length,t,w={};for(p=k;p<m;p++)t=c[p],h[t]=[];var y={},n=a.fieldMappings,u=n.length;for(p=0;p<x;p++){var q=f[p],l=q[g],l=l instanceof Date?"fff"==b?AmCharts.useUTC?new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()):new Date(l.getFullYear(),l.getMonth(),
64
+ l.getDate(),l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()):new Date(l):e?AmCharts.stringToDate(l,e):new Date(l),D=l.getTime(),A={};for(t=0;t<u;t++)A[n[t].toField]=q[n[t].fromField];var z;for(z=k;z<m;z++){t=c[z];var s=AmCharts.extractPeriod(t),B=s.period,E=s.count,v,r;if(z==k||D>=w[t]||!w[t]){y[t]={};y[t].amCategoryIdField=String(AmCharts.resetDateToMin(l,B,E,d).getTime());var C;for(C=0;C<u;C++)s=n[C].toField,v=y[t],r=Number(A[s]),v[s+"Count"]=0,v[s+"Sum"]=0,isNaN(r)||(v[s+"Open"]=
65
+ r,v[s+"Sum"]=r,v[s+"High"]=r,v[s+"Low"]=r,v[s+"Close"]=r,v[s+"Count"]=1,v[s+"Average"]=r);v.dataContext=q;h[t].push(y[t]);z>k&&(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;B<u;B++)s=n[B].toField,v=y[t],p==x-1&&(v[g]=new Date(l)),r=Number(A[s]),isNaN(r)||(isNaN(v[s+"Low"])&&(v[s+"Low"]=r),r<v[s+"Low"]&&(v[s+"Low"]=r),isNaN(v[s+"High"])&&(v[s+"High"]=r),
66
+ r>v[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};
67
+ 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<k;m++){y=b[m];w=y.graphs;x=w.length;var q;for(p=0;p<x;p++)t=w[p],t.customBulletField="amCustomBullet"+t.id+"_"+y.id,t.bulletConfigField="amCustomBulletConfig"+t.id+"_"+y.id;for(var l=0;l<f.length;l++)if(n=f[l],q=n.graph,AmCharts.isString(q)&&(q=AmCharts.getObjById(w,q)))n.graph=q}for(var D in g)if(g.hasOwnProperty(D)){q=g[D];var A=AmCharts.extractPeriod(D),z=q.length,s;for(s=
68
+ 0;s<z;s++){var B=q[s];m=B[a.categoryField];u=m instanceof Date;h&&!u&&(m=AmCharts.stringToDate(m,h));var E=m.getTime();w=A.period;var l=A.count,v;v="fff"==w?m.getTime()+1:AmCharts.resetDateToMin(AmCharts.changeDate(new Date(m),A.period,A.count),w,l,d).getTime();for(m=0;m<k;m++)for(y=b[m],w=y.graphs,x=w.length,p=0;p<x;p++){t=w[p];var r={};r.eventDispatcher=e;r.eventObjects=[];r.letters=[];r.descriptions=[];r.shapes=[];r.backgroundColors=[];r.backgroundAlphas=[];r.borderColors=[];r.borderAlphas=[];
69
+ r.colors=[];r.rollOverColors=[];r.showOnAxis=[];for(l=0;l<f.length;l++){n=f[l];u=n.date instanceof Date;h&&!u&&(n.date=AmCharts.stringToDate(n.date,h));u=n.date.getTime();var C=!1;n.graph&&(n.graph.showEventsOnComparedGraphs&&n.graph.comparedGraphs[a.id]&&(C=!0),(t==n.graph||C)&&u>=E&&u<v&&(r.eventObjects.push(n),r.letters.push(n.text),r.descriptions.push(n.description),n.type?r.shapes.push(n.type):r.shapes.push(c.type),void 0!==n.backgroundColor?r.backgroundColors.push(n.backgroundColor):r.backgroundColors.push(c.backgroundColor),
70
+ isNaN(n.backgroundAlpha)?r.backgroundAlphas.push(c.backgroundAlpha):r.backgroundAlphas.push(n.backgroundAlpha),isNaN(n.borderAlpha)?r.borderAlphas.push(c.borderAlpha):r.borderAlphas.push(n.borderAlpha),void 0!==n.borderColor?r.borderColors.push(n.borderColor):r.borderColors.push(c.borderColor),void 0!==n.rollOverColor?r.rollOverColors.push(n.rollOverColor):r.rollOverColors.push(c.rollOverColor),r.colors.push(n.color),!n.panel&&n.graph&&(n.panel=n.graph.chart),r.showOnAxis.push(n.showOnAxis),r.date=
71
+ new Date(n.date)));0<r.shapes.length&&(n="amCustomBullet"+t.id+"_"+y.id,u="amCustomBulletConfig"+t.id+"_"+y.id,B[n]=AmCharts.StackedBullet,B[u]=r)}}}}};AmCharts.StockLegend=AmCharts.Class({inherits:AmCharts.AmLegend,construct:function(a){AmCharts.StockLegend.base.construct.call(this,a);this.cname="StockLegend";this.valueTextComparing="[[percents.value]]%";this.valueTextRegular="[[value]]";AmCharts.applyTheme(this,a,this.cname)},drawLegend:function(){var a=this;AmCharts.StockLegend.base.drawLegend.call(a);var b=a.chart;if(b.allowTurningOff){var c=a.container,d=c.image(b.pathToImages+"xIcon.gif",b.realWidth-17,3,17,17),b=c.image(b.pathToImages+"xIconH.gif",
72
+ b.realWidth-17,3,17,17);b.hide();a.xButtonHover=b;d.mouseup(function(){a.handleXClick()}).mouseover(function(){a.handleXOver()});b.mouseup(function(){a.handleXClick()}).mouseout(function(){a.handleXOut()})}},handleXOver:function(){this.xButtonHover.show()},handleXOut:function(){this.xButtonHover.hide()},handleXClick:function(){var a=this.chart,b=a.stockChart;b.removePanel(a);b.validateNow()}});AmCharts.DataSetSelector=AmCharts.Class({construct:function(a){this.cname="DataSetSelector";this.theme=a;this.createEvents("dataSetSelected","dataSetCompared","dataSetUncompared");this.position="left";this.selectText="Select:";this.comboBoxSelectText="Select...";this.compareText="Compare to:";this.width=180;this.dataProvider=[];this.listHeight=150;this.listCheckBoxSize=14;this.rollOverBackgroundColor="#b2e1ff";this.selectedBackgroundColor="#7fceff";AmCharts.applyTheme(this,a,this.cname)},write:function(a){var b=
73
+ this,c,d=b.theme;a.className="amChartsDataSetSelector";var e=b.width;c=b.position;b.width=void 0;b.position=void 0;AmCharts.applyStyles(a.style,b);b.div=a;b.width=e;b.position=c;a.innerHTML="";var e=b.position,h;h="top"==e||"bottom"==e?!1:!0;b.vertical=h;var f;h&&(f=b.width+"px");var e=b.dataProvider,g,k;if(1<b.countDataSets("showInSelect")){c=document.createTextNode(b.selectText);a.appendChild(c);h&&AmCharts.addBr(a);var m=document.createElement("select");f&&(m.style.width=f);b.selectCB=m;d&&AmCharts.applyStyles(m.style,
74
+ d.DataSetSelect);a.appendChild(m);AmCharts.isNN&&m.addEventListener("change",function(a){b.handleDataSetChange.call(b,a)},!0);AmCharts.isIE&&m.attachEvent("onchange",function(a){b.handleDataSetChange.call(b,a)});for(c=0;c<e.length;c++)if(g=e[c],!0===g.showInSelect){k=document.createElement("option");k.text=g.title;k.value=c;g==b.chart.mainDataSet&&(k.selected=!0);try{m.add(k,null)}catch(p){m.add(k)}}b.offsetHeight=m.offsetHeight}if(0<b.countDataSets("showInCompare")&&1<e.length)if(h?(AmCharts.addBr(a),
75
+ AmCharts.addBr(a)):(c=document.createTextNode(" "),a.appendChild(c)),c=document.createTextNode(b.compareText),a.appendChild(c),k=b.listCheckBoxSize,h){AmCharts.addBr(a);f=document.createElement("div");a.appendChild(f);f.className="amChartsCompareList";d&&AmCharts.applyStyles(f.style,d.DataSetCompareList);f.style.overflow="auto";f.style.overflowX="hidden";f.style.width=b.width-2+"px";f.style.maxHeight=b.listHeight+"px";for(c=0;c<e.length;c++)g=e[c],!0===g.showInCompare&&g!=b.chart.mainDataSet&&(d=
76
+ document.createElement("div"),d.style.padding="4px",d.style.position="relative",d.name="amCBContainer",d.dataSet=g,d.style.height=k+"px",g.compared&&(d.style.backgroundColor=b.selectedBackgroundColor),f.appendChild(d),h=document.createElement("div"),h.style.width=k+"px",h.style.height=k+"px",h.style.position="absolute",h.style.backgroundColor=g.color,d.appendChild(h),h=document.createElement("div"),h.style.width="100%",h.style.position="absolute",h.style.left=k+10+"px",d.appendChild(h),g=document.createTextNode(g.title),
77
+ h.style.whiteSpace="nowrap",h.style.cursor="default",h.appendChild(g),b.addEventListeners(d));AmCharts.addBr(a);AmCharts.addBr(a)}else{d=document.createElement("select");b.compareCB=d;f&&(d.style.width=f);a.appendChild(d);AmCharts.isNN&&d.addEventListener("change",function(a){b.handleCBSelect.call(b,a)},!0);AmCharts.isIE&&d.attachEvent("onchange",function(a){b.handleCBSelect.call(b,a)});k=document.createElement("option");k.text=b.comboBoxSelectText;try{d.add(k,null)}catch(x){d.add(k)}for(c=0;c<e.length;c++)if(g=
78
+ e[c],!0===g.showInCompare&&g!=b.chart.mainDataSet){k=document.createElement("option");k.text=g.title;k.value=c;g.compared&&(k.selected=!0);try{d.add(k,null)}catch(t){d.add(k)}}b.offsetHeight=d.offsetHeight}},addEventListeners:function(a){var b=this;AmCharts.isNN&&(a.addEventListener("mouseover",function(a){b.handleRollOver.call(b,a)},!0),a.addEventListener("mouseout",function(a){b.handleRollOut.call(b,a)},!0),a.addEventListener("click",function(a){b.handleClick.call(b,a)},!0));AmCharts.isIE&&(a.attachEvent("onmouseout",
79
+ function(a){b.handleRollOut.call(b,a)}),a.attachEvent("onmouseover",function(a){b.handleRollOver.call(b,a)}),a.attachEvent("onclick",function(a){b.handleClick.call(b,a)}))},handleDataSetChange:function(){var a=this.selectCB,a=this.dataProvider[a.options[a.selectedIndex].value],b=this.chart;b.mainDataSet=a;b.zoomOutOnDataSetChange&&(b.startDate=void 0,b.endDate=void 0);b.validateData();a={type:"dataSetSelected",dataSet:a,chart:this.chart};this.fire(a.type,a)},handleRollOver:function(a){a=this.getRealDiv(a);
80
+ a.dataSet.compared||(a.style.backgroundColor=this.rollOverBackgroundColor)},handleRollOut:function(a){a=this.getRealDiv(a);a.dataSet.compared||(a.style.removeProperty&&a.style.removeProperty("background-color"),a.style.removeAttribute&&a.style.removeAttribute("backgroundColor"))},handleCBSelect:function(a){var b=this.compareCB,c=this.dataProvider,d,e;for(d=0;d<c.length;d++)e=c[d],e.compared&&(a={type:"dataSetUncompared",dataSet:e}),e.compared=!1;c=b.selectedIndex;0<c&&(e=this.dataProvider[b.options[c].value],
81
+ e.compared||(a={type:"dataSetCompared",dataSet:e}),e.compared=!0);b=this.chart;b.validateData();a.chart=b;this.fire(a.type,a)},handleClick:function(a){a=this.getRealDiv(a).dataSet;!0===a.compared?(a.compared=!1,a={type:"dataSetUncompared",dataSet:a}):(a.compared=!0,a={type:"dataSetCompared",dataSet:a});var b=this.chart;b.validateData();a.chart=b;this.fire(a.type,a)},getRealDiv:function(a){a||(a=window.event);a=a.currentTarget?a.currentTarget:a.srcElement;"amCBContainer"==a.parentNode.name&&(a=a.parentNode);
82
+ return a},countDataSets:function(a){var b=this.dataProvider,c=0,d;for(d=0;d<b.length;d++)!0===b[d][a]&&c++;return c}});AmCharts.StackedBullet=AmCharts.Class({construct:function(){this.fontSize=11;this.stackDown=!1;this.mastHeight=8;this.shapes=[];this.backgroundColors=[];this.backgroundAlphas=[];this.borderAlphas=[];this.borderColors=[];this.colors=[];this.rollOverColors=[];this.showOnAxiss=[];this.textColor="#000000";this.nextY=0;this.size=16},parseConfig:function(){var a=this.bulletConfig;this.eventObjects=a.eventObjects;this.letters=a.letters;this.shapes=a.shapes;this.backgroundColors=a.backgroundColors;this.backgroundAlphas=
83
+ a.backgroundAlphas;this.borderColors=a.borderColors;this.borderAlphas=a.borderAlphas;this.colors=a.colors;this.rollOverColors=a.rollOverColors;this.date=a.date;this.showOnAxiss=a.showOnAxis;this.axisCoordinate=a.minCoord},write:function(a){this.parseConfig();this.container=a;this.bullets=[];if(this.graph){var b=this.graph.fontSize;b&&(this.fontSize=b)}b=this.letters.length;(this.mastHeight+2*(this.fontSize/2+2))*b>this.availableSpace&&(this.stackDown=!0);this.set=a.set();a=0;var c;for(c=0;c<b;c++)this.shape=
84
+ this.shapes[c],this.backgroundColor=this.backgroundColors[c],this.backgroundAlpha=this.backgroundAlphas[c],this.borderAlpha=this.borderAlphas[c],this.borderColor=this.borderColors[c],this.rollOverColor=this.rollOverColors[c],this.showOnAxis=this.showOnAxiss[c],this.color=this.colors[c],this.addLetter(this.letters[c],a,c),this.showOnAxis||a++},addLetter:function(a,b,c){var d=this.container;b=d.set();var e=-1,h=this.stackDown;this.showOnAxis&&(this.stackDown=this.graph.valueAxis.reversed?!0:!1);this.stackDown&&
85
+ (e=1);var f=0,g=0,k=0,m,k=this.fontSize,p=this.mastHeight,x=this.shape,t=this.textColor;void 0!==this.color&&(t=this.color);void 0===a&&(a="");a=AmCharts.text(d,a,t,this.chart.fontFamily,this.fontSize);d=a.getBBox();this.labelWidth=t=d.width;this.labelHeight=d.height;d=0;switch(x){case "sign":m=this.drawSign(b);f=p+4+k/2;d=p+k+4;1==e&&(f-=4);break;case "flag":m=this.drawFlag(b);g=t/2+3;f=p+4+k/2;d=p+k+4;1==e&&(f-=4);break;case "pin":m=this.drawPin(b);f=6+k/2;d=k+8;break;case "triangleUp":m=this.drawTriangleUp(b);
86
+ f=-k-1;d=k+4;e=-1;break;case "triangleDown":m=this.drawTriangleDown(b);f=k+1;d=k+4;e=-1;break;case "triangleLeft":m=this.drawTriangleLeft(b);g=k;d=k+4;e=-1;break;case "triangleRight":m=this.drawTriangleRight(b);g=-k;e=-1;d=k+4;break;case "arrowUp":m=this.drawArrowUp(b);a.hide();break;case "arrowDown":m=this.drawArrowDown(b);a.hide();d=k+4;break;case "text":e=-1;m=this.drawTextBackground(b,a);f=this.labelHeight+3;d=k+10;break;case "round":m=this.drawCircle(b)}this.bullets[c]=m;this.showOnAxis?(m=isNaN(this.nextAxisY)?
87
+ this.axisCoordinate:this.nextY,k=f*e,this.nextAxisY=m+e*d):(m=this.nextY,k=f*e);a.translate(g,k);b.push(a);b.translate(0,m);this.addEventListeners(b,c);this.nextY=m+e*d;this.stackDown=h},addEventListeners:function(a,b){var c=this;a.click(function(){c.handleClick(b)}).mouseover(function(){c.handleMouseOver(b)}).touchend(function(){c.handleMouseOver(b,!0)}).mouseout(function(){c.handleMouseOut(b)})},drawPin:function(a){var b=-1;this.stackDown&&(b=1);var c=this.fontSize+4;return this.drawRealPolygon(a,
88
+ [0,c/2,c/2,-c/2,-c/2,0],[0,b*c/4,b*(c+c/4),b*(c+c/4),b*c/4,0])},drawSign:function(a){var b=-1;this.stackDown&&(b=1);var c=this.mastHeight*b,d=this.fontSize/2+2,e=AmCharts.line(this.container,[0,0],[0,c],this.borderColor,this.borderAlpha,1),h=AmCharts.circle(this.container,d,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);h.translate(0,c+d*b);a.push(e);a.push(h);this.set.push(a);return h},drawFlag:function(a){var b=-1;this.stackDown&&(b=1);var c=this.fontSize+4,d=this.labelWidth+
89
+ 6,e=this.mastHeight,b=1==b?b*e:b*e-c,e=AmCharts.line(this.container,[0,0],[0,b],this.borderColor,this.borderAlpha,1),c=AmCharts.polygon(this.container,[0,d,d,0],[0,0,c,c],this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);c.translate(0,b);a.push(e);a.push(c);this.set.push(a);return c},drawTriangleUp:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b/2,-b/2,0],[0,b,b,0])},drawArrowUp:function(a){var b=this.size,c=b/2,d=b/4;return this.drawRealPolygon(a,
90
+ [0,c,d,d,-d,-d,-c,0],[0,c,c,b,b,c,c,0])},drawArrowDown:function(a){var b=this.size,c=b/2,d=b/4;return this.drawRealPolygon(a,[0,c,d,d,-d,-d,-c,0],[0,-c,-c,-b,-b,-c,-c,0])},drawTriangleDown:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b/2,-b/2,0],[0,-b,-b,0])},drawTriangleLeft:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,b,b,0],[0,-b/2,b/2])},drawTriangleRight:function(a){var b=this.fontSize+7;return this.drawRealPolygon(a,[0,-b,-b,0],[0,-b/2,b/2,0])},drawRealPolygon:function(a,
91
+ b,c){b=AmCharts.polygon(this.container,b,c,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);a.push(b);this.set.push(a);return b},drawCircle:function(a){shape=AmCharts.circle(this.container,this.fontSize/2,this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);a.push(shape);this.set.push(a);return shape},drawTextBackground:function(a,b){var c=b.getBBox(),d=-c.width/2-5,e=c.width/2+5,c=-c.height-12;return this.drawRealPolygon(a,[d,-5,0,5,e,e,d,d],
92
+ [-5,-5,0,-5,-5,c,c,-5])},handleMouseOver:function(a,b){b||this.bullets[a].attr({fill:this.rollOverColors[a]});var c=this.eventObjects[a],d={type:"rollOverStockEvent",eventObject:c,graph:this.graph,date:this.date},e=this.bulletConfig.eventDispatcher;d.chart=e;e.fire(d.type,d);c.url&&this.bullets[a].setAttr("cursor","pointer");this.chart.showBalloon(AmCharts.fixNewLines(c.description),e.stockEventsSettings.balloonColor,!0)},handleClick:function(a){a=this.eventObjects[a];var b={type:"clickStockEvent",
93
93
  eventObject:a,graph:this.graph,date:this.date},c=this.bulletConfig.eventDispatcher;b.chart=c;c.fire(b.type,b);b=a.urlTarget;b||(b=c.stockEventsSettings.urlTarget);AmCharts.getURL(a.url,b)},handleMouseOut:function(a){this.bullets[a].attr({fill:this.backgroundColors[a]});a={type:"rollOutStockEvent",eventObject:this.eventObjects[a],graph:this.graph,date:this.date};var b=this.bulletConfig.eventDispatcher;a.chart=b;b.fire(a.type,a)}});
@@ -1,666 +1,667 @@
1
- AmCharts.AmExport = AmCharts.Class({
2
- construct: function(chart, cfg) {
3
- var _this = this;
4
- _this.DEBUG = false;
5
- _this.chart = chart;
6
- _this.canvas = null;
7
- _this.svgs = [];
8
- _this.cfg = {
9
- menuTop : 'auto',
10
- menuLeft : 'auto',
11
- menuRight : '0px',
12
- menuBottom : '0px',
13
- menuItems : [{
14
- textAlign : 'center',
15
- icon : _this.chart.pathToImages + 'export.png',
16
- iconTitle : 'Save chart as an image',
17
- format : 'png'
18
- }],
19
- menuItemStyle : {
20
- backgroundColor : 'transparent',
21
- rollOverBackgroundColor : '#EFEFEF',
22
- color : '#000000',
23
- rollOverColor : '#CC0000',
24
- paddingTop : '6px',
25
- paddingRight : '6px',
26
- paddingBottom : '6px',
27
- paddingLeft : '6px',
28
- marginTop : '0px',
29
- marginRight : '0px',
30
- marginBottom : '0px',
31
- marginLeft : '0px',
32
- textAlign : 'left',
33
- textDecoration : 'none',
34
- fontFamily : _this.chart.fontFamily,
35
- fontSize : _this.chart.fontSize + 'px'
36
- },
37
- menuItemOutput : {
38
- backgroundColor : '#FFFFFF',
39
- fileName : 'amChart',
40
- format : 'png',
41
- output : 'dataurlnewwindow',
42
- render : 'browser',
43
- dpi : 90,
44
- onclick : function(instance, config, event) {
45
- event.preventDefault();
46
- // Polify SVG; needs to wait
47
- instance.polifySVG();
48
- instance.output(config);
49
- }
50
- },
51
- removeImagery: false
52
- };
53
- _this.processing = {
54
- buffer: [],
55
- drawn: 0,
56
- timer: 0
57
- };
58
-
59
- // Config dependency adaption
60
- if (typeof(window.canvg) != 'undefined' && typeof(window.RGBColor) != 'undefined') {
61
- _this.cfg.menuItemOutput.render = 'canvg';
62
- }
63
- if (typeof(window.saveAs) != 'undefined') {
64
- _this.cfg.menuItemOutput.output = 'save';
65
- }
66
- if (AmCharts.isIE && AmCharts.IEversion < 10) {
67
- _this.cfg.menuItemOutput.output = 'dataurlnewwindow';
68
- }
69
-
70
- // Merge given configs
71
- if (cfg) {
72
- cfg.menuItemOutput = AmCharts.extend(_this.cfg.menuItemOutput, cfg.menuItemOutput || {});
73
- cfg.menuItemStyle = AmCharts.extend(_this.cfg.menuItemStyle, cfg.menuItemStyle || {});
74
- _this.cfg = AmCharts.extend(_this.cfg, cfg);
75
- }
76
-
77
- // Add reference to chart
78
- _this.chart.AmExport = _this;
79
-
80
- // Listen to the drawer
81
- _this.chart.addListener('rendered', function() {
82
- _this.setup();
83
- });
84
-
85
- // DEBUG; Public reference
86
- if (_this.DEBUG) {
87
- window.AmExport = _this;
88
- }
89
- },
90
-
91
- /*
92
- Simple log function for internal purpose
93
- @param **args
94
- */
95
- log: function() {
96
- console.log('AmExport: ', arguments);
97
- },
98
-
99
- /* PUBLIC
100
- Prepares everything to get exported
101
- @param none
102
- */
103
- setup: function() {
104
- var _this = this;
105
-
106
- if (_this.DEBUG == 10) {
107
- _this.log('SETUP START');
108
- } // DEBUG
109
-
110
-
111
- if (!AmCharts.isIE || (AmCharts.isIE && AmCharts.IEversion > 9)) {
112
- // Build Buttons
113
- _this.generateButtons();
114
- if (_this.DEBUG == 10) {
115
- _this.log('SETUP END');
116
- } // DEBUG
117
- } else {
118
- if (_this.DEBUG == 10) {
119
- _this.log('< IE10 NOT SUPPORTED');
120
- } // DEBUG
121
- }
122
- },
123
-
124
- /* PUBLIC
125
- Decodes base64 string to binary array
126
- @param base64_string
127
- @copyright Eli Grey, http://eligrey.com and Devin Samarin, https://github.com/eboyjr
128
- */
129
- generateBinaryArray: function(base64_string) {
130
- var
131
- len = base64_string.length,
132
- buffer = new Uint8Array(len / 4 * 3 | 0),
133
- i = 0,
134
- outptr = 0,
135
- last = [0, 0],
136
- state = 0,
137
- save = 0,
138
- rank, code, undef, base64_ranks = new Uint8Array([
139
- 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
140
- ]);
141
- while (len--) {
142
- code = base64_string.charCodeAt(i++);
143
- rank = base64_ranks[code - 43];
144
- if (rank !== 255 && rank !== undef) {
145
- last[1] = last[0];
146
- last[0] = code;
147
- save = (save << 6) | rank;
148
- state++;
149
- if (state === 4) {
150
- buffer[outptr++] = save >>> 16;
151
- if (last[1] !== 61 /* padding character */ ) {
152
- buffer[outptr++] = save >>> 8;
153
- }
154
- if (last[0] !== 61 /* padding character */ ) {
155
- buffer[outptr++] = save;
156
- }
157
- state = 0;
158
- }
159
- }
160
- }
161
- // 2/3 chance there's going to be some null bytes at the end, but that
162
- // doesn't really matter with most image formats.
163
- // If it somehow matters for you, truncate the buffer up outptr.
164
- return buffer;
165
- },
166
-
167
- /*
168
- Creates blob object
169
- @param base64_datastring string
170
- @param type string
171
- */
172
- generateBlob: function(datastring, type) {
173
- var _this = this,
174
- header_end = datastring.indexOf(',') + 1,
175
- header = datastring.substring(0, header_end),
176
- data = datastring,
177
- blob = new Blob();
178
-
179
- if (header.indexOf('base64') != -1) {
180
- data = _this.generateBinaryArray(datastring.substring(header_end));
181
- }
182
-
183
- // Fake blob for IE
184
- if (AmCharts.isIE && AmCharts.IEversion < 10) {
185
- blob.data = data;
186
- blob.size = data.length;
187
- blob.type = type;
188
- blob.encoding = 'base64';
189
- } else {
190
- blob = new Blob([data], {
191
- type: type
192
- });
193
- }
194
- return blob;
195
- },
196
-
197
- /*
198
- Creates PDF object
199
- @param config object
200
- */
201
- generatePDF: function(cfg) {
202
- var _this = this,
203
- pdf = {
204
- output: function() {
205
- return '';
206
- }
207
- },
208
- data = _this.canvas.toDataURL('image/jpeg'), // JSPDF ONLY SUPPORTS JPG
209
- width = (_this.canvas.width * 25.4) / cfg.dpi,
210
- height = (_this.canvas.height * 25.4) / cfg.dpi;
211
-
212
- // Check
213
- if (window.jsPDF) {
214
- pdf = new jsPDF();
215
- if (pdf.addImage) {
216
- pdf.addImage(data, 'JPEG', 0, 0, width, height);
217
- } else {
218
- alert("Missing jsPDF plugin; Please add the 'addImage' plugin.");
219
- }
220
- } else {
221
- alert("Missing jsPDF lib; Don't forget to add the addImage plugin.");
222
- }
223
-
224
- return pdf;
225
- },
226
-
227
- /*
228
- Creates the CANVAS to receive the image data
229
- @param format void()
230
- @param callback; given callback function which returns the blob or datastring of the configured ouput type
231
- */
232
- output: function(cfg, externalCallback) {
233
- var _this = this;
234
- cfg = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemOutput), cfg || {});
235
-
236
- /* PRIVATE
237
- Callback function which gets called after the drawing process is done
238
- @param none
239
- */
240
- function internalCallback() {
241
- var data = null;
242
- var blob;
243
- if (_this.DEBUG == 10) {
244
- _this.log('OUTPUT', format);
245
- } // DEBUG
246
-
247
- // SVG
248
- if (cfg.format == 'image/svg+xml' || cfg.format == 'svg') {
249
- for (var i = 0; i < _this.processing.buffer.length; i++) {
250
- data = new XMLSerializer().serializeToString(_this.processing.buffer[i][0]);
251
- blob = _this.generateBlob(data, 'image/svg+xml');
252
-
253
- if (cfg.output == 'save') {
254
- saveAs(blob, cfg.fileName + '.svg');
255
- } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
256
- blob = 'data:image/svg+xml;base64,' + btoa(data);
257
- } else if (cfg.output == 'dataurlnewwindow') {
258
- window.open('data:image/svg+xml;base64,' + btoa(data));
259
- } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
260
- location.href = 'data:image/svg+xml;base64,' + btoa(data);
261
- } else if (cfg.output == 'datastream') {
262
- location.href = 'data:image/octet-stream;base64,' + btoa(data);
263
- }
264
-
265
- if (externalCallback)
266
- externalCallback.apply(_this, [blob]);
267
- }
268
- // PDF
269
- } else if (cfg.format == 'application/pdf' || cfg.format == 'pdf') {
270
- data = _this.generatePDF(cfg).output('dataurlstring');
271
- blob = _this.generateBlob(data, 'application/pdf');
272
-
273
- if (cfg.output == 'save') {
274
- saveAs(blob, cfg.fileName + '.pdf');
275
- } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
276
- blob = data;
277
- } else if (cfg.output == 'dataurlnewwindow') {
278
- window.open(data);
279
- } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
280
- location.href = data;
281
- } else if (cfg.output == 'datastream') {
282
- location.href = data.replace('application/pdf', 'application/octet-stream');
283
- }
284
-
285
- if (externalCallback)
286
- externalCallback.apply(_this, [blob]);
287
-
288
- // PNG
289
- } else if (cfg.format == 'image/png' || cfg.format == 'png') {
290
- data = _this.canvas.toDataURL('image/png');
291
- blob = _this.generateBlob(data, 'image/png');
292
-
293
- if (cfg.output == 'save') {
294
- saveAs(blob, cfg.fileName + '.png');
295
- } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
296
- blob = data;
297
- } else if (cfg.output == 'dataurlnewwindow') {
298
- window.open(data);
299
- } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
300
- location.href = data;
301
- } else if (cfg.output == 'datastream') {
302
- location.href = data.replace('image/png', 'image/octet-stream');
303
- }
304
-
305
- if (externalCallback)
306
- externalCallback.apply(_this, [blob]);
307
-
308
- // JPG
309
- } else if (cfg.format == 'image/jpeg' || cfg.format == 'jpeg' || cfg.format == 'jpg') {
310
- data = _this.canvas.toDataURL('image/jpeg');
311
- blob = _this.generateBlob(data, 'image/jpeg');
312
-
313
- if (cfg.output == 'save') {
314
- saveAs(blob, cfg.fileName + '.jpg');
315
- } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
316
- blob = data;
317
- } else if (cfg.output == 'dataurlnewwindow') {
318
- window.open(data);
319
- } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
320
- location.href = data;
321
- } else if (cfg.output == 'datastream') {
322
- location.href = data.replace('image/jpeg', 'image/octet-stream');
323
- }
324
-
325
- if (externalCallback)
326
- externalCallback.apply(_this, [blob]);
327
- }
328
-
329
- }
330
-
331
- return _this.generateOutput(cfg, internalCallback);
332
- },
333
-
334
- /* PUBLIC
335
- Polifies missing attributes to the SVG and replaces images to embedded base64 images
336
- @param none
337
- */
338
- polifySVG: function() {
339
- var _this = this;
340
- var svgs = _this.chart.div.getElementsByTagName('svg');
341
-
342
- // Recursive function to force the attributes
343
- function recursiveChange(svg, tag) {
344
- var items = svg.getElementsByTagName(tag);
345
-
346
- for (var i = 0; i < items.length; i++) {
347
-
348
- if ( _this.cfg.removeImagery ) {
349
- items[i].parentNode.removeChild(items[i]);
350
-
351
- } else {
352
- var image = document.createElement('img');
353
- var canvas = document.createElement('canvas');
354
- var ctx = canvas.getContext('2d');
355
-
356
- canvas.width = items[i].getAttribute('width');
357
- canvas.height = items[i].getAttribute('height');
358
- image.src = items[i].getAttribute('xlink:href');
359
- image.width = items[i].getAttribute('width');
360
- image.height = items[i].getAttribute('height');
361
-
362
- try {
363
- ctx.drawImage(image, 0, 0, image.width, image.height);
364
- datastring = canvas.toDataURL(); // image.src; // canvas.toDataURL(); //
365
- } catch (err) {
366
- datastring = image.src; // image.src; // canvas.toDataURL(); //
367
-
368
- _this.log('Tainted canvas, reached browser CORS security; origin from imagery must be equal to the server!');
369
- throw new Error(err);
370
- }
371
-
372
- items[i].setAttribute('xlink:href', datastring);
373
- }
374
-
375
- if (_this.DEBUG == 10) {
376
- _this.log('POLIFIED', items[i]);
377
- } // DEBUG
378
- }
379
- }
380
-
381
- // Loop through svgs to add some standardization
382
- for (var i = 0; i < svgs.length; i++) {
383
- var parent = svgs[i].parentNode;
384
-
385
- // Put some attrs to it; fixed 20/03/14 xmlns is required to produce a valid svg file
386
- if ( !AmCharts.isIE ) {
387
- svgs[i].setAttribute('xmlns','http://www.w3.org/2000/svg');
388
- //svgs[i].setAttribute('xmlns:xlink','http://www.w3.org/1999/xlink');
389
- }
390
- //svgs[i].setAttribute('width',parent.style.width);
391
- //svgs[i].setAttribute('height',parent.style.height);
392
-
393
- // DEBUG
394
- if (_this.DEBUG == 10) {
395
- _this.log('POLIFIED', svgs[i]);
396
- }
397
-
398
- // Force link adaption
399
- recursiveChange(svgs[i], 'pattern');
400
- recursiveChange(svgs[i], 'image');
401
-
402
- _this.svgs.push(svgs[i]);
403
- }
404
-
405
- return svgs;
406
- },
407
-
408
- /* PUBLIC
409
- Generates the canvas with the given SVGs and configured renderer
410
- @param callback; function(); gets called after drawing process on the canvas has been finished
411
- */
412
- generateOutput: function(cfg, callback) {
413
- var _this = this,
414
- svgs = _this.chart.div.getElementsByTagName('svg'),
415
- canvas = document.createElement('canvas'),
416
- context = canvas.getContext('2d'),
417
- offset = {
418
- y: 0,
419
- x: 0
420
- },
421
- tmp = {};
422
-
423
- // Reset
424
- _this.processing.buffer = [];
425
- _this.processing.drawn = 0;
426
- _this.canvas = canvas;
427
-
428
- // Walkthroug SVGs
429
- if (_this.DEBUG == 10) {
430
- _this.log('START EXPORT');
431
- } // DEBUG
432
- if (_this.DEBUG == 10) {
433
- _this.log('START BUFFERING');
434
- } // DEBUG
435
- for (var i = 0; i < svgs.length; i++) {
436
- var parent = svgs[i].parentNode,
437
- svgX = Number(parent.style.left.slice(0, -2)),
438
- svgY = Number(parent.style.top.slice(0, -2));
439
- tmp = AmCharts.extend({}, offset);
440
-
441
- // Overtake parent position if given; fixed 20/03/14 distinguish between relativ and others
442
- if ( parent.style.position == 'relative' ) {
443
- offset.x = svgX? svgX : offset.x;
444
- offset.y = svgY? svgY : offset.y;
445
- } else {
446
- offset.x = svgX;
447
- offset.y = svgY;
448
- }
449
-
450
- _this.processing.buffer.push([svgs[i], AmCharts.extend({}, offset)]);
451
-
452
- // Put back from "cache"
453
- if (svgY && svgX) {
454
- offset = tmp;
455
-
456
- // New offset for next one
457
- } else {
458
- offset.y += svgY ? 0 : parent.offsetHeight;
459
- }
460
-
461
- if (_this.DEBUG == 10) {
462
- _this.log('BUFFERED', svgs[i], offset);
463
- } // DEBUG
464
- }
465
- if (_this.DEBUG == 10) {
466
- _this.log('END BUFFERING');
467
- } // DEBUG
468
-
469
- // Apply background
470
- if (_this.DEBUG == 10) {
471
- _this.log('START DRAWING', cfg.render);
472
- } // DEBUG
473
- if (_this.DEBUG == 10) {
474
- _this.log('FILL BACKGROUND');
475
- } // DEBUG
476
- canvas.id = AmCharts.getUniqueId();
477
- canvas.width = _this.chart.divRealWidth;
478
- canvas.height = _this.chart.divRealHeight;
479
-
480
- // Set given background; jpeg default
481
- if (cfg.backgroundColor || format == 'image/jpeg') {
482
- context.fillStyle = cfg.backgroundColor || '#FFFFFF';
483
- context.fillRect(0, 0, canvas.width, canvas.height);
484
- }
485
-
486
- /* PRIVATE
487
- Recursive function to draw the images to the canvas;
488
- @param none;
489
- */
490
- function drawItWhenItsLoaded() {
491
- var img, buffer, offset, source;
492
-
493
- // DRAWING PROCESS DONE
494
- if (_this.processing.buffer.length == _this.processing.drawn) {
495
- if (_this.DEBUG == 10) {
496
- _this.log('END DRAWING');
497
- } // DEBUG
498
- return callback();
499
-
500
- // LOOPING LUI
501
- } else {
502
- if (_this.DEBUG == 10) {
503
- _this.log('DRAW', _this.processing.drawn + 1, 'OF', _this.processing.buffer.length);
504
- } // DEBUG
505
-
506
- buffer = _this.processing.buffer[_this.processing.drawn];
507
- source = new XMLSerializer().serializeToString(buffer[0]); //source = 'data:image/svg+xml;base64,' + btoa();
508
- offset = buffer[1];
509
-
510
- if (_this.DEBUG == 10) {
511
- _this.log('SOURCE', source);
512
- } // DEBUG
513
-
514
- // NATIVE
515
- if (cfg.render == 'browser') {
516
- img = new Image();
517
- img.id = AmCharts.getUniqueId();
518
- source = 'data:image/svg+xml;base64,' + btoa(source);
519
-
520
- //img.crossOrigin = "Anonymous";
521
- img.onload = function() {
522
- context.drawImage(this, buffer[1].x, buffer[1].y);
523
- _this.processing.drawn++;
524
-
525
- if (_this.DEBUG == 10) {
526
- _this.log('ONLOAD', this);
527
- } // DEBUG
528
- drawItWhenItsLoaded();
529
- };
530
- img.onerror = function() {
531
- if (_this.DEBUG == 10) {
532
- _this.log('ONERROR', this);
533
- } // DEBUG
534
- context.drawImage(this, buffer[1].x, buffer[1].y);
535
- _this.processing.drawn++;
536
- drawItWhenItsLoaded();
537
- };
538
- img.src = source;
539
-
540
- if (_this.DEBUG == 10) {
541
- _this.log('ADD', img);
542
- } // DEBUG
543
- if (img.complete || typeof(img.complete) == 'undefined' || img.complete === undefined) {
544
- if (_this.DEBUG == 10) {
545
- _this.log('FORCE ONLOAD', img);
546
- } // DEBUG
547
- img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
548
- img.src = source;
549
- }
550
-
551
- // CANVG
552
- } else if (cfg.render == 'canvg') {
553
- canvg(canvas, source, {
554
- offsetX: offset.x,
555
- offsetY: offset.y,
556
- ignoreMouse: true,
557
- ignoreAnimation: true,
558
- ignoreDimensions: true,
559
- ignoreClear: true,
560
- renderCallback: function() {
561
- _this.processing.drawn++;
562
- drawItWhenItsLoaded();
563
- }
564
- });
565
- }
566
- }
567
- }
568
- return drawItWhenItsLoaded();
569
- },
570
-
571
- /*
572
- Generates the export menu to trigger the exportation
573
- @param none;
574
- */
575
- generateButtons: function() {
576
- var _this = this,
577
- div = document.createElement('div'),
578
- lvl = 0;
579
-
580
- // Push sublings
581
- function createList(items) {
582
- var ul = document.createElement('ul');
583
-
584
- ul.setAttribute('style', 'list-style: none; margin: 0; padding: 0;');
585
-
586
- // Walkthrough items
587
- for (var i = 0; i < items.length; i++) {
588
- var li = document.createElement('li'),
589
- img = document.createElement('img'),
590
- a = document.createElement('a'),
591
- item = items[i],
592
- children = null,
593
- itemStyle = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemStyle), items[i]);
594
-
595
- // MERGE CFG
596
- item = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemOutput), item);
597
-
598
- // ICON
599
- if (item['icon']) {
600
- img.alt = '';
601
- img.src = item['icon'];
602
- img.setAttribute('style', 'margin: 0 auto;border: none;outline: none');
603
- if (item['iconTitle']) {
604
- img.title = item['iconTitle'];
605
- }
606
- a.appendChild(img);
607
- }
608
-
609
- // TITLE; STYLING
610
- a.href = '#';
611
- if (item['title']) {
612
- img.setAttribute('style', 'margin-right: 5px;');
613
- a.innerHTML += item.title;
614
- }
615
- a.setAttribute('style', 'display: block;');
616
- AmCharts.extend(a.style, itemStyle);
617
-
618
- // ONCLICK
619
- a.onclick = item.onclick.bind(a, _this, item);
620
- li.appendChild(a);
621
-
622
- // APPEND SIBLINGS
623
- if (item.items) {
624
- children = createList(item.items);
625
- li.appendChild(children);
626
-
627
- li.onmouseover = function() {
628
- children.style.display = 'block';
629
- };
630
- li.onmouseout = function() {
631
- children.style.display = 'none';
632
- };
633
- children.style.display = 'none';
634
- }
635
-
636
- // Append to parent
637
- ul.appendChild(li);
638
-
639
- // Apply hover
640
- a.onmouseover = function() {
641
- this.style.backgroundColor = itemStyle.rollOverBackgroundColor;
642
- this.style.color = itemStyle.rollOverColor;
643
- this.style.borderColor = itemStyle.rollOverBorderColor;
644
- };
645
- a.onmouseout = function() {
646
- this.style.backgroundColor = itemStyle.backgroundColor;
647
- this.style.color = itemStyle.color;
648
- this.style.borderColor = itemStyle.borderColor;
649
- };
650
- }
651
- lvl++;
652
-
653
- if (_this.DEBUG == 10) {
654
- _this.log('MENU', ul);
655
- } // DEBUG
656
-
657
- return ul;
658
- }
659
-
660
- // Style wrapper; Push into chart div
661
- div.setAttribute('style', 'width:39px; height:28px; position: absolute;top:' + _this.cfg.menuTop + ';right:' + _this.cfg.menuRight + ';bottom:' + _this.cfg.menuBottom + ';left:' + _this.cfg.menuLeft + ';box-shadow:0px 0px 1px 0px rgba(0,0,0,0);');
662
- div.appendChild(createList(_this.cfg.menuItems));
663
- //_this.chart.div.style.position = 'relative';
664
- _this.chart.containerDiv.appendChild(div);
665
- }
1
+ AmCharts.AmExport = AmCharts.Class({
2
+ construct: function(chart, cfg) {
3
+ var _this = this;
4
+ _this.DEBUG = false;
5
+ _this.chart = chart;
6
+ _this.canvas = null;
7
+ _this.svgs = [];
8
+ _this.cfg = {
9
+ menuTop : 'auto',
10
+ menuLeft : 'auto',
11
+ menuRight : '0px',
12
+ menuBottom : '0px',
13
+ menuItems : [{
14
+ textAlign : 'center',
15
+ icon : _this.chart.pathToImages + 'export.png',
16
+ iconTitle : 'Save chart as an image',
17
+ format : 'png'
18
+ }],
19
+ menuItemStyle : {
20
+ backgroundColor : 'transparent',
21
+ rollOverBackgroundColor : '#EFEFEF',
22
+ color : '#000000',
23
+ rollOverColor : '#CC0000',
24
+ paddingTop : '6px',
25
+ paddingRight : '6px',
26
+ paddingBottom : '6px',
27
+ paddingLeft : '6px',
28
+ marginTop : '0px',
29
+ marginRight : '0px',
30
+ marginBottom : '0px',
31
+ marginLeft : '0px',
32
+ textAlign : 'left',
33
+ textDecoration : 'none',
34
+ fontFamily : _this.chart.fontFamily,
35
+ fontSize : _this.chart.fontSize + 'px'
36
+ },
37
+ menuItemOutput : {
38
+ backgroundColor : '#FFFFFF',
39
+ fileName : 'amChart',
40
+ format : 'png',
41
+ output : 'dataurlnewwindow',
42
+ render : 'browser',
43
+ dpi : 90,
44
+ onclick : function(instance, config, event) {
45
+ event.preventDefault();
46
+ // Polify SVG; needs to wait
47
+ instance.polifySVG();
48
+ instance.output(config);
49
+ }
50
+ },
51
+ removeImagery: false
52
+ };
53
+ _this.processing = {
54
+ buffer: [],
55
+ drawn: 0,
56
+ timer: 0
57
+ };
58
+
59
+ // Config dependency adaption
60
+ if (typeof(window.canvg) != 'undefined' && typeof(window.RGBColor) != 'undefined') {
61
+ _this.cfg.menuItemOutput.render = 'canvg';
62
+ }
63
+ if (typeof(window.saveAs) != 'undefined') {
64
+ _this.cfg.menuItemOutput.output = 'save';
65
+ }
66
+ if (AmCharts.isIE && AmCharts.IEversion < 10) {
67
+ _this.cfg.menuItemOutput.output = 'dataurlnewwindow';
68
+ }
69
+
70
+ // Merge given configs
71
+ if (cfg) {
72
+ cfg.menuItemOutput = AmCharts.extend(_this.cfg.menuItemOutput, cfg.menuItemOutput || {});
73
+ cfg.menuItemStyle = AmCharts.extend(_this.cfg.menuItemStyle, cfg.menuItemStyle || {});
74
+ _this.cfg = AmCharts.extend(_this.cfg, cfg);
75
+ }
76
+
77
+ // Add reference to chart
78
+ _this.chart.AmExport = _this;
79
+
80
+ // Listen to the drawer
81
+ _this.chart.addListener('rendered', function() {
82
+ _this.setup();
83
+ });
84
+
85
+ // DEBUG; Public reference
86
+ if (_this.DEBUG) {
87
+ window.AmExport = _this;
88
+ }
89
+ },
90
+
91
+ /*
92
+ Simple log function for internal purpose
93
+ @param **args
94
+ */
95
+ log: function() {
96
+ console.log('AmExport: ', arguments);
97
+ },
98
+
99
+ /* PUBLIC
100
+ Prepares everything to get exported
101
+ @param none
102
+ */
103
+ setup: function() {
104
+ var _this = this;
105
+
106
+ if (_this.DEBUG == 10) {
107
+ _this.log('SETUP START');
108
+ } // DEBUG
109
+
110
+
111
+ if (!AmCharts.isIE || (AmCharts.isIE && AmCharts.IEversion > 9)) {
112
+ // Build Buttons
113
+ _this.generateButtons();
114
+ if (_this.DEBUG == 10) {
115
+ _this.log('SETUP END');
116
+ } // DEBUG
117
+ } else {
118
+ if (_this.DEBUG == 10) {
119
+ _this.log('< IE10 NOT SUPPORTED');
120
+ } // DEBUG
121
+ }
122
+ },
123
+
124
+ /* PUBLIC
125
+ Decodes base64 string to binary array
126
+ @param base64_string
127
+ @copyright Eli Grey, http://eligrey.com and Devin Samarin, https://github.com/eboyjr
128
+ */
129
+ generateBinaryArray: function(base64_string) {
130
+ var
131
+ len = base64_string.length,
132
+ buffer = new Uint8Array(len / 4 * 3 | 0),
133
+ i = 0,
134
+ outptr = 0,
135
+ last = [0, 0],
136
+ state = 0,
137
+ save = 0,
138
+ rank, code, undef, base64_ranks = new Uint8Array([
139
+ 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
140
+ ]);
141
+ while (len--) {
142
+ code = base64_string.charCodeAt(i++);
143
+ rank = base64_ranks[code - 43];
144
+ if (rank !== 255 && rank !== undef) {
145
+ last[1] = last[0];
146
+ last[0] = code;
147
+ save = (save << 6) | rank;
148
+ state++;
149
+ if (state === 4) {
150
+ buffer[outptr++] = save >>> 16;
151
+ if (last[1] !== 61 /* padding character */ ) {
152
+ buffer[outptr++] = save >>> 8;
153
+ }
154
+ if (last[0] !== 61 /* padding character */ ) {
155
+ buffer[outptr++] = save;
156
+ }
157
+ state = 0;
158
+ }
159
+ }
160
+ }
161
+ // 2/3 chance there's going to be some null bytes at the end, but that
162
+ // doesn't really matter with most image formats.
163
+ // If it somehow matters for you, truncate the buffer up outptr.
164
+ return buffer;
165
+ },
166
+
167
+ /*
168
+ Creates blob object
169
+ @param base64_datastring string
170
+ @param type string
171
+ */
172
+ generateBlob: function(datastring, type) {
173
+ var _this = this,
174
+ header_end = datastring.indexOf(',') + 1,
175
+ header = datastring.substring(0, header_end),
176
+ data = datastring,
177
+ blob = new Blob();
178
+
179
+ if (header.indexOf('base64') != -1) {
180
+ data = _this.generateBinaryArray(datastring.substring(header_end));
181
+ }
182
+
183
+ // Fake blob for IE
184
+ if (AmCharts.isIE && AmCharts.IEversion < 10) {
185
+ blob.data = data;
186
+ blob.size = data.length;
187
+ blob.type = type;
188
+ blob.encoding = 'base64';
189
+ } else {
190
+ blob = new Blob([data], {
191
+ type: type
192
+ });
193
+ }
194
+ return blob;
195
+ },
196
+
197
+ /*
198
+ Creates PDF object
199
+ @param config object
200
+ */
201
+ generatePDF: function(cfg) {
202
+ var _this = this,
203
+ pdf = {
204
+ output: function() {
205
+ return '';
206
+ }
207
+ },
208
+ data = _this.canvas.toDataURL('image/jpeg'), // JSPDF ONLY SUPPORTS JPG
209
+ width = (_this.canvas.width * 25.4) / cfg.dpi,
210
+ height = (_this.canvas.height * 25.4) / cfg.dpi;
211
+
212
+ // Check
213
+ if (window.jsPDF) {
214
+ pdf = new jsPDF();
215
+ if (pdf.addImage) {
216
+ pdf.addImage(data, 'JPEG', 0, 0, width, height);
217
+ } else {
218
+ alert("Missing jsPDF plugin; Please add the 'addImage' plugin.");
219
+ }
220
+ } else {
221
+ alert("Missing jsPDF lib; Don't forget to add the addImage plugin.");
222
+ }
223
+
224
+ return pdf;
225
+ },
226
+
227
+ /*
228
+ Creates the CANVAS to receive the image data
229
+ @param format void()
230
+ @param callback; given callback function which returns the blob or datastring of the configured ouput type
231
+ */
232
+ output: function(cfg, externalCallback) {
233
+ var _this = this;
234
+ cfg = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemOutput), cfg || {});
235
+
236
+ /* PRIVATE
237
+ Callback function which gets called after the drawing process is done
238
+ @param none
239
+ */
240
+ function internalCallback() {
241
+ var data = null;
242
+ var blob;
243
+ if (_this.DEBUG == 10) {
244
+ _this.log('OUTPUT', format);
245
+ } // DEBUG
246
+
247
+ // SVG
248
+ if (cfg.format == 'image/svg+xml' || cfg.format == 'svg') {
249
+ for (var i = 0; i < _this.processing.buffer.length; i++) {
250
+ data = new XMLSerializer().serializeToString(_this.processing.buffer[i][0]);
251
+ blob = _this.generateBlob(data, 'image/svg+xml');
252
+
253
+ if (cfg.output == 'save') {
254
+ saveAs(blob, cfg.fileName + '.svg');
255
+ } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
256
+ blob = 'data:image/svg+xml;base64,' + btoa(data);
257
+ } else if (cfg.output == 'dataurlnewwindow') {
258
+ window.open('data:image/svg+xml;base64,' + btoa(data));
259
+ } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
260
+ location.href = 'data:image/svg+xml;base64,' + btoa(data);
261
+ } else if (cfg.output == 'datastream') {
262
+ location.href = 'data:image/octet-stream;base64,' + btoa(data);
263
+ }
264
+
265
+ if (externalCallback)
266
+ externalCallback.apply(_this, [blob]);
267
+ }
268
+ // PDF
269
+ } else if (cfg.format == 'application/pdf' || cfg.format == 'pdf') {
270
+ data = _this.generatePDF(cfg).output('dataurlstring');
271
+ blob = _this.generateBlob(data, 'application/pdf');
272
+
273
+ if (cfg.output == 'save') {
274
+ saveAs(blob, cfg.fileName + '.pdf');
275
+ } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
276
+ blob = data;
277
+ } else if (cfg.output == 'dataurlnewwindow') {
278
+ window.open(data);
279
+ } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
280
+ location.href = data;
281
+ } else if (cfg.output == 'datastream') {
282
+ location.href = data.replace('application/pdf', 'application/octet-stream');
283
+ }
284
+
285
+ if (externalCallback)
286
+ externalCallback.apply(_this, [blob]);
287
+
288
+ // PNG
289
+ } else if (cfg.format == 'image/png' || cfg.format == 'png') {
290
+ data = _this.canvas.toDataURL('image/png');
291
+ blob = _this.generateBlob(data, 'image/png');
292
+
293
+ if (cfg.output == 'save') {
294
+ saveAs(blob, cfg.fileName + '.png');
295
+ } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
296
+ blob = data;
297
+ } else if (cfg.output == 'dataurlnewwindow') {
298
+ window.open(data);
299
+ } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
300
+ location.href = data;
301
+ } else if (cfg.output == 'datastream') {
302
+ location.href = data.replace('image/png', 'image/octet-stream');
303
+ }
304
+
305
+ if (externalCallback)
306
+ externalCallback.apply(_this, [blob]);
307
+
308
+ // JPG
309
+ } else if (cfg.format == 'image/jpeg' || cfg.format == 'jpeg' || cfg.format == 'jpg') {
310
+ data = _this.canvas.toDataURL('image/jpeg');
311
+ blob = _this.generateBlob(data, 'image/jpeg');
312
+
313
+ if (cfg.output == 'save') {
314
+ saveAs(blob, cfg.fileName + '.jpg');
315
+ } else if (cfg.output == 'datastring' || cfg.output == 'datauristring' || cfg.output == 'dataurlstring') {
316
+ blob = data;
317
+ } else if (cfg.output == 'dataurlnewwindow') {
318
+ window.open(data);
319
+ } else if (cfg.output == 'datauri' || cfg.output == 'dataurl') {
320
+ location.href = data;
321
+ } else if (cfg.output == 'datastream') {
322
+ location.href = data.replace('image/jpeg', 'image/octet-stream');
323
+ }
324
+
325
+ if (externalCallback)
326
+ externalCallback.apply(_this, [blob]);
327
+ }
328
+
329
+ }
330
+
331
+ return _this.generateOutput(cfg, internalCallback);
332
+ },
333
+
334
+ /* PUBLIC
335
+ Polifies missing attributes to the SVG and replaces images to embedded base64 images
336
+ @param none
337
+ */
338
+ polifySVG: function() {
339
+ var _this = this;
340
+ var svgs = _this.chart.div.getElementsByTagName('svg');
341
+
342
+ // Recursive function to force the attributes
343
+ function recursiveChange(svg, tag) {
344
+ var items = svg.getElementsByTagName(tag);
345
+
346
+ for (var i = 0; i < items.length; i++) {
347
+
348
+ if ( _this.cfg.removeImagery ) {
349
+ items[i].parentNode.removeChild(items[i]);
350
+
351
+ } else {
352
+ var image = document.createElement('img');
353
+ var canvas = document.createElement('canvas');
354
+ var ctx = canvas.getContext('2d');
355
+
356
+ canvas.width = items[i].getAttribute('width');
357
+ canvas.height = items[i].getAttribute('height');
358
+ image.src = items[i].getAttribute('xlink:href');
359
+ image.width = items[i].getAttribute('width');
360
+ image.height = items[i].getAttribute('height');
361
+
362
+ try {
363
+ ctx.drawImage(image, 0, 0, image.width, image.height);
364
+ datastring = canvas.toDataURL(); // image.src; // canvas.toDataURL(); //
365
+ } catch (err) {
366
+ datastring = image.src; // image.src; // canvas.toDataURL(); //
367
+
368
+ _this.log('Tainted canvas, reached browser CORS security; origin from imagery must be equal to the server!');
369
+ throw new Error(err);
370
+ }
371
+
372
+ items[i].setAttribute('xlink:href', datastring);
373
+ }
374
+
375
+ if (_this.DEBUG == 10) {
376
+ _this.log('POLIFIED', items[i]);
377
+ } // DEBUG
378
+ }
379
+ }
380
+
381
+ // Loop through svgs to add some standardization
382
+ for (var i = 0; i < svgs.length; i++) {
383
+ var parent = svgs[i].parentNode;
384
+
385
+ // Put some attrs to it; fixed 20/03/14 xmlns is required to produce a valid svg file
386
+ if ( !AmCharts.isIE ) {
387
+ svgs[i].setAttribute('xmlns','http://www.w3.org/2000/svg');
388
+ //svgs[i].setAttribute('xmlns:xlink','http://www.w3.org/1999/xlink');
389
+ }
390
+ //svgs[i].setAttribute('width',parent.style.width);
391
+ //svgs[i].setAttribute('height',parent.style.height);
392
+
393
+ // DEBUG
394
+ if (_this.DEBUG == 10) {
395
+ _this.log('POLIFIED', svgs[i]);
396
+ }
397
+
398
+ // Force link adaption
399
+ recursiveChange(svgs[i], 'pattern');
400
+ recursiveChange(svgs[i], 'image');
401
+
402
+ _this.svgs.push(svgs[i]);
403
+ }
404
+
405
+ return svgs;
406
+ },
407
+
408
+ /* PUBLIC
409
+ Generates the canvas with the given SVGs and configured renderer
410
+ @param callback; function(); gets called after drawing process on the canvas has been finished
411
+ */
412
+ generateOutput: function(cfg, callback) {
413
+ var _this = this,
414
+ svgs = _this.chart.div.getElementsByTagName('svg'),
415
+ canvas = document.createElement('canvas'),
416
+ context = canvas.getContext('2d'),
417
+ offset = {
418
+ y: 0,
419
+ x: 0
420
+ },
421
+ tmp = {};
422
+
423
+ // Reset
424
+ _this.processing.buffer = [];
425
+ _this.processing.drawn = 0;
426
+ _this.canvas = canvas;
427
+
428
+ // Walkthroug SVGs
429
+ if (_this.DEBUG == 10) {
430
+ _this.log('START EXPORT');
431
+ } // DEBUG
432
+ if (_this.DEBUG == 10) {
433
+ _this.log('START BUFFERING');
434
+ } // DEBUG
435
+ for (var i = 0; i < svgs.length; i++) {
436
+ var parent = svgs[i].parentNode,
437
+ svgX = Number(parent.style.left.slice(0, -2)),
438
+ svgY = Number(parent.style.top.slice(0, -2));
439
+ tmp = AmCharts.extend({}, offset);
440
+
441
+ // Overtake parent position if given; fixed 20/03/14 distinguish between relativ and others
442
+ if ( parent.style.position == 'relative' ) {
443
+ offset.x = svgX? svgX : offset.x;
444
+ offset.y = svgY? svgY : offset.y;
445
+ } else {
446
+ offset.x = svgX;
447
+ offset.y = svgY;
448
+ }
449
+
450
+ _this.processing.buffer.push([svgs[i], AmCharts.extend({}, offset)]);
451
+
452
+ // Put back from "cache"
453
+ if (svgY && svgX) {
454
+ offset = tmp;
455
+
456
+ // New offset for next one
457
+ } else {
458
+ offset.y += svgY ? 0 : parent.offsetHeight;
459
+ }
460
+
461
+ if (_this.DEBUG == 10) {
462
+ _this.log('BUFFERED', svgs[i], offset);
463
+ } // DEBUG
464
+ }
465
+ if (_this.DEBUG == 10) {
466
+ _this.log('END BUFFERING');
467
+ } // DEBUG
468
+
469
+ // Apply background
470
+ if (_this.DEBUG == 10) {
471
+ _this.log('START DRAWING', cfg.render);
472
+ } // DEBUG
473
+ if (_this.DEBUG == 10) {
474
+ _this.log('FILL BACKGROUND');
475
+ } // DEBUG
476
+ canvas.id = AmCharts.getUniqueId();
477
+ canvas.width = _this.chart.divRealWidth;
478
+ canvas.height = _this.chart.divRealHeight;
479
+
480
+ // Set given background; jpeg default
481
+ if (cfg.backgroundColor || format == 'image/jpeg') {
482
+ context.fillStyle = cfg.backgroundColor || '#FFFFFF';
483
+ context.fillRect(0, 0, canvas.width, canvas.height);
484
+ }
485
+
486
+ /* PRIVATE
487
+ Recursive function to draw the images to the canvas;
488
+ @param none;
489
+ */
490
+ function drawItWhenItsLoaded() {
491
+ var img, buffer, offset, source;
492
+
493
+ // DRAWING PROCESS DONE
494
+ if (_this.processing.buffer.length == _this.processing.drawn) {
495
+ if (_this.DEBUG == 10) {
496
+ _this.log('END DRAWING');
497
+ } // DEBUG
498
+ return callback();
499
+
500
+ // LOOPING LUI
501
+ } else {
502
+ if (_this.DEBUG == 10) {
503
+ _this.log('DRAW', _this.processing.drawn + 1, 'OF', _this.processing.buffer.length);
504
+ } // DEBUG
505
+
506
+ buffer = _this.processing.buffer[_this.processing.drawn];
507
+ source = new XMLSerializer().serializeToString(buffer[0]); //source = 'data:image/svg+xml;base64,' + btoa();
508
+ offset = buffer[1];
509
+
510
+ if (_this.DEBUG == 10) {
511
+ _this.log('SOURCE', source);
512
+ } // DEBUG
513
+
514
+ // NATIVE
515
+ if (cfg.render == 'browser') {
516
+ img = new Image();
517
+ img.id = AmCharts.getUniqueId();
518
+ source = 'data:image/svg+xml;base64,' + btoa(source);
519
+
520
+ //img.crossOrigin = "Anonymous";
521
+ img.onload = function() {
522
+ context.drawImage(this, buffer[1].x, buffer[1].y);
523
+ _this.processing.drawn++;
524
+
525
+ if (_this.DEBUG == 10) {
526
+ _this.log('ONLOAD', this);
527
+ } // DEBUG
528
+ drawItWhenItsLoaded();
529
+ };
530
+ img.onerror = function() {
531
+ if (_this.DEBUG == 10) {
532
+ _this.log('ONERROR', this);
533
+ } // DEBUG
534
+ context.drawImage(this, buffer[1].x, buffer[1].y);
535
+ _this.processing.drawn++;
536
+ drawItWhenItsLoaded();
537
+ };
538
+ img.src = source;
539
+
540
+ if (_this.DEBUG == 10) {
541
+ _this.log('ADD', img);
542
+ } // DEBUG
543
+ if (img.complete || typeof(img.complete) == 'undefined' || img.complete === undefined) {
544
+ if (_this.DEBUG == 10) {
545
+ _this.log('FORCE ONLOAD', img);
546
+ } // DEBUG
547
+ img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
548
+ img.src = source;
549
+ }
550
+
551
+ // CANVG
552
+ } else if (cfg.render == 'canvg') {
553
+ canvg(canvas, source, {
554
+ offsetX: offset.x,
555
+ offsetY: offset.y,
556
+ ignoreMouse: true,
557
+ ignoreAnimation: true,
558
+ ignoreDimensions: true,
559
+ ignoreClear: true,
560
+ renderCallback: function() {
561
+ _this.processing.drawn++;
562
+ drawItWhenItsLoaded();
563
+ }
564
+ });
565
+ }
566
+ }
567
+ }
568
+ return drawItWhenItsLoaded();
569
+ },
570
+
571
+ /*
572
+ Generates the export menu to trigger the exportation
573
+ @param none;
574
+ */
575
+ generateButtons: function() {
576
+ var _this = this,
577
+ div = document.createElement('div'),
578
+ lvl = 0;
579
+
580
+ // Push sublings
581
+ function createList(items) {
582
+ var ul = document.createElement('ul');
583
+
584
+ ul.setAttribute('style', 'list-style: none; margin: 0; padding: 0;');
585
+
586
+ // Walkthrough items
587
+ for (var i = 0; i < items.length; i++) {
588
+ var li = document.createElement('li'),
589
+ img = document.createElement('img'),
590
+ a = document.createElement('a'),
591
+ item = items[i],
592
+ children = null,
593
+ itemStyle = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemStyle), items[i]);
594
+
595
+ // MERGE CFG
596
+ item = AmCharts.extend(AmCharts.extend({}, _this.cfg.menuItemOutput), item);
597
+
598
+ // ICON
599
+ if (item['icon']) {
600
+ img.alt = '';
601
+ img.src = item['icon'];
602
+ img.setAttribute('style', 'margin: 0 auto;border: none;outline: none');
603
+ if (item['iconTitle']) {
604
+ img.title = item['iconTitle'];
605
+ }
606
+ a.appendChild(img);
607
+ }
608
+
609
+ // TITLE; STYLING
610
+ a.href = '#';
611
+ if (item['title']) {
612
+ img.setAttribute('style', 'margin-right: 5px;');
613
+ a.innerHTML += item.title;
614
+ }
615
+ a.setAttribute('style', 'display: block;');
616
+ AmCharts.extend(a.style, itemStyle);
617
+
618
+ // ONCLICK
619
+ a.onclick = item.onclick.bind(a, _this, item);
620
+ li.appendChild(a);
621
+
622
+ // APPEND SIBLINGS
623
+ if (item.items) {
624
+ children = createList(item.items);
625
+ li.appendChild(children);
626
+
627
+ li.onmouseover = function() {
628
+ children.style.display = 'block';
629
+ };
630
+ li.onmouseout = function() {
631
+ children.style.display = 'none';
632
+ };
633
+ children.style.display = 'none';
634
+ }
635
+
636
+ // Append to parent
637
+ ul.appendChild(li);
638
+
639
+ // Apply hover
640
+ a.onmouseover = function() {
641
+ this.style.backgroundColor = itemStyle.rollOverBackgroundColor;
642
+ this.style.color = itemStyle.rollOverColor;
643
+ this.style.borderColor = itemStyle.rollOverBorderColor;
644
+ };
645
+ a.onmouseout = function() {
646
+ this.style.backgroundColor = itemStyle.backgroundColor;
647
+ this.style.color = itemStyle.color;
648
+ this.style.borderColor = itemStyle.borderColor;
649
+ };
650
+ }
651
+ lvl++;
652
+
653
+ if (_this.DEBUG == 10) {
654
+ _this.log('MENU', ul);
655
+ } // DEBUG
656
+
657
+ return ul;
658
+ }
659
+
660
+ // Style wrapper; Push into chart div
661
+ div.setAttribute('style', 'width:39px; height:28px; position: absolute;top:' + _this.cfg.menuTop + ';right:' + _this.cfg.menuRight + ';bottom:' + _this.cfg.menuBottom + ';left:' + _this.cfg.menuLeft + ';box-shadow:0px 0px 1px 0px rgba(0,0,0,0);');
662
+ div.setAttribute('class', 'amExportButton');
663
+ div.appendChild(createList(_this.cfg.menuItems));
664
+ //_this.chart.div.style.position = 'relative';
665
+ _this.chart.containerDiv.appendChild(div);
666
+ }
666
667
  });