amcharts.rb 3.1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/amcharts.rb.gemspec +23 -0
- data/lib/amcharts.rb +9 -0
- data/lib/amcharts/version.rb +3 -0
- data/vendor/assets/images/amcharts/dragIcon.gif +0 -0
- data/vendor/assets/images/amcharts/dragIconH.gif +0 -0
- data/vendor/assets/images/amcharts/lens.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern1.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern10.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern11.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern12.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern13.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern14.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern15.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern16.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern17.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern18.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern19.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern2.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern20.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern21.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern3.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern4.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern5.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern6.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern7.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern8.png +0 -0
- data/vendor/assets/images/amcharts/patterns/black/pattern9.png +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern1.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern1r.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern2.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern3.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern4.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern5.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/chalk/pattern6.jpg +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern1.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern10.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern11.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern12.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern13.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern14.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern15.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern16.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern17.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern18.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern19.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern2.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern20.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern21.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern3.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern4.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern5.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern6.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern7.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern8.png +0 -0
- data/vendor/assets/images/amcharts/patterns/white/pattern9.png +0 -0
- data/vendor/assets/javascripts/amcharts/amcharts.js +337 -0
- data/vendor/assets/javascripts/amcharts/funnel.js +7 -0
- data/vendor/assets/javascripts/amcharts/gauge.js +15 -0
- data/vendor/assets/javascripts/amcharts/pie.js +9 -0
- data/vendor/assets/javascripts/amcharts/radar.js +10 -0
- data/vendor/assets/javascripts/amcharts/serial.js +49 -0
- data/vendor/assets/javascripts/amcharts/xy.js +16 -0
- metadata +140 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
AmCharts.AmFunnelChart=AmCharts.Class({inherits:AmCharts.AmSlicedChart,construct:function(){AmCharts.AmFunnelChart.base.construct.call(this);this.startX=this.startY=0;this.baseWidth="100%";this.neckHeight=this.neckWidth=0;this.rotate=!1;this.valueRepresents="height";this.pullDistance=30;this.labelPosition="center";this.labelText="[[title]]: [[value]]";this.balloonText="[[title]]: [[value]]\n[[description]]"},drawChart:function(){AmCharts.AmFunnelChart.base.drawChart.call(this);var y=this.chartData;
|
2
|
+
if(AmCharts.ifArray(y))if(0<this.realWidth&&0<this.realHeight){var r=this.container,A=this.startDuration,k=this.rotate,u=this.updateWidth();this.realWidth=u;var f=this.updateHeight();this.realHeight=f;var n=AmCharts.toCoordinate,B=n(this.marginLeft,u),t=n(this.marginRight,u),a=n(this.marginTop,f)+this.getTitleHeight(),n=n(this.marginBottom,f),t=u-B-t,v=AmCharts.toCoordinate(this.baseWidth,t),p=AmCharts.toCoordinate(this.neckWidth,t),C=f-n-a,w=AmCharts.toCoordinate(this.neckHeight,C),s=a+C-w;k&&(a=
|
3
|
+
f-n,s=a-C+w);this.firstSliceY=a;AmCharts.VML&&(this.startAlpha=1);for(var g=t/2+B,D=(C-w)/((v-p)/2),x=v/2,v=(C-w)*(v+p)/2+p*w,w=a,F=0,E=0;E<y.length;E++){var c=y[E];if(!0!==c.hidden){var l=[],h=[],b;if("height"==this.valueRepresents)b=C*c.percents/100;else{var m=-v*c.percents/100/2,z=x,d=-1/(2*D);b=Math.pow(z,2)-4*d*m;0>b&&(b=0);b=(Math.sqrt(b)-z)/(2*d);if(!k&&a>=s||k&&a<=s)b=2*-m/p;else if(!k&&a+b>s||k&&a-b<s)d=k?Math.round(b+(a-b-s)):Math.round(b-(a+b-s)),b=d/D,b=d+2*(-m-(z-b/2)*d)/p}m=x-b/D;z=
|
4
|
+
!1;!k&&a+b>s||k&&a-b<s?(m=p/2,l.push(g-x,g+x,g+m,g+m,g-m,g-m),k?(d=b+(a-b-s),h.push(a,a,a-d,a-b,a-b,a-d,a)):(d=b-(a+b-s),h.push(a,a,a+d,a+b,a+b,a+d,a)),z=!0):(l.push(g-x,g+x,g+m,g-m),k?h.push(a,a,a-b,a-b):h.push(a,a,a+b,a+b));r.set();d=r.set();l=AmCharts.polygon(r,l,h,c.color,c.alpha,this.outlineThickness,this.outlineColor,this.outlineAlpha);d.push(l);this.graphsSet.push(d);c.wedge=d;c.index=E;if(h=this.gradientRatio){var q=[],e;for(e=0;e<h.length;e++)q.push(AmCharts.adjustLuminosity(c.color,h[e]));
|
5
|
+
0<q.length&&l.gradient("linearGradient",q);c.pattern&&l.pattern(c.pattern)}0<A&&(l=this.startAlpha,this.chartCreated&&(l=c.alpha),d.setAttr("opacity",l));this.addEventListeners(d,c);this.labelsEnabled&&this.labelText&&c.percents>=this.hideLabelsPercent&&(h=this.formatString(this.labelText,c),q=c.labelColor,q||(q=this.color),l=this.labelPosition,e="left","center"==l&&(e="middle"),"left"==l&&(e="right"),h=AmCharts.text(r,h,q,this.fontFamily,this.fontSize,e),d.push(h),q=g,k?(e=a-b/2,c.ty0=e):(e=a+b/
|
6
|
+
2,c.ty0=e,e<w+F+5&&(e=w+F+5),e>f-n&&(e=f-n)),"right"==l&&(q=t+10+B,c.tx0=g+(x-b/2/D),z&&(c.tx0=g+m)),"left"==l&&(c.tx0=g-(x-b/2/D),z&&(c.tx0=g-m),q=B),c.label=h,c.labelX=q,c.labelY=e,c.labelHeight=h.getBBox().height,h.translate(q,e),(0===c.alpha||0<A&&!this.chartCreated)&&d.hide(),a=k?a-b:a+b,x=m,F=h.getBBox().height,w=e);c.startX=AmCharts.toCoordinate(this.startX,u);c.startY=AmCharts.toCoordinate(this.startY,f);c.pullX=AmCharts.toCoordinate(this.pullDistance,u);c.pullY=0;c.balloonX=g;c.balloonY=
|
7
|
+
c.ty0}}this.arrangeLabels();this.initialStart();(y=this.legend)&&y.invalidateSize()}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},arrangeLabels:function(){var y=this.rotate,r;r=y?0:this.realHeight;for(var A=0,k=this.chartData,u=k.length,f,n=0;n<u;n++){f=k[u-n-1];var B=f.label,t=f.labelY,a=f.labelX,v=f.labelHeight,p=t;y?r+A+5>t&&(p=r+A+5):t+v+5>r&&(p=r-5-v);r=p;A=v;B.translate(a,p);f.labelY=p;f.tx=a;f.ty=p;f.tx2=a}"center"!=this.labelPosition&&this.drawTicks()}});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
AmCharts.GaugeAxis=AmCharts.Class({construct:function(){this.radius="95%";this.startAngle=-120;this.endAngle=120;this.startValue=0;this.endValue=200;this.valueInterval=20;this.minorTickInterval=5;this.tickLength=10;this.minorTickLength=5;this.tickColor="#555555";this.labelFrequency=this.tickThickness=this.tickAlpha=1;this.inside=!0;this.labelOffset=15;this.showLastLabel=this.showFirstLabel=!0;this.axisThickness=1;this.axisColor="#000000";this.axisAlpha=1;this.gridInside=!0;this.topText="";this.topTextYOffset=
|
2
|
+
0;this.topTextBold=!0;this.bottomText="";this.bottomTextYOffset=0;this.bottomTextBold=!0;this.centerY=this.centerX="0%";this.bandOutlineAlpha=this.bandOutlineThickness=0;this.bandOutlineColor="#000000";this.bandAlpha=1},value2angle:function(a){return this.startAngle+this.singleValueAngle*a},setTopText:function(a){this.topText=a;var b=this.chart;if(this.axisCreated){this.topTF&&this.topTF.remove();var d=this.topTextFontSize;d||(d=b.fontSize);var c=this.topTextColor;c||(c=b.color);b=this.chart;a=AmCharts.text(b.container,
|
3
|
+
a,c,b.fontFamily,d,void 0,this.topTextBold);a.translate(this.centerXReal,this.centerYReal-this.radiusReal/2+this.topTextYOffset);this.chart.graphsSet.push(a);this.topTF=a}},setBottomText:function(a){this.bottomText=a;var b=this.chart;if(this.axisCreated){this.bottomTF&&this.bottomTF.remove();var d=this.bottomTextFontSize;d||(d=b.fontSize);var c=this.bottomTextColor;c||(c=b.color);b=this.chart;a=AmCharts.text(b.container,a,c,b.fontFamily,d,void 0,this.bottomTextBold);a.translate(this.centerXReal,this.centerYReal+
|
4
|
+
this.radiusReal/2+this.bottomTextYOffset);this.bottomTF=a;this.chart.graphsSet.push(a)}},draw:function(){var a=this.chart,b=a.graphsSet,d=this.startValue,c=this.valueInterval,l=this.startAngle,g=this.endAngle,h=this.tickLength,k=(this.endValue-d)/c+1,f=(g-l)/(k-1),m=f/c;this.singleValueAngle=m;var e=a.container,p=this.tickColor,u=this.tickAlpha,B=this.tickThickness,C=c/this.minorTickInterval,D=f/C,E=this.minorTickLength,F=this.labelFrequency,q=this.radiusReal;this.inside||(q-=15);var w=a.centerX+
|
5
|
+
AmCharts.toCoordinate(this.centerX,a.realWidth),x=a.centerY+AmCharts.toCoordinate(this.centerY,a.realHeight);this.centerXReal=w;this.centerYReal=x;var s={fill:this.axisColor,"fill-opacity":this.axisAlpha,"stroke-width":0,"stroke-opacity":0},n,z;this.gridInside?z=n=q:(n=q-h,z=n+E);var r=this.axisThickness/2,g=AmCharts.wedge(e,w,x,l,g-l,n+r,n+r,n-r,0,s);b.push(g);g=AmCharts.doNothing;AmCharts.isModern||(g=Math.round);for(s=0;s<k;s++){r=d+s*c;n=l+s*f;var v=g(w+q*Math.sin(n/180*Math.PI)),t=g(x-q*Math.cos(n/
|
6
|
+
180*Math.PI)),A=g(w+(q-h)*Math.sin(n/180*Math.PI)),y=g(x-(q-h)*Math.cos(n/180*Math.PI)),v=AmCharts.line(e,[v,A],[t,y],p,u,B,0,!1,!1,!0);b.push(v);t=this.labelOffset;this.inside||(t=-t-h);v=w+(q-h-t)*Math.sin(n/180*Math.PI);t=x-(q-h-t)*Math.cos(n/180*Math.PI);A=this.fontSize;isNaN(A)&&(A=a.fontSize);0<F&&s/F==Math.round(s/F)&&(this.showLastLabel||s!=k-1)&&(this.showFirstLabel||0!==s)&&(r=AmCharts.text(e,r,a.color,a.fontFamily,A),r.translate(v,t),b.push(r));if(s<k-1)for(r=1;r<C;r++)y=n+D*r,v=g(w+z*
|
7
|
+
Math.sin(y/180*Math.PI)),t=g(x-z*Math.cos(y/180*Math.PI)),A=g(w+(z-E)*Math.sin(y/180*Math.PI)),y=g(x-(z-E)*Math.cos(y/180*Math.PI)),v=AmCharts.line(e,[v,A],[t,y],p,u,B,0,!1,!1,!0),b.push(v)}if(b=this.bands)for(d=0;d<b.length;d++)if(c=b[d])p=c.startValue,u=c.endValue,h=AmCharts.toCoordinate(c.radius,q),isNaN(h)&&(h=z),k=AmCharts.toCoordinate(c.innerRadius,q),isNaN(k)&&(k=h-E),f=l+m*p,u=m*(u-p),B=c.outlineColor,void 0==B&&(B=this.bandOutlineColor),C=c.outlineThickness,isNaN(C)&&(C=this.bandOutlineThickness),
|
8
|
+
D=c.outlineAlpha,isNaN(D)&&(D=this.bandOutlineAlpha),p=c.alpha,isNaN(p)&&(p=this.bandAlpha),c=AmCharts.wedge(e,w,x,f,u,h,h,k,0,{fill:c.color,stroke:B,"stroke-width":C,"stroke-opacity":D}),c.setAttr("opacity",p),a.gridSet.push(c);this.axisCreated=!0;this.setTopText(this.topText);this.setBottomText(this.bottomText);a=a.graphsSet.getBBox();this.width=a.width;this.height=a.height}});AmCharts.GaugeArrow=AmCharts.Class({construct:function(){this.color="#000000";this.nailAlpha=this.alpha=1;this.startWidth=this.nailRadius=8;this.borderAlpha=1;this.radius="90%";this.nailBorderAlpha=this.innerRadius=0;this.nailBorderThickness=1;this.frame=0},setValue:function(a){var b=this.chart;b?b.setValue(this,a):this.previousValue=this.value=a}});AmCharts.GaugeBand=AmCharts.Class({construct:function(){}});AmCharts.AmAngularGauge=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(){AmCharts.AmAngularGauge.base.construct.call(this);this.minRadius=this.marginRight=this.marginBottom=this.marginTop=this.marginLeft=10;this.faceColor="#FAFAFA";this.faceAlpha=0;this.faceBorderWidth=1;this.faceBorderColor="#555555";this.faceBorderAlpha=0;this.arrows=[];this.axes=[];this.startDuration=1;this.startEffect=">";this.adjustSize=!0;this.extraHeight=this.extraWidth=0;this.clockWiseOnly=!1},addAxis:function(a){a.chart=
|
9
|
+
this;this.axes.push(a)},initChart:function(){AmCharts.AmAngularGauge.base.initChart.call(this);if(0===this.axes.length){var a=new AmCharts.GaugeAxis;this.addAxis(a)}for(var b,a=0;a<this.arrows.length;a++)b=this.arrows[a],b.axis||(b.axis=this.axes[0]),isNaN(b.value)&&b.setValue(b.axis.startValue),isNaN(b.previousValue)&&(b.previousValue=b.axis.startValue);this.drawChart();this.totalFrames=1E3*this.startDuration/AmCharts.updateRate},drawChart:function(){AmCharts.AmAngularGauge.base.drawChart.call(this);
|
10
|
+
var a=this.container,b=this.updateWidth();this.realWidth=b;var d=this.updateHeight();this.realHeight=d;var c=AmCharts.toCoordinate,l=c(this.marginLeft,b),g=c(this.marginRight,b),h=c(this.marginTop,d)+this.getTitleHeight(),k=c(this.marginBottom,d),f=c(this.radius,b,d),c=b-l-g,m=d-h-k+this.extraHeight;f||(f=Math.min(c,m)/2);f<this.minRadius&&(f=this.minRadius);this.radiusReal=f;this.centerX=(b-l-g)/2+l;this.centerY=(d-h-k)/2+h+this.extraHeight/2;isNaN(this.gaugeX)||(this.centerX=this.gaugeX);isNaN(this.gaugeY)||
|
11
|
+
(this.centerY=this.gaugeY);var b=this.faceAlpha,d=this.faceBorderAlpha,e;if(0<b||0<d)e=AmCharts.circle(a,f,this.faceColor,b,this.faceBorderWidth,this.faceBorderColor,d,!1),e.translate(this.centerX,this.centerY),e.toBack();for(b=f=a=0;b<this.axes.length;b++)d=this.axes[b],d.radiusReal=AmCharts.toCoordinate(d.radius,this.radiusReal),d.draw(),d.width>a&&(a=d.width),d.height>f&&(f=d.height);if(this.adjustSize&&!this.chartCreated){e&&(e=e.getBBox(),e.width>a&&(a=e.width),e.height>f&&(f=e.height));e=0;
|
12
|
+
if(m>f||c>a)e=Math.min(m-f,c-a);0<e&&(this.extraHeight=m-f,this.chartCreated=!0,this.validateNow())}this.chartCreated=!0},validateSize:function(){this.extraHeight=this.extraWidth=0;this.chartCreated=!1;AmCharts.AmAngularGauge.base.validateSize.call(this)},addArrow:function(a){a.chart=this;this.arrows.push(a)},removeArrow:function(a){AmCharts.removeFromArray(this.arrows,a);this.validateNow()},removeAxis:function(a){AmCharts.removeFromArray(this.axes,a);this.validateNow()},drawArrow:function(a,b){a.set&&
|
13
|
+
a.set.remove();var d=a.axis,c=d.radiusReal,l=this.container,g=d.centerXReal,h=d.centerYReal,k=a.startWidth,f=a.innerRadius,m=AmCharts.toCoordinate(a.radius,d.radiusReal);d.inside||(m-=15);a.set=l.set();var e=a.nailColor;e||(e=a.color);var p=a.nailColor;p||(p=a.color);e=AmCharts.circle(l,a.nailRadius,e,a.nailAlpha,a.nailBorderThickness,e,a.nailBorderAlpha);a.set.push(e);e.translate(g,h);isNaN(m)&&(m=c-d.tickLength);var d=Math.sin(b/180*Math.PI),c=Math.cos(b/180*Math.PI),e=Math.sin((b+90)/180*Math.PI),
|
14
|
+
u=Math.cos((b+90)/180*Math.PI),l=AmCharts.polygon(l,[g-k/2*e+f*d,g+m*d,g+k/2*e+f*d],[h+k/2*u-f*c,h-m*c,h-k/2*u-f*c],a.color,a.alpha,1,p,a.borderAlpha,void 0,!0);a.set.push(l);this.graphsSet.push(a.set)},setValue:function(a,b){a.axis&&(a.axis.value2angle(b),a.frame=0,a.previousValue=a.value);a.value=b},updateAnimations:function(){AmCharts.AmAngularGauge.base.updateAnimations.call(this);for(var a=this.arrows.length,b,d=0;d<a;d++){b=this.arrows[d];var c;b.frame>=this.totalFrames?c=b.value:(b.frame++,
|
15
|
+
b.clockWiseOnly&&b.value<b.previousValue&&(c=b.axis,b.previousValue-=c.endValue-c.startValue),c=AmCharts.getEffect(this.startEffect),c=AmCharts[c](0,b.frame,b.previousValue,b.value-b.previousValue,this.totalFrames),isNaN(c)&&(c=b.value));c=b.axis.value2angle(c);this.drawArrow(b,c)}}});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
AmCharts.AmPieChart=AmCharts.Class({inherits:AmCharts.AmSlicedChart,construct:function(){AmCharts.AmPieChart.base.construct.call(this);this.pieBrightnessStep=30;this.minRadius=10;this.depth3D=0;this.startAngle=90;this.angle=this.innerRadius=0;this.startRadius="500%";this.pullOutRadius="20%";this.labelRadius=30;this.labelText="[[title]]: [[percents]]%";this.balloonText="[[title]]: [[percents]]% ([[value]])\n[[description]]";this.previousScale=1},drawChart:function(){AmCharts.AmPieChart.base.drawChart.call(this);
|
2
|
+
var e=this.chartData;if(AmCharts.ifArray(e)){if(0<this.realWidth&&0<this.realHeight){AmCharts.VML&&(this.startAlpha=1);var g=this.startDuration,c=this.container,a=this.updateWidth();this.realWidth=a;var h=this.updateHeight();this.realHeight=h;var d=AmCharts.toCoordinate,k=d(this.marginLeft,a),b=d(this.marginRight,a),q=d(this.marginTop,h)+this.getTitleHeight(),l=d(this.marginBottom,h),w,x,f,s=AmCharts.toNumber(this.labelRadius),r=this.measureMaxLabel();this.labelText&&this.labelsEnabled||(s=r=0);w=
|
3
|
+
void 0===this.pieX?(a-k-b)/2+k:d(this.pieX,this.realWidth);x=void 0===this.pieY?(h-q-l)/2+q:d(this.pieY,h);f=d(this.radius,a,h);f||(a=0<=s?a-k-b-2*r:a-k-b,h=h-q-l,f=Math.min(a,h),h<a&&(f/=1-this.angle/90,f>a&&(f=a)),h=AmCharts.toCoordinate(this.pullOutRadius,f),f=(0<=s?f-1.8*(s+h):f-1.8*h)/2);f<this.minRadius&&(f=this.minRadius);h=d(this.pullOutRadius,f);q=AmCharts.toCoordinate(this.startRadius,f);d=d(this.innerRadius,f);d>=f&&(d=f-1);l=AmCharts.fitToBounds(this.startAngle,0,360);0<this.depth3D&&
|
4
|
+
(l=270<=l?270:90);l-=90;a=f-f*this.angle/90;for(k=0;k<e.length;k++)if(b=e[k],!0!==b.hidden&&0<b.percents){var n=360*b.percents/100,r=Math.sin((l+n/2)/180*Math.PI),y=-Math.cos((l+n/2)/180*Math.PI)*(a/f),p={fill:b.color,stroke:this.outlineColor,"stroke-width":this.outlineThickness,"stroke-opacity":this.outlineAlpha};b.url&&(p.cursor="pointer");p=AmCharts.wedge(c,w,x,l,n,f,a,d,this.depth3D,p,this.gradientRatio,b.pattern);this.addEventListeners(p,b);b.startAngle=l;e[k].wedge=p;if(0<g){var t=this.startAlpha;
|
5
|
+
this.chartCreated&&(t=b.alpha);p.setAttr("opacity",t)}b.ix=r;b.iy=y;b.wedge=p;b.index=k;if(this.labelsEnabled&&this.labelText&&b.percents>=this.hideLabelsPercent){var m=l+n/2,n=s;isNaN(b.labelRadius)||(n=b.labelRadius);var t=w+r*(f+n),u=x+y*(f+n),z,v=0;if(0<=n){var A;90>=m&&0<=m?(A=0,z="start",v=8):90<=m&&180>m?(A=1,z="start",v=8):180<=m&&270>m?(A=2,z="end",v=-8):270<=m&&360>m&&(A=3,z="end",v=-8);b.labelQuarter=A}else z="middle";var m=this.formatString(this.labelText,b),B=b.labelColor;B||(B=this.color);
|
6
|
+
m=AmCharts.text(c,m,B,this.fontFamily,this.fontSize,z);m.translate(t+1.5*v,u);b.tx=t+1.5*v;b.ty=u;u=d+(f-d)/2;b.pulled&&(u+=this.pullOutRadiusReal);b.balloonX=r*u+w;b.balloonY=y*u+x;0<=n?p.push(m):this.freeLabelsSet.push(m);b.label=m;b.tx=t;b.tx2=t+v;b.tx0=w+r*f;b.ty0=x+y*f}b.startX=Math.round(r*q);b.startY=Math.round(y*q);b.pullX=Math.round(r*h);b.pullY=Math.round(y*h);this.graphsSet.push(p);(0===b.alpha||0<g&&!this.chartCreated)&&p.hide();l+=360*b.percents/100}0<s&&!this.labelRadiusField&&this.arrangeLabels();
|
7
|
+
this.pieXReal=w;this.pieYReal=x;this.radiusReal=f;this.innerRadiusReal=d;0<s&&this.drawTicks();this.initialStart();this.setDepths()}(e=this.legend)&&e.invalidateSize()}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},setDepths:function(){var e=this.chartData,g;for(g=0;g<e.length;g++){var c=e[g],a=c.wedge,c=c.startAngle;0<=c&&180>c?a.toFront():180<=c&&a.toBack()}},arrangeLabels:function(){var e=this.chartData,g=e.length,c,a;for(a=g-1;0<=a;a--)c=e[a],0!==c.labelQuarter||c.hidden||this.checkOverlapping(a,
|
8
|
+
c,0,!0,0);for(a=0;a<g;a++)c=e[a],1!=c.labelQuarter||c.hidden||this.checkOverlapping(a,c,1,!1,0);for(a=g-1;0<=a;a--)c=e[a],2!=c.labelQuarter||c.hidden||this.checkOverlapping(a,c,2,!0,0);for(a=0;a<g;a++)c=e[a],3!=c.labelQuarter||c.hidden||this.checkOverlapping(a,c,3,!1,0)},checkOverlapping:function(e,g,c,a,h){var d,k,b=this.chartData,q=b.length,l=g.label;if(l){if(!0===a)for(k=e+1;k<q;k++)b[k].labelQuarter==c&&(d=this.checkOverlappingReal(g,b[k],c))&&(k=q);else for(k=e-1;0<=k;k--)b[k].labelQuarter==
|
9
|
+
c&&(d=this.checkOverlappingReal(g,b[k],c))&&(k=0);!0===d&&100>h&&(d=g.ty+3*g.iy,g.ty=d,l.translate(g.tx2,d),this.checkOverlapping(e,g,c,a,h+1))}},checkOverlappingReal:function(e,g,c){var a=!1,h=e.label,d=g.label;e.labelQuarter!=c||e.hidden||g.hidden||!d||(h=h.getBBox(),c={},c.width=h.width,c.height=h.height,c.y=e.ty,c.x=e.tx,e=d.getBBox(),d={},d.width=e.width,d.height=e.height,d.y=g.ty,d.x=g.tx,AmCharts.hitTest(c,d)&&(a=!0));return a}});
|
@@ -0,0 +1,10 @@
|
|
1
|
+
AmCharts.AmRadarChart=AmCharts.Class({inherits:AmCharts.AmCoordinateChart,construct:function(){AmCharts.AmRadarChart.base.construct.call(this);this.marginRight=this.marginBottom=this.marginTop=this.marginLeft=0;this.chartType="radar";this.radius="35%"},initChart:function(){AmCharts.AmRadarChart.base.initChart.call(this);this.dataChanged&&(this.updateData(),this.dataChanged=!1,this.dispatchDataUpdated=!0);this.drawChart()},updateData:function(){this.parseData();var a=this.graphs,b;for(b=0;b<a.length;b++)a[b].data=
|
2
|
+
this.chartData},updateGraphs:function(){var a=this.graphs,b;for(b=0;b<a.length;b++){var c=a[b];c.index=b;c.width=this.realRadius;c.height=this.realRadius;c.x=this.marginLeftReal;c.y=this.marginTopReal;c.chartType=this.chartType}},parseData:function(){AmCharts.AmRadarChart.base.parseData.call(this);this.parseSerialData()},updateValueAxes:function(){var a=this.valueAxes,b;for(b=0;b<a.length;b++){var c=a[b];c.axisRenderer=AmCharts.RadAxis;c.guideFillRenderer=AmCharts.RadarFill;c.axisItemRenderer=AmCharts.RadItem;
|
3
|
+
c.autoGridCount=!1;c.x=this.marginLeftReal;c.y=this.marginTopReal;c.width=this.realRadius;c.height=this.realRadius}},drawChart:function(){AmCharts.AmRadarChart.base.drawChart.call(this);var a=this.updateWidth(),b=this.updateHeight(),c=this.marginTop+this.getTitleHeight(),d=this.marginLeft,b=b-c-this.marginBottom;this.marginLeftReal=d+(a-d-this.marginRight)/2;this.marginTopReal=c+b/2;this.realRadius=AmCharts.toCoordinate(this.radius,a,b);this.updateValueAxes();this.updateGraphs();a=this.chartData;
|
4
|
+
if(AmCharts.ifArray(a)){if(0<this.realWidth&&0<this.realHeight){a=a.length-1;d=this.valueAxes;for(c=0;c<d.length;c++)d[c].zoom(0,a);d=this.graphs;for(c=0;c<d.length;c++)d[c].zoom(0,a);(a=this.legend)&&a.invalidateSize()}}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},formatString:function(a,b){var c=b.graph;-1!=a.indexOf("[[category]]")&&(a=a.replace(/\[\[category\]\]/g,String(b.serialDataItem.category)));c=c.numberFormatter;c||(c=this.numberFormatter);a=AmCharts.formatValue(a,b.values,
|
5
|
+
["value"],c,"",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers);-1!=a.indexOf("[[")&&(a=AmCharts.formatDataContextValue(a,b.dataContext));return a=AmCharts.AmRadarChart.base.formatString.call(this,a,b)},cleanChart:function(){AmCharts.callMethod("destroy",[this.valueAxes,this.graphs])}});AmCharts.RadAxis=AmCharts.Class({construct:function(a){var b=a.chart,c=a.axisThickness,d=a.axisColor,m=a.axisAlpha,n=a.x,e=a.y;this.set=b.container.set();b.axesSet.push(this.set);var f=a.axisTitleOffset,k=a.radarCategoriesEnabled,l=a.chart.fontFamily,h=a.fontSize;void 0===h&&(h=a.chart.fontSize);var q=a.color;void 0===q&&(q=a.chart.color);if(b){this.axisWidth=a.height;a=b.chartData;var w=a.length,r;for(r=0;r<w;r++){var g=180-360/w*r,p=n+this.axisWidth*Math.sin(g/180*Math.PI),s=e+this.axisWidth*Math.cos(g/
|
6
|
+
180*Math.PI);0<m&&(p=AmCharts.line(b.container,[n,p],[e,s],d,m,c),this.set.push(p));if(k){var u="start",p=n+(this.axisWidth+f)*Math.sin(g/180*Math.PI),s=e+(this.axisWidth+f)*Math.cos(g/180*Math.PI);if(180==g||0===g)u="middle",p-=5;0>g&&(u="end",p-=10);180==g&&(s-=5);0===g&&(s+=5);g=AmCharts.text(b.container,a[r].category,q,l,h,u);g.translate(p+5,s);this.set.push(g);g.getBBox()}}}}});AmCharts.RadItem=AmCharts.Class({construct:function(a,b,c,d,m,n,e){void 0===c&&(c="");var f=a.chart.fontFamily,k=a.fontSize;void 0===k&&(k=a.chart.fontSize);var l=a.color;void 0===l&&(l=a.chart.color);var h=a.chart.container;this.set=d=h.set();var q=a.axisColor,w=a.axisAlpha,r=a.tickLength,g=a.gridAlpha,p=a.gridThickness,s=a.gridColor,u=a.dashLength,A=a.fillColor,y=a.fillAlpha,B=a.labelsEnabled;m=a.counter;var C=a.inside,D=a.gridType,t;b-=a.height;var x;n=a.x;var E=a.y;e?(B=!0,isNaN(e.tickLength)||
|
7
|
+
(r=e.tickLength),void 0!=e.lineColor&&(s=e.lineColor),isNaN(e.lineAlpha)||(g=e.lineAlpha),isNaN(e.dashLength)||(u=e.dashLength),isNaN(e.lineThickness)||(p=e.lineThickness),!0===e.inside&&(C=!0)):c||(g/=3,r/=2);var F="end",z=-1;C&&(F="start",z=1);var v;B&&(v=AmCharts.text(h,c,l,f,k,F),v.translate(n+(r+3)*z,b),d.push(v),this.label=v,x=AmCharts.line(h,[n,n+r*z],[b,b],q,w,p),d.push(x));b=Math.round(a.y-b);f=[];k=[];if(0<g){if("polygons"==D){t=a.data.length;for(l=0;l<t;l++)q=180-360/t*l,f.push(b*Math.sin(q/
|
8
|
+
180*Math.PI)),k.push(b*Math.cos(q/180*Math.PI));f.push(f[0]);k.push(k[0]);g=AmCharts.line(h,f,k,s,g,p,u)}else g=AmCharts.circle(h,b,"#FFFFFF",0,p,s,g);g.translate(n,E);d.push(g)}if(1==m&&0<y&&!e&&""!==c){e=a.previousCoord;if("polygons"==D){for(l=t;0<=l;l--)q=180-360/t*l,f.push(e*Math.sin(q/180*Math.PI)),k.push(e*Math.cos(q/180*Math.PI));t=AmCharts.polygon(h,f,k,A,y)}else t=AmCharts.wedge(h,0,0,0,360,b,b,e,0,{fill:A,"fill-opacity":y,stroke:"#000","stroke-opacity":0,"stroke-width":1});d.push(t);t.translate(n,
|
9
|
+
E)}!1===a.visible&&(x&&x.hide(),v&&v.hide());""!==c&&(a.counter=0===m?1:0,a.previousCoord=b)},graphics:function(){return this.set},getLabel:function(){return this.label}});AmCharts.RadarFill=AmCharts.Class({construct:function(a,b,c,d){b-=a.axisWidth;c-=a.axisWidth;var m=Math.max(b,c);b=c=Math.min(b,c);c=a.chart.container;var n=d.fillAlpha,e=d.fillColor,m=Math.abs(m-a.y);b=Math.abs(b-a.y);var f=Math.max(m,b);b=Math.min(m,b);m=f;f=d.angle+90;d=d.toAngle+90;isNaN(f)&&(f=0);isNaN(d)&&(d=360);this.set=c.set();void 0===e&&(e="#000000");isNaN(n)&&(n=0);if("polygons"==a.gridType){d=[];var k=[],l=a.data.length,h;for(h=0;h<l;h++)f=180-360/l*h,d.push(m*Math.sin(f/180*Math.PI)),
|
10
|
+
k.push(m*Math.cos(f/180*Math.PI));d.push(d[0]);k.push(k[0]);for(h=l;0<=h;h--)f=180-360/l*h,d.push(b*Math.sin(f/180*Math.PI)),k.push(b*Math.cos(f/180*Math.PI));this.fill=AmCharts.polygon(c,d,k,e,n)}else this.fill=AmCharts.wedge(c,0,0,f,d-f,m,m,b,0,{fill:e,"fill-opacity":n,stroke:"#000","stroke-opacity":0,"stroke-width":1});this.set.push(this.fill);this.fill.translate(a.x,a.y)},graphics:function(){return this.set},getLabel:function(){}});
|
@@ -0,0 +1,49 @@
|
|
1
|
+
AmCharts.AmSerialChart=AmCharts.Class({inherits:AmCharts.AmRectangularChart,construct:function(){AmCharts.AmSerialChart.base.construct.call(this);this.createEvents("changed");this.columnSpacing=5;this.columnSpacing3D=0;this.columnWidth=0.8;this.updateScrollbar=!0;var a=new AmCharts.CategoryAxis;a.chart=this;this.categoryAxis=a;this.chartType="serial";this.zoomOutOnDataUpdate=!0;this.mouseWheelScrollEnabled=this.rotate=this.skipZoom=!1;this.minSelectedTime=0},initChart:function(){AmCharts.AmSerialChart.base.initChart.call(this);
|
2
|
+
this.updateCategoryAxis(this.categoryAxis,this.rotate,"categoryAxis");this.dataChanged&&(this.updateData(),this.dataChanged=!1,this.dispatchDataUpdated=!0);var a=this.chartCursor;a&&a.updateData();var a=this.countColumns(),b=this.graphs,c;for(c=0;c<b.length;c++)b[c].columnCount=a;this.updateScrollbar=!0;this.drawChart();this.autoMargins&&!this.marginsUpdated&&(this.marginsUpdated=!0,this.measureMargins());this.mouseWheelScrollEnabled&&this.addMouseWheel()},validateData:function(a){this.marginsUpdated=
|
3
|
+
!1;this.zoomOutOnDataUpdate&&!a&&(this.endTime=this.end=this.startTime=this.start=NaN);AmCharts.AmSerialChart.base.validateData.call(this)},drawChart:function(){AmCharts.AmSerialChart.base.drawChart.call(this);var a=this.chartData;if(AmCharts.ifArray(a)){var b=this.chartScrollbar;b&&b.draw();if(0<this.realWidth&&0<this.realHeight){var a=a.length-1,c,b=this.categoryAxis;if(b.parseDates&&!b.equalSpacing){if(b=this.startTime,c=this.endTime,isNaN(b)||isNaN(c))b=this.firstTime,c=this.lastTime}else if(b=
|
4
|
+
this.start,c=this.end,isNaN(b)||isNaN(c))b=0,c=a;this.endTime=this.startTime=this.end=this.start=void 0;this.zoom(b,c)}}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},cleanChart:function(){AmCharts.callMethod("destroy",[this.valueAxes,this.graphs,this.categoryAxis,this.chartScrollbar,this.chartCursor])},updateCategoryAxis:function(a,b,c){a.id=c;a.rotate=b;a.axisRenderer=AmCharts.RecAxis;a.guideFillRenderer=AmCharts.RecFill;a.axisItemRenderer=AmCharts.RecItem;a.setOrientation(!this.rotate);
|
5
|
+
a.x=this.marginLeftReal;a.y=this.marginTopReal;a.dx=this.dx;a.dy=this.dy;a.width=this.plotAreaWidth-1;a.height=this.plotAreaHeight-1;a.viW=this.plotAreaWidth-1;a.viH=this.plotAreaHeight-1;a.viX=this.marginLeftReal;a.viY=this.marginTopReal;a.marginsChanged=!0},updateValueAxes:function(){AmCharts.AmSerialChart.base.updateValueAxes.call(this);var a=this.valueAxes,b;for(b=0;b<a.length;b++){var c=a[b],d=this.rotate;c.rotate=d;c.setOrientation(d);d=this.categoryAxis;if(!d.startOnAxis||d.parseDates)c.expandMinMax=
|
6
|
+
!0}},updateData:function(){this.parseData();var a=this.graphs,b,c=this.chartData;for(b=0;b<a.length;b++)a[b].data=c;0<c.length&&(this.firstTime=this.getStartTime(c[0].time),this.lastTime=this.getEndTime(c[c.length-1].time))},getStartTime:function(a){var b=this.categoryAxis;return AmCharts.resetDateToMin(new Date(a),b.minPeriod,1,b.firstDayOfWeek).getTime()},getEndTime:function(a){var b=AmCharts.extractPeriod(this.categoryAxis.minPeriod);return AmCharts.changeDate(new Date(a),b.period,b.count,!0).getTime()-
|
7
|
+
1},updateMargins:function(){AmCharts.AmSerialChart.base.updateMargins.call(this);var a=this.chartScrollbar;a&&(this.getScrollbarPosition(a,this.rotate,this.categoryAxis.position),this.adjustMargins(a,this.rotate))},updateScrollbars:function(){this.updateChartScrollbar(this.chartScrollbar,this.rotate)},zoom:function(a,b){var c=this.categoryAxis;c.parseDates&&!c.equalSpacing?this.timeZoom(a,b):this.indexZoom(a,b)},timeZoom:function(a,b){var c=this.maxSelectedTime;isNaN(c)||(b!=this.endTime&&b-a>c&&
|
8
|
+
(a=b-c,this.updateScrollbar=!0),a!=this.startTime&&b-a>c&&(b=a+c,this.updateScrollbar=!0));var d=this.minSelectedTime;if(0<d&&b-a<d){var e=Math.round(a+(b-a)/2),d=Math.round(d/2);a=e-d;b=e+d}var g=this.chartData,e=this.categoryAxis;if(AmCharts.ifArray(g)&&(a!=this.startTime||b!=this.endTime)){var k=e.minDuration(),d=this.firstTime,m=this.lastTime;a||(a=d,isNaN(c)||(a=m-c));b||(b=m);a>m&&(a=m);b<d&&(b=d);a<d&&(a=d);b>m&&(b=m);b<a&&(b=a+k);b-a<k/5&&(b<m?b=a+k/5:a=b-k/5);this.startTime=a;this.endTime=
|
9
|
+
b;c=g.length-1;k=this.getClosestIndex(g,"time",a,!0,0,c);g=this.getClosestIndex(g,"time",b,!1,k,c);e.timeZoom(a,b);e.zoom(k,g);this.start=AmCharts.fitToBounds(k,0,c);this.end=AmCharts.fitToBounds(g,0,c);this.zoomAxesAndGraphs();this.zoomScrollbar();a!=d||b!=m?this.showZB(!0):this.showZB(!1);this.updateColumnsDepth();this.dispatchTimeZoomEvent()}},indexZoom:function(a,b){var c=this.maxSelectedSeries;isNaN(c)||(b!=this.end&&b-a>c&&(a=b-c,this.updateScrollbar=!0),a!=this.start&&b-a>c&&(b=a+c,this.updateScrollbar=
|
10
|
+
!0));if(a!=this.start||b!=this.end){var d=this.chartData.length-1;isNaN(a)&&(a=0,isNaN(c)||(a=d-c));isNaN(b)&&(b=d);b<a&&(b=a);b>d&&(b=d);a>d&&(a=d-1);0>a&&(a=0);this.start=a;this.end=b;this.categoryAxis.zoom(a,b);this.zoomAxesAndGraphs();this.zoomScrollbar();0!==a||b!=this.chartData.length-1?this.showZB(!0):this.showZB(!1);this.updateColumnsDepth();this.dispatchIndexZoomEvent()}},updateGraphs:function(){AmCharts.AmSerialChart.base.updateGraphs.call(this);var a=this.graphs,b;for(b=0;b<a.length;b++){var c=
|
11
|
+
a[b];c.columnWidthReal=this.columnWidth;c.categoryAxis=this.categoryAxis}},updateColumnsDepth:function(){var a,b=this.graphs,c;AmCharts.remove(this.columnsSet);this.columnsArray=[];for(a=0;a<b.length;a++){c=b[a];var d=c.columnsArray;if(d){var e;for(e=0;e<d.length;e++)this.columnsArray.push(d[e])}}this.columnsArray.sort(this.compareDepth);if(0<this.columnsArray.length){b=this.container.set();this.columnSet.push(b);for(a=0;a<this.columnsArray.length;a++)b.push(this.columnsArray[a].column.set);c&&b.translate(c.x,
|
12
|
+
c.y);this.columnsSet=b}},compareDepth:function(a,b){return a.depth>b.depth?1:-1},zoomScrollbar:function(){var a=this.chartScrollbar,b=this.categoryAxis;a&&this.updateScrollbar&&(b.parseDates&&!b.equalSpacing?a.timeZoom(this.startTime,this.endTime):a.zoom(this.start,this.end),this.updateScrollbar=!0)},updateTrendLines:function(){var a=this.trendLines,b;for(b=0;b<a.length;b++){var c=a[b];c.chart=this;c.valueAxis||(c.valueAxis=this.valueAxes[0]);c.categoryAxis=this.categoryAxis}},zoomAxesAndGraphs:function(){if(!this.scrollbarOnly){var a=
|
13
|
+
this.valueAxes,b;for(b=0;b<a.length;b++)a[b].zoom(this.start,this.end);a=this.graphs;for(b=0;b<a.length;b++)a[b].zoom(this.start,this.end);this.zoomTrendLines();(b=this.chartCursor)&&b.zoom(this.start,this.end,this.startTime,this.endTime)}},countColumns:function(){var a=0,b=this.valueAxes.length,c=this.graphs.length,d,e,g=!1,k,m;for(m=0;m<b;m++){e=this.valueAxes[m];var l=e.stackType;if("100%"==l||"regular"==l)for(g=!1,k=0;k<c;k++)d=this.graphs[k],d.hidden||d.valueAxis!=e||"column"!=d.type||(!g&&d.stackable&&
|
14
|
+
(a++,g=!0),!d.stackable&&d.clustered&&a++,d.columnIndex=a-1,d.clustered||(d.columnIndex=0));if("none"==l||"3d"==l)for(k=0;k<c;k++)d=this.graphs[k],!d.hidden&&d.valueAxis==e&&"column"==d.type&&d.clustered&&(d.columnIndex=a,a++);if("3d"==l){for(m=0;m<c;m++)d=this.graphs[m],d.depthCount=a;a=1}}return a},parseData:function(){AmCharts.AmSerialChart.base.parseData.call(this);this.parseSerialData()},getCategoryIndexByValue:function(a){var b=this.chartData,c,d;for(d=0;d<b.length;d++)b[d].category==a&&(c=
|
15
|
+
d);return c},handleCursorChange:function(a){this.updateLegendValues(a.index)},handleCursorZoom:function(a){this.updateScrollbar=!0;this.zoom(a.start,a.end)},handleScrollbarZoom:function(a){this.updateScrollbar=!1;this.zoom(a.start,a.end)},dispatchTimeZoomEvent:function(){if(this.prevStartTime!=this.startTime||this.prevEndTime!=this.endTime){var a={type:"zoomed"};a.startDate=new Date(this.startTime);a.endDate=new Date(this.endTime);a.startIndex=this.start;a.endIndex=this.end;this.startIndex=this.start;
|
16
|
+
this.endIndex=this.end;this.startDate=a.startDate;this.endDate=a.endDate;this.prevStartTime=this.startTime;this.prevEndTime=this.endTime;var b=this.categoryAxis,c=AmCharts.extractPeriod(b.minPeriod).period,b=b.dateFormatsObject[c];a.startValue=AmCharts.formatDate(a.startDate,b);a.endValue=AmCharts.formatDate(a.endDate,b);a.chart=this;a.target=this;this.fire(a.type,a)}},dispatchIndexZoomEvent:function(){if(this.prevStartIndex!=this.start||this.prevEndIndex!=this.end){this.startIndex=this.start;this.endIndex=
|
17
|
+
this.end;var a=this.chartData;if(AmCharts.ifArray(a)&&!isNaN(this.start)&&!isNaN(this.end)){var b={chart:this,target:this,type:"zoomed"};b.startIndex=this.start;b.endIndex=this.end;b.startValue=a[this.start].category;b.endValue=a[this.end].category;this.categoryAxis.parseDates&&(this.startTime=a[this.start].time,this.endTime=a[this.end].time,b.startDate=new Date(this.startTime),b.endDate=new Date(this.endTime));this.prevStartIndex=this.start;this.prevEndIndex=this.end;this.fire(b.type,b)}}},updateLegendValues:function(a){var b=
|
18
|
+
this.graphs,c;for(c=0;c<b.length;c++){var d=b[c];isNaN(a)?d.currentDataItem=void 0:d.currentDataItem=this.chartData[a].axes[d.valueAxis.id].graphs[d.id]}this.legend&&this.legend.updateValues()},getClosestIndex:function(a,b,c,d,e,g){0>e&&(e=0);g>a.length-1&&(g=a.length-1);var k=e+Math.round((g-e)/2),m=a[k][b];if(1>=g-e){if(d)return e;d=a[g][b];return Math.abs(a[e][b]-c)<Math.abs(d-c)?e:g}return c==m?k:c<m?this.getClosestIndex(a,b,c,d,e,k):this.getClosestIndex(a,b,c,d,k,g)},zoomToIndexes:function(a,
|
19
|
+
b){this.updateScrollbar=!0;var c=this.chartData;if(c){var d=c.length;0<d&&(0>a&&(a=0),b>d-1&&(b=d-1),d=this.categoryAxis,d.parseDates&&!d.equalSpacing?this.zoom(c[a].time,this.getEndTime(c[b].time)):this.zoom(a,b))}},zoomToDates:function(a,b){this.updateScrollbar=!0;var c=this.chartData;if(this.categoryAxis.equalSpacing){var d=this.getClosestIndex(c,"time",a.getTime(),!0,0,c.length),c=this.getClosestIndex(c,"time",b.getTime(),!1,0,c.length);this.zoom(d,c)}else this.zoom(a.getTime(),b.getTime())},
|
20
|
+
zoomToCategoryValues:function(a,b){this.updateScrollbar=!0;this.zoom(this.getCategoryIndexByValue(a),this.getCategoryIndexByValue(b))},formatPeriodString:function(a,b){if(b){var c=["value","open","low","high","close"],d="value open low high close average sum count".split(" "),e=b.valueAxis,g=this.chartData,k=b.numberFormatter;k||(k=this.numberFormatter);for(var m=0;m<c.length;m++){for(var l=c[m],h=0,f=0,n,u,p,s,y,w=0,r=0,q,t,v,z,B,A=this.start;A<=this.end;A++){var x=g[A];if(x&&(x=x.axes[e.id].graphs[b.id])){if(x.values){var C=
|
21
|
+
x.values[l];if(!isNaN(C)){isNaN(n)&&(n=C);u=C;if(isNaN(p)||p>C)p=C;if(isNaN(s)||s<C)s=C;h+=C;f++;y=h/f}}if(x.percents&&(x=x.percents[l],!isNaN(x))){isNaN(q)&&(q=x);t=x;if(isNaN(v)||v>x)v=x;if(isNaN(z)||z<x)z=x;w+=x;r++;B=w/r}}}w={open:q,close:t,high:z,low:v,average:B,sum:w,count:r};a=AmCharts.formatValue(a,{open:n,close:u,high:s,low:p,average:y,sum:h,count:f},d,k,l+"\\.",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers);a=AmCharts.formatValue(a,w,d,this.percentFormatter,"percents\\."+
|
22
|
+
l+"\\.")}}return a},formatString:function(a,b){var c=b.graph;if(-1!=a.indexOf("[[category]]")){var d=b.serialDataItem.category;if(this.categoryAxis.parseDates){var e=this.balloonDateFormat,g=this.chartCursor;g&&(e=g.categoryBalloonDateFormat);-1!=a.indexOf("[[category]]")&&(e=AmCharts.formatDate(d,e),-1!=e.indexOf("fff")&&(e=AmCharts.formatMilliseconds(e,d)),d=e)}a=a.replace(/\[\[category\]\]/g,String(d))}c=c.numberFormatter;c||(c=this.numberFormatter);d=b.graph.valueAxis;(e=d.duration)&&!isNaN(b.values.value)&&
|
23
|
+
(d=AmCharts.formatDuration(b.values.value,e,"",d.durationUnits,d.maxInterval,c),a=a.replace(RegExp("\\[\\[value\\]\\]","g"),d));d="value open low high close total".split(" ");e=this.percentFormatter;a=AmCharts.formatValue(a,b.percents,d,e,"percents\\.");a=AmCharts.formatValue(a,b.values,d,c,"",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers);a=AmCharts.formatValue(a,b.values,["percents"],e);-1!=a.indexOf("[[")&&(a=AmCharts.formatDataContextValue(a,b.dataContext));return a=AmCharts.AmSerialChart.base.formatString.call(this,
|
24
|
+
a,b)},addChartScrollbar:function(a){AmCharts.callMethod("destroy",[this.chartScrollbar]);a&&(a.chart=this,this.listenTo(a,"zoomed",this.handleScrollbarZoom));this.rotate?void 0===a.width&&(a.width=a.scrollbarHeight):void 0===a.height&&(a.height=a.scrollbarHeight);this.chartScrollbar=a},removeChartScrollbar:function(){AmCharts.callMethod("destroy",[this.chartScrollbar]);this.chartScrollbar=null},handleReleaseOutside:function(a){AmCharts.AmSerialChart.base.handleReleaseOutside.call(this,a);AmCharts.callMethod("handleReleaseOutside",
|
25
|
+
[this.chartScrollbar])}});AmCharts.Cuboid=AmCharts.Class({construct:function(a,b,c,d,e,g,k,m,l,h,f,n,u,p,s){this.set=a.set();this.container=a;this.h=Math.round(c);this.w=Math.round(b);this.dx=d;this.dy=e;this.colors=g;this.alpha=k;this.bwidth=m;this.bcolor=l;this.balpha=h;this.colors=g;this.dashLength=p;this.pattern=s;u?0>b&&0===f&&(f=180):0>c&&270==f&&(f=90);this.gradientRotation=f;0===d&&0===e&&(this.cornerRadius=n);this.draw()},draw:function(){var a=this.set;a.clear();var b=this.container,c=this.w,d=this.h,e=this.dx,g=
|
26
|
+
this.dy,k=this.colors,m=this.alpha,l=this.bwidth,h=this.bcolor,f=this.balpha,n=this.gradientRotation,u=this.cornerRadius,p=this.dashLength,s=this.pattern,y=k,w=k;"object"==typeof k&&(y=k[0],w=k[k.length-1]);var r,q,t,v,z,B,A,x,C;if(0<e||0<g)A=w,w=AmCharts.adjustLuminosity(y,-0.2),w=AmCharts.adjustLuminosity(y,-0.2),r=AmCharts.polygon(b,[0,e,c+e,c,0],[0,g,g,0,0],w,m,1,h,0,n),0<f&&(C=AmCharts.line(b,[0,e,c+e],[0,g,g],h,f,l,p)),q=AmCharts.polygon(b,[0,0,c,c,0],[0,d,d,0,0],w,m,1,h,0,n),q.translate(e,
|
27
|
+
g),0<f&&(t=AmCharts.line(b,[e,e],[g,g+d],h,1,l,p)),v=AmCharts.polygon(b,[0,0,e,e,0],[0,d,d+g,g,0],w,m,1,h,0,n),z=AmCharts.polygon(b,[c,c,c+e,c+e,c],[0,d,d+g,g,0],w,m,1,h,0,n),0<f&&(B=AmCharts.line(b,[c,c+e,c+e,c],[0,g,d+g,d],h,f,l,p)),w=AmCharts.adjustLuminosity(A,0.2),A=AmCharts.polygon(b,[0,e,c+e,c,0],[d,d+g,d+g,d,d],w,m,1,h,0,n),0<f&&(x=AmCharts.line(b,[0,e,c+e],[d,d+g,d+g],h,f,l,p));1>Math.abs(d)&&(d=0);1>Math.abs(c)&&(c=0);b=0===d?AmCharts.line(b,[0,c],[0,0],h,f,l,p):0===c?AmCharts.line(b,[0,
|
28
|
+
0],[0,d],h,f,l,p):0<u?AmCharts.rect(b,c,d,k,m,l,h,f,u,n,p):AmCharts.polygon(b,[0,0,c,c,0],[0,d,d,0,0],k,m,l,h,f,n,!1,p);d=0>d?[r,C,q,t,v,z,B,A,x,b]:[A,x,q,t,v,z,r,C,B,b];for(r=0;r<d.length;r++)(q=d[r])&&a.push(q);s&&b.pattern(s)},width:function(a){this.w=a;this.draw()},height:function(a){this.h=a;this.draw()},animateHeight:function(a,b){var c=this;c.easing=b;c.totalFrames=1E3*a/AmCharts.updateRate;c.rh=c.h;c.frame=0;c.height(1);setTimeout(function(){c.updateHeight.call(c)},AmCharts.updateRate)},updateHeight:function(){var a=
|
29
|
+
this;a.frame++;var b=a.totalFrames;a.frame<=b&&(b=a.easing(0,a.frame,1,a.rh-1,b),a.height(b),setTimeout(function(){a.updateHeight.call(a)},AmCharts.updateRate))},animateWidth:function(a,b){var c=this;c.easing=b;c.totalFrames=1E3*a/AmCharts.updateRate;c.rw=c.w;c.frame=0;c.width(1);setTimeout(function(){c.updateWidth.call(c)},AmCharts.updateRate)},updateWidth:function(){var a=this;a.frame++;var b=a.totalFrames;a.frame<=b&&(b=a.easing(0,a.frame,1,a.rw-1,b),a.width(b),setTimeout(function(){a.updateWidth.call(a)},
|
30
|
+
AmCharts.updateRate))}});AmCharts.CategoryAxis=AmCharts.Class({inherits:AmCharts.AxisBase,construct:function(){AmCharts.CategoryAxis.base.construct.call(this);this.minPeriod="DD";this.equalSpacing=this.parseDates=!1;this.position="bottom";this.startOnAxis=!1;this.firstDayOfWeek=1;this.gridPosition="middle";this.markPeriodChange=this.boldPeriodBeginning=!0;this.safeDistance=30;this.centerLabelOnFullPeriod=!0;this.periods=[{period:"ss",count:1},{period:"ss",count:5},{period:"ss",count:10},{period:"ss",count:30},{period:"mm",
|
31
|
+
count:1},{period:"mm",count:5},{period:"mm",count:10},{period:"mm",count:30},{period:"hh",count:1},{period:"hh",count:3},{period:"hh",count:6},{period:"hh",count:12},{period:"DD",count:1},{period:"DD",count:2},{period:"DD",count:3},{period:"DD",count:4},{period:"DD",count:5},{period:"WW",count:1},{period:"MM",count:1},{period:"MM",count:2},{period:"MM",count:3},{period:"MM",count:6},{period:"YYYY",count:1},{period:"YYYY",count:2},{period:"YYYY",count:5},{period:"YYYY",count:10},{period:"YYYY",count:50},
|
32
|
+
{period:"YYYY",count:100}];this.dateFormats=[{period:"fff",format:"JJ:NN:SS"},{period:"ss",format:"JJ:NN:SS"},{period:"mm",format:"JJ:NN"},{period:"hh",format:"JJ:NN"},{period:"DD",format:"MMM DD"},{period:"WW",format:"MMM DD"},{period:"MM",format:"MMM"},{period:"YYYY",format:"YYYY"}];this.nextPeriod={};this.nextPeriod.fff="ss";this.nextPeriod.ss="mm";this.nextPeriod.mm="hh";this.nextPeriod.hh="DD";this.nextPeriod.DD="MM";this.nextPeriod.MM="YYYY"},draw:function(){AmCharts.CategoryAxis.base.draw.call(this);
|
33
|
+
this.generateDFObject();var a=this.chart.chartData;this.data=a;if(AmCharts.ifArray(a)){var b,c=this.chart,d=this.start,e=this.labelFrequency,g=0;b=this.end-d+1;var k=this.gridCount,m=this.showFirstLabel,l=this.showLastLabel,h,f="",n=AmCharts.extractPeriod(this.minPeriod);h=AmCharts.getPeriodDuration(n.period,n.count);var u,p,s,y,w;u=this.rotate;var r=this.firstDayOfWeek,q=this.boldPeriodBeginning,a=AmCharts.resetDateToMin(new Date(a[a.length-1].time+1.05*h),this.minPeriod,1,r).getTime(),t;this.endTime>
|
34
|
+
a&&(this.endTime=a);t=this.minorGridEnabled;var v,a=this.gridAlpha,z;if(this.parseDates&&!this.equalSpacing){this.timeDifference=this.endTime-this.startTime;d=this.choosePeriod(0);e=d.period;u=d.count;p=AmCharts.getPeriodDuration(e,u);p<h&&(e=n.period,u=n.count,p=h);s=e;"WW"==s&&(s="DD");this.stepWidth=this.getStepWidth(this.timeDifference);var k=Math.ceil(this.timeDifference/p)+5,B=f=AmCharts.resetDateToMin(new Date(this.startTime-p),e,u,r).getTime();s==e&&1==u&&this.centerLabelOnFullPeriod&&(y=
|
35
|
+
p*this.stepWidth);this.cellWidth=h*this.stepWidth;b=Math.round(f/p);d=-1;b/2==Math.round(b/2)&&(d=-2,f-=p);var A=c.firstTime,x=0;t&&1<u&&(v=this.chooseMinorFrequency(u),z=AmCharts.getPeriodDuration(e,v));if(0<this.gridCount)for(b=d;b<=k;b++){n=A+p*(b+Math.floor((B-A)/p))-x;n=AmCharts.resetDateToMin(new Date(n),e,u,r).getTime();"MM"==e&&(t=(n-f)/p,1.5<=(n-f)/p&&(n-=(t-1)*p,x+=p));h=(n-this.startTime)*this.stepWidth;w=!1;this.nextPeriod[s]&&(w=this.checkPeriodChange(this.nextPeriod[s],1,n,f));t=!1;
|
36
|
+
w&&this.markPeriodChange?(f=this.dateFormatsObject[this.nextPeriod[s]],t=!0):f=this.dateFormatsObject[s];q||(t=!1);f=AmCharts.formatDate(new Date(n),f);if(b==d&&!m||b==k&&!l)f=" ";this.labelFunction&&(f=this.labelFunction(f,new Date(n),this));f=new this.axisItemRenderer(this,h,f,!1,y,0,!1,t);this.pushAxisItem(f);f=n;if(!isNaN(v))for(h=1;h<u;h+=v)this.gridAlpha=this.minorGridAlpha,t=n+z*h,t=AmCharts.resetDateToMin(new Date(t),e,v,r).getTime(),t=new this.axisItemRenderer(this,(t-this.startTime)*this.stepWidth),
|
37
|
+
this.pushAxisItem(t);this.gridAlpha=a}}else if(!this.parseDates){if(this.cellWidth=this.getStepWidth(b),b<k&&(k=b),g+=this.start,this.stepWidth=this.getStepWidth(b),0<k)for(q=Math.floor(b/k),v=this.chooseMinorFrequency(q),h=g,h/2==Math.round(h/2)&&h--,0>h&&(h=0),k=0,b=h;b<=this.end+2;b++){r=!1;0<=b&&b<this.data.length?(s=this.data[b],f=s.category,r=s.forceShow):f="";if(t&&!isNaN(v))if(b/v==Math.round(b/v)||r)b/q==Math.round(b/q)||r||(this.gridAlpha=this.minorGridAlpha,f=void 0);else continue;else if(b/
|
38
|
+
q!=Math.round(b/q)&&!r)continue;h=this.getCoordinate(b-g);r=0;"start"==this.gridPosition&&(h-=this.cellWidth/2,r=this.cellWidth/2);if(b==d&&!m||b==this.end&&!l)f=void 0;Math.round(k/e)!=k/e&&(f=void 0);k++;B=this.cellWidth;u&&(B=NaN);this.labelFunction&&s&&(f=this.labelFunction(f,s,this));f=AmCharts.fixNewLines(f);f=new this.axisItemRenderer(this,h,f,!0,B,r,void 0,!1,r);this.pushAxisItem(f);this.gridAlpha=a}}else if(this.parseDates&&this.equalSpacing){g=this.start;this.startTime=this.data[this.start].time;
|
39
|
+
this.endTime=this.data[this.end].time;this.timeDifference=this.endTime-this.startTime;d=this.choosePeriod(0);e=d.period;u=d.count;p=AmCharts.getPeriodDuration(e,u);p<h&&(e=n.period,u=n.count,p=h);s=e;"WW"==s&&(s="DD");this.stepWidth=this.getStepWidth(b);k=Math.ceil(this.timeDifference/p)+1;f=AmCharts.resetDateToMin(new Date(this.startTime-p),e,u,r).getTime();this.cellWidth=this.getStepWidth(b);b=Math.round(f/p);d=-1;b/2==Math.round(b/2)&&(d=-2,f-=p);h=this.start;h/2==Math.round(h/2)&&h--;0>h&&(h=
|
40
|
+
0);y=this.end+2;y>=this.data.length&&(y=this.data.length);z=!1;z=!m;this.previousPos=-1E3;20<this.labelRotation&&(this.safeDistance=5);p=h;if(this.data[h].time!=AmCharts.resetDateToMin(new Date(this.data[h].time),e,u,r).getTime())for(r=0,A=f,b=h;b<y;b++)n=this.data[b].time,this.checkPeriodChange(e,u,n,A)&&(r++,2<=r&&(p=b,b=y),A=n);t&&1<u&&(v=this.chooseMinorFrequency(u),AmCharts.getPeriodDuration(e,v));for(b=h;b<y;b++)if(n=this.data[b].time,this.checkPeriodChange(e,u,n,f)&&b>=p){h=this.getCoordinate(b-
|
41
|
+
this.start);w=!1;this.nextPeriod[s]&&(w=this.checkPeriodChange(this.nextPeriod[s],1,n,f));t=!1;w&&this.markPeriodChange?(f=this.dateFormatsObject[this.nextPeriod[s]],t=!0):f=this.dateFormatsObject[s];f=AmCharts.formatDate(new Date(n),f);if(b==d&&!m||b==k&&!l)f=" ";z?z=!1:(q||(t=!1),h-this.previousPos>this.safeDistance*Math.cos(this.labelRotation*Math.PI/180)&&(this.labelFunction&&(f=this.labelFunction(f,new Date(n),this)),f=new this.axisItemRenderer(this,h,f,void 0,void 0,void 0,void 0,t),r=f.graphics(),
|
42
|
+
this.pushAxisItem(f),r=r.getBBox().width,AmCharts.isModern||(r-=h),this.previousPos=h+r));f=n}else isNaN(v)||(this.checkPeriodChange(e,v,n,B)&&(this.gridAlpha=this.minorGridAlpha,h=this.getCoordinate(b-this.start),t=new this.axisItemRenderer(this,h),this.pushAxisItem(t),B=n),this.gridAlpha=a)}for(b=0;b<this.data.length;b++)if(m=this.data[b])l=this.parseDates&&!this.equalSpacing?Math.round((m.time-this.startTime)*this.stepWidth+this.cellWidth/2):this.getCoordinate(b-g),m.x[this.id]=l;m=this.guides.length;
|
43
|
+
for(b=0;b<m;b++)l=this.guides[b],q=q=q=a=d=NaN,v=l.above,l.toCategory&&(q=c.getCategoryIndexByValue(l.toCategory),isNaN(q)||(d=this.getCoordinate(q-g),f=new this.axisItemRenderer(this,d,"",!0,NaN,NaN,l),this.pushAxisItem(f,v))),l.category&&(q=c.getCategoryIndexByValue(l.category),isNaN(q)||(a=this.getCoordinate(q-g),q=(d-a)/2,f=new this.axisItemRenderer(this,a,l.label,!0,NaN,q,l),this.pushAxisItem(f,v))),l.toDate&&(this.equalSpacing?(q=c.getClosestIndex(this.data,"time",l.toDate.getTime(),!1,0,this.data.length-
|
44
|
+
1),isNaN(q)||(d=this.getCoordinate(q-g))):d=(l.toDate.getTime()-this.startTime)*this.stepWidth,f=new this.axisItemRenderer(this,d,"",!0,NaN,NaN,l),this.pushAxisItem(f,v)),l.date&&(this.equalSpacing?(q=c.getClosestIndex(this.data,"time",l.date.getTime(),!1,0,this.data.length-1),isNaN(q)||(a=this.getCoordinate(q-g))):a=(l.date.getTime()-this.startTime)*this.stepWidth,q=(d-a)/2,f="H"==this.orientation?new this.axisItemRenderer(this,a,l.label,!1,2*q,NaN,l):new this.axisItemRenderer(this,a,l.label,!1,
|
45
|
+
NaN,q,l),this.pushAxisItem(f,v)),d=new this.guideFillRenderer(this,a,d,l),a=d.graphics(),this.pushAxisItem(d,v),l.graphics=a,a.index=b,l.balloonText&&this.addEventListeners(a,l)}this.axisCreated=!0;c=this.x;g=this.y;this.set.translate(c,g);this.labelsSet.translate(c,g);this.positionTitle();(c=this.axisLine.set)&&c.toFront()},chooseMinorFrequency:function(a){for(var b=10;0<b;b--)if(a/b==Math.round(a/b))return a/b},choosePeriod:function(a){var b=AmCharts.getPeriodDuration(this.periods[a].period,this.periods[a].count),
|
46
|
+
c=Math.ceil(this.timeDifference/b),d=this.periods;return this.timeDifference<b&&0<a?d[a-1]:c<=this.gridCount?d[a]:a+1<d.length?this.choosePeriod(a+1):d[a]},getStepWidth:function(a){var b;this.startOnAxis?(b=this.axisWidth/(a-1),1==a&&(b=this.axisWidth)):b=this.axisWidth/a;return b},getCoordinate:function(a){a*=this.stepWidth;this.startOnAxis||(a+=this.stepWidth/2);return Math.round(a)},timeZoom:function(a,b){this.startTime=a;this.endTime=b},minDuration:function(){var a=AmCharts.extractPeriod(this.minPeriod);
|
47
|
+
return AmCharts.getPeriodDuration(a.period,a.count)},checkPeriodChange:function(a,b,c,d){c=new Date(c);var e=new Date(d),g=this.firstDayOfWeek;d=b;"DD"==a&&(b=1);c=AmCharts.resetDateToMin(c,a,b,g).getTime();b=AmCharts.resetDateToMin(e,a,b,g).getTime();return"DD"==a&&c-b<=AmCharts.getPeriodDuration(a,d)?!1:c!=b?!0:!1},generateDFObject:function(){this.dateFormatsObject={};var a;for(a=0;a<this.dateFormats.length;a++){var b=this.dateFormats[a];this.dateFormatsObject[b.period]=b.format}},xToIndex:function(a){var b=
|
48
|
+
this.data,c=this.chart,d=c.rotate,e=this.stepWidth;this.parseDates&&!this.equalSpacing?(a=this.startTime+Math.round(a/e)-this.minDuration()/2,c=c.getClosestIndex(b,"time",a,!1,this.start,this.end+1)):(this.startOnAxis||(a-=e/2),c=this.start+Math.round(a/e));var c=AmCharts.fitToBounds(c,0,b.length-1),g;b[c]&&(g=b[c].x[this.id]);d?g>this.height+1&&c--:g>this.width+1&&c--;0>g&&c++;return c=AmCharts.fitToBounds(c,0,b.length-1)},dateToCoordinate:function(a){return this.parseDates&&!this.equalSpacing?(a.getTime()-
|
49
|
+
this.startTime)*this.stepWidth:this.parseDates&&this.equalSpacing?(a=this.chart.getClosestIndex(this.data,"time",a.getTime(),!1,0,this.data.length-1),this.getCoordinate(a-this.start)):NaN},categoryToCoordinate:function(a){return this.chart?(a=this.chart.getCategoryIndexByValue(a),this.getCoordinate(a-this.start)):NaN},coordinateToDate:function(a){return this.equalSpacing?(a=this.xToIndex(a),new Date(this.data[a].time)):new Date(this.startTime+a/this.stepWidth)}});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
AmCharts.AmXYChart=AmCharts.Class({inherits:AmCharts.AmRectangularChart,construct:function(){AmCharts.AmXYChart.base.construct.call(this);this.createEvents("zoomed");this.maxZoomFactor=20;this.chartType="xy"},initChart:function(){AmCharts.AmXYChart.base.initChart.call(this);this.dataChanged&&(this.updateData(),this.dataChanged=!1,this.dispatchDataUpdated=!0);this.updateScrollbar=!0;this.drawChart();this.autoMargins&&!this.marginsUpdated&&(this.marginsUpdated=!0,this.measureMargins());var a=this.marginLeftReal,
|
2
|
+
c=this.marginTopReal,b=this.plotAreaWidth,d=this.plotAreaHeight;this.graphsSet.clipRect(a,c,b,d);this.bulletSet.clipRect(a,c,b,d);this.trendLinesSet.clipRect(a,c,b,d)},createValueAxes:function(){var a=[],c=[];this.xAxes=a;this.yAxes=c;var b=this.valueAxes,d,e;for(e=0;e<b.length;e++){d=b[e];var f=d.position;if("top"==f||"bottom"==f)d.rotate=!0;d.setOrientation(d.rotate);f=d.orientation;"V"==f&&c.push(d);"H"==f&&a.push(d)}0===c.length&&(d=new AmCharts.ValueAxis,d.rotate=!1,d.setOrientation(!1),b.push(d),
|
3
|
+
c.push(d));0===a.length&&(d=new AmCharts.ValueAxis,d.rotate=!0,d.setOrientation(!0),b.push(d),a.push(d));for(e=0;e<b.length;e++)this.processValueAxis(b[e],e);a=this.graphs;for(e=0;e<a.length;e++)this.processGraph(a[e],e)},drawChart:function(){AmCharts.AmXYChart.base.drawChart.call(this);AmCharts.ifArray(this.chartData)?(this.chartScrollbar&&this.updateScrollbars(),this.zoomChart()):this.cleanChart();if(this.hideXScrollbar){var a=this.scrollbarH;a&&(this.removeListener(a,"zoomed",this.handleHSBZoom),
|
4
|
+
a.destroy());this.scrollbarH=null}if(this.hideYScrollbar){if(a=this.scrollbarV)this.removeListener(a,"zoomed",this.handleVSBZoom),a.destroy();this.scrollbarV=null}if(!this.autoMargins||this.marginsUpdated)this.dispDUpd(),this.chartCreated=!0,this.zoomScrollbars()},cleanChart:function(){AmCharts.callMethod("destroy",[this.valueAxes,this.graphs,this.scrollbarV,this.scrollbarH,this.chartCursor])},zoomChart:function(){this.toggleZoomOutButton();this.zoomObjects(this.valueAxes);this.zoomObjects(this.graphs);
|
5
|
+
this.zoomTrendLines();this.dispatchAxisZoom()},toggleZoomOutButton:function(){1==this.heightMultiplier&&1==this.widthMultiplier?this.showZB(!1):this.showZB(!0)},dispatchAxisZoom:function(){var a=this.valueAxes,c;for(c=0;c<a.length;c++){var b=a[c];if(!isNaN(b.min)&&!isNaN(b.max)){var d,e;"V"==b.orientation?(d=b.coordinateToValue(-this.verticalPosition),e=b.coordinateToValue(-this.verticalPosition+this.plotAreaHeight)):(d=b.coordinateToValue(-this.horizontalPosition),e=b.coordinateToValue(-this.horizontalPosition+
|
6
|
+
this.plotAreaWidth));if(!isNaN(d)&&!isNaN(e)){if(d>e){var f=e;e=d;d=f}b.dispatchZoomEvent(d,e)}}}},zoomObjects:function(a){var c=a.length,b;for(b=0;b<c;b++){var d=a[b];this.updateObjectSize(d);d.zoom(0,this.chartData.length-1)}},updateData:function(){this.parseData();var a=this.chartData,c=a.length-1,b=this.graphs,d=this.dataProvider,e=0,f,g;for(f=0;f<b.length;f++)if(g=b[f],g.data=a,g.zoom(0,c),g=g.valueField){var k;for(k=0;k<d.length;k++){var m=d[k][g];m>e&&(e=m)}}for(f=0;f<b.length;f++)g=b[f],g.maxValue=
|
7
|
+
e;if(a=this.chartCursor)a.updateData(),a.type="crosshair",a.valueBalloonsEnabled=!1},zoomOut:function(){this.verticalPosition=this.horizontalPosition=0;this.heightMultiplier=this.widthMultiplier=1;this.zoomChart();this.zoomScrollbars()},processValueAxis:function(a){a.chart=this;a.minMaxField="H"==a.orientation?"x":"y";a.minTemp=NaN;a.maxTemp=NaN;this.listenTo(a,"axisSelfZoomed",this.handleAxisSelfZoom)},processGraph:function(a){a.xAxis||(a.xAxis=this.xAxes[0]);a.yAxis||(a.yAxis=this.yAxes[0])},parseData:function(){AmCharts.AmXYChart.base.parseData.call(this);
|
8
|
+
this.chartData=[];var a=this.dataProvider,c=this.valueAxes,b=this.graphs,d;for(d=0;d<a.length;d++){var e={axes:{},x:{},y:{}},f=a[d],g;for(g=0;g<c.length;g++){var k=c[g].id;e.axes[k]={};e.axes[k].graphs={};var m;for(m=0;m<b.length;m++){var l=b[m],q=l.id;if(l.xAxis.id==k||l.yAxis.id==k){var n={};n.serialDataItem=e;n.index=d;var p={},h=Number(f[l.valueField]);isNaN(h)||(p.value=h);h=Number(f[l.xField]);isNaN(h)||(p.x=h);h=Number(f[l.yField]);isNaN(h)||(p.y=h);h=Number(f[l.errorField]);isNaN(h)||(p.error=
|
9
|
+
h);n.values=p;this.processFields(l,n,f);n.serialDataItem=e;n.graph=l;e.axes[k].graphs[q]=n}}}this.chartData[d]=e}},formatString:function(a,c){var b=c.graph.numberFormatter;b||(b=this.numberFormatter);a=AmCharts.formatValue(a,c.values,["value","x","y"],b);-1!=a.indexOf("[[")&&(a=AmCharts.formatDataContextValue(a,c.dataContext));return a=AmCharts.AmXYChart.base.formatString.call(this,a,c)},addChartScrollbar:function(a){AmCharts.callMethod("destroy",[this.chartScrollbar,this.scrollbarH,this.scrollbarV]);
|
10
|
+
if(a){this.chartScrollbar=a;this.scrollbarHeight=a.scrollbarHeight;var c="backgroundColor backgroundAlpha selectedBackgroundColor selectedBackgroundAlpha scrollDuration resizeEnabled hideResizeGrips scrollbarHeight updateOnReleaseOnly".split(" ");if(!this.hideYScrollbar){var b=new AmCharts.SimpleChartScrollbar;b.skipEvent=!0;b.chart=this;this.listenTo(b,"zoomed",this.handleVSBZoom);AmCharts.copyProperties(a,b,c);b.rotate=!0;this.scrollbarV=b}this.hideXScrollbar||(b=new AmCharts.SimpleChartScrollbar,
|
11
|
+
b.skipEvent=!0,b.chart=this,this.listenTo(b,"zoomed",this.handleHSBZoom),AmCharts.copyProperties(a,b,c),b.rotate=!1,this.scrollbarH=b)}},updateTrendLines:function(){var a=this.trendLines,c;for(c=0;c<a.length;c++){var b=a[c];b.chart=this;b.valueAxis||(b.valueAxis=this.yAxes[0]);b.valueAxisX||(b.valueAxisX=this.xAxes[0])}},updateMargins:function(){AmCharts.AmXYChart.base.updateMargins.call(this);var a=this.scrollbarV;a&&(this.getScrollbarPosition(a,!0,this.yAxes[0].position),this.adjustMargins(a,!0));
|
12
|
+
if(a=this.scrollbarH)this.getScrollbarPosition(a,!1,this.xAxes[0].position),this.adjustMargins(a,!1)},updateScrollbars:function(){var a=this.scrollbarV;a&&(this.updateChartScrollbar(a,!0),a.draw());if(a=this.scrollbarH)this.updateChartScrollbar(a,!1),a.draw()},zoomScrollbars:function(){var a=this.scrollbarH;a&&a.relativeZoom(this.widthMultiplier,-this.horizontalPosition/this.widthMultiplier);(a=this.scrollbarV)&&a.relativeZoom(this.heightMultiplier,-this.verticalPosition/this.heightMultiplier)},fitMultiplier:function(a){a>
|
13
|
+
this.maxZoomFactor&&(a=this.maxZoomFactor);return a},handleHSBZoom:function(a){var c=this.fitMultiplier(a.multiplier);a=-a.position*c;var b=-(this.plotAreaWidth*c-this.plotAreaWidth);a<b&&(a=b);this.widthMultiplier=c;this.horizontalPosition=a;this.zoomChart()},handleVSBZoom:function(a){var c=this.fitMultiplier(a.multiplier);a=-a.position*c;var b=-(this.plotAreaHeight*c-this.plotAreaHeight);a<b&&(a=b);this.heightMultiplier=c;this.verticalPosition=a;this.zoomChart()},handleAxisSelfZoom:function(a){if("H"==
|
14
|
+
a.valueAxis.orientation){var c=this.fitMultiplier(a.multiplier);a=-a.position*c;var b=-(this.plotAreaWidth*c-this.plotAreaWidth);a<b&&(a=b);this.horizontalPosition=a;this.widthMultiplier=c}else c=this.fitMultiplier(a.multiplier),a=-a.position*c,b=-(this.plotAreaHeight*c-this.plotAreaHeight),a<b&&(a=b),this.verticalPosition=a,this.heightMultiplier=c;this.zoomChart();c=this.graphs;for(a=0;a<c.length;a++)c[a].setAnimationPlayed();this.zoomScrollbars()},handleCursorZoom:function(a){var c=this.widthMultiplier*
|
15
|
+
this.plotAreaWidth/a.selectionWidth,b=this.heightMultiplier*this.plotAreaHeight/a.selectionHeight,c=this.fitMultiplier(c),b=this.fitMultiplier(b);this.horizontalPosition=(this.horizontalPosition-a.selectionX)*c/this.widthMultiplier;this.verticalPosition=(this.verticalPosition-a.selectionY)*b/this.heightMultiplier;this.widthMultiplier=c;this.heightMultiplier=b;this.zoomChart();this.zoomScrollbars()},removeChartScrollbar:function(){AmCharts.callMethod("destroy",[this.scrollbarH,this.scrollbarV]);this.scrollbarV=
|
16
|
+
this.scrollbarH=null},handleReleaseOutside:function(a){AmCharts.AmXYChart.base.handleReleaseOutside.call(this,a);AmCharts.callMethod("handleReleaseOutside",[this.scrollbarH,this.scrollbarV])}});
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: amcharts.rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.1.0.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Vandersluis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
type: :development
|
15
|
+
prerelease: false
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
type: :development
|
29
|
+
prerelease: false
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby wrapper for Amcharts
|
42
|
+
email:
|
43
|
+
- dvandersluis@selfmgmt.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- amcharts.rb.gemspec
|
54
|
+
- lib/amcharts.rb
|
55
|
+
- lib/amcharts/version.rb
|
56
|
+
- vendor/assets/images/amcharts/dragIcon.gif
|
57
|
+
- vendor/assets/images/amcharts/dragIconH.gif
|
58
|
+
- vendor/assets/images/amcharts/lens.png
|
59
|
+
- vendor/assets/images/amcharts/patterns/black/pattern1.png
|
60
|
+
- vendor/assets/images/amcharts/patterns/black/pattern10.png
|
61
|
+
- vendor/assets/images/amcharts/patterns/black/pattern11.png
|
62
|
+
- vendor/assets/images/amcharts/patterns/black/pattern12.png
|
63
|
+
- vendor/assets/images/amcharts/patterns/black/pattern13.png
|
64
|
+
- vendor/assets/images/amcharts/patterns/black/pattern14.png
|
65
|
+
- vendor/assets/images/amcharts/patterns/black/pattern15.png
|
66
|
+
- vendor/assets/images/amcharts/patterns/black/pattern16.png
|
67
|
+
- vendor/assets/images/amcharts/patterns/black/pattern17.png
|
68
|
+
- vendor/assets/images/amcharts/patterns/black/pattern18.png
|
69
|
+
- vendor/assets/images/amcharts/patterns/black/pattern19.png
|
70
|
+
- vendor/assets/images/amcharts/patterns/black/pattern2.png
|
71
|
+
- vendor/assets/images/amcharts/patterns/black/pattern20.png
|
72
|
+
- vendor/assets/images/amcharts/patterns/black/pattern21.png
|
73
|
+
- vendor/assets/images/amcharts/patterns/black/pattern3.png
|
74
|
+
- vendor/assets/images/amcharts/patterns/black/pattern4.png
|
75
|
+
- vendor/assets/images/amcharts/patterns/black/pattern5.png
|
76
|
+
- vendor/assets/images/amcharts/patterns/black/pattern6.png
|
77
|
+
- vendor/assets/images/amcharts/patterns/black/pattern7.png
|
78
|
+
- vendor/assets/images/amcharts/patterns/black/pattern8.png
|
79
|
+
- vendor/assets/images/amcharts/patterns/black/pattern9.png
|
80
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern1.jpg
|
81
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern1r.jpg
|
82
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern2.jpg
|
83
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern3.jpg
|
84
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern4.jpg
|
85
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern5.jpg
|
86
|
+
- vendor/assets/images/amcharts/patterns/chalk/pattern6.jpg
|
87
|
+
- vendor/assets/images/amcharts/patterns/white/pattern1.png
|
88
|
+
- vendor/assets/images/amcharts/patterns/white/pattern10.png
|
89
|
+
- vendor/assets/images/amcharts/patterns/white/pattern11.png
|
90
|
+
- vendor/assets/images/amcharts/patterns/white/pattern12.png
|
91
|
+
- vendor/assets/images/amcharts/patterns/white/pattern13.png
|
92
|
+
- vendor/assets/images/amcharts/patterns/white/pattern14.png
|
93
|
+
- vendor/assets/images/amcharts/patterns/white/pattern15.png
|
94
|
+
- vendor/assets/images/amcharts/patterns/white/pattern16.png
|
95
|
+
- vendor/assets/images/amcharts/patterns/white/pattern17.png
|
96
|
+
- vendor/assets/images/amcharts/patterns/white/pattern18.png
|
97
|
+
- vendor/assets/images/amcharts/patterns/white/pattern19.png
|
98
|
+
- vendor/assets/images/amcharts/patterns/white/pattern2.png
|
99
|
+
- vendor/assets/images/amcharts/patterns/white/pattern20.png
|
100
|
+
- vendor/assets/images/amcharts/patterns/white/pattern21.png
|
101
|
+
- vendor/assets/images/amcharts/patterns/white/pattern3.png
|
102
|
+
- vendor/assets/images/amcharts/patterns/white/pattern4.png
|
103
|
+
- vendor/assets/images/amcharts/patterns/white/pattern5.png
|
104
|
+
- vendor/assets/images/amcharts/patterns/white/pattern6.png
|
105
|
+
- vendor/assets/images/amcharts/patterns/white/pattern7.png
|
106
|
+
- vendor/assets/images/amcharts/patterns/white/pattern8.png
|
107
|
+
- vendor/assets/images/amcharts/patterns/white/pattern9.png
|
108
|
+
- vendor/assets/javascripts/amcharts/amcharts.js
|
109
|
+
- vendor/assets/javascripts/amcharts/funnel.js
|
110
|
+
- vendor/assets/javascripts/amcharts/gauge.js
|
111
|
+
- vendor/assets/javascripts/amcharts/pie.js
|
112
|
+
- vendor/assets/javascripts/amcharts/radar.js
|
113
|
+
- vendor/assets/javascripts/amcharts/serial.js
|
114
|
+
- vendor/assets/javascripts/amcharts/xy.js
|
115
|
+
homepage: https://github.com/dvandersluis/amcharts.rb
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ! '>'
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.3.1
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.1.5
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: Wrapper for Amcharts 3 Javascript charts
|
139
|
+
test_files: []
|
140
|
+
has_rdoc:
|