Comparar commits

..

26 Commits

Autor SHA1 Mensagem Data
Nick Downie 8f025f33c0 Updated ETA 2013-10-16 23:28:41 +01:00
Nick Downie dffb2cd6ee Update on refactor progress 2013-09-09 00:29:33 +01:00
Nick Downie 58657d65cb Quick note about upcoming refactor 2013-07-18 23:58:31 +01:00
Nick Downie 8d587de970 Quick note about upcoming refactor 2013-07-18 23:57:14 +01:00
Nick Downie bf2489425b Merge pull request #139 from ilyakatz/patch-1
spelling changed for competition
2013-06-14 16:21:53 -07:00
Ilya 72c0131d49 spelling changed for competition 2013-06-13 00:18:12 -03:00
Nick Downie abb3c14c00 Competition details
Challenge post are running a competition and offering some great
prizes. Details are in the readme.
2013-06-11 22:41:50 +01:00
Nick Downie ac55046c31 Merge pull request #126 from Ider/master
Correct default scaleShowLabels value in document
2013-06-05 15:16:04 -07:00
Ider 0638674145 Correct default scaleShowLabels value to match js file setting
default scaleShowLabels value for Line and Bar is true in js file, but
it is false in document page.
Correct document page to match the value to reduce the confuse
2013-05-30 19:58:31 -07:00
Nick Downie 2e08396255 Merge pull request #75 from epeli/patch-1
Explicit global definition
2013-04-15 10:20:28 -07:00
Esa-Matti Suuronen 624fbfd474 Explicit global definition
Some script bundlers such as Browserify compile a wrapper function over the modules. If var-statement is used to define the global it will be hidden inside it. Use window-global to define Chart global explicitly.
2013-04-13 11:55:36 +03:00
Nick Downie 4a94b44a77 Version bump 2013-04-12 21:26:33 +01:00
Nick Downie 7a55a1614c 0.2 Update
- Fixes hard coded scales now longer not one step out of sync
2013-04-12 21:20:44 +01:00
Nick Downie 75f4d21968 There are too many versions of Chart.js 2013-03-25 19:50:18 +00:00
Nick Downie 19e32556e8 Fix for broken radar rotation 2013-03-25 19:38:08 +00:00
Nick Downie d30edc1b8d Cleared up folder structure 2013-03-25 19:25:57 +00:00
Nick Downie 7033042fae Added index site as well 2013-03-25 19:18:58 +00:00
Nick Downie 2acdfbfca8 Merge pull request #33 from robocoder/license-patch
add license text and header
2013-03-25 12:03:41 -07:00
Nick Downie 552de1f21c Added docs site to the project
Font's probably won't be server from typekit.
2013-03-25 19:01:46 +00:00
Anthon Pang 9453a670cd add license text and header 2013-03-20 00:09:51 -04:00
Nick Downie 26962ce2b6 Back online! 2013-03-19 16:22:03 +00:00
nnnick 1513be49cf Merge pull request #19 from fizerkhan/master
Added file for Bower package
2013-03-18 13:08:02 -07:00
Fizer Khan 18e094be9a Added Bower package support. 2013-03-18 21:59:20 +05:30
Nick Downie 4acc88e339 Added a license to the readme.
Also updated the online documentation with the license.
2013-03-18 07:40:28 +00:00
Nick Downie 1ee31e3708 Using an html tag in md was silly. 2013-03-17 23:59:08 +00:00
Nick Downie a9dcf88378 First commit. Version 0.1
Examples of the six charts that can be created, and the Chart.js
library.
2013-03-17 23:57:50 +00:00
56 arquivos alterados com 8214 adições e 4693 exclusões
+2 -4
Ver Arquivo
@@ -1,4 +1,2 @@
_site
node_modules
coverage
Gemfile.lock
.DS_Store
-5
Ver Arquivo
@@ -1,5 +0,0 @@
sudo: false
language: ruby
script: "bundle exec jekyll build"
rvm:
- 2.1.0
-1
Ver Arquivo
@@ -1 +0,0 @@
www.chartjs.org
externo Arquivo executável
+1426
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+39
Ver Arquivo
@@ -0,0 +1,39 @@
var Chart=function(s){function v(a,c,b){a=A((a-c.graphMin)/(c.steps*c.stepValue),1,0);return b*c.steps*a}function x(a,c,b,e){function h(){g+=f;var k=a.animation?A(d(g),null,0):1;e.clearRect(0,0,q,u);a.scaleOverlay?(b(k),c()):(c(),b(k));if(1>=g)D(h);else if("function"==typeof a.onAnimationComplete)a.onAnimationComplete()}var f=a.animation?1/A(a.animationSteps,Number.MAX_VALUE,1):1,d=B[a.animationEasing],g=a.animation?0:1;"function"!==typeof c&&(c=function(){});D(h)}function C(a,c,b,e,h,f){var d;a=
Math.floor(Math.log(e-h)/Math.LN10);h=Math.floor(h/(1*Math.pow(10,a)))*Math.pow(10,a);e=Math.ceil(e/(1*Math.pow(10,a)))*Math.pow(10,a)-h;a=Math.pow(10,a);for(d=Math.round(e/a);d<b||d>c;)a=d<b?a/2:2*a,d=Math.round(e/a);c=[];z(f,c,d,h,a);return{steps:d,stepValue:a,graphMin:h,labels:c}}function z(a,c,b,e,h){if(a)for(var f=1;f<b+1;f++)c.push(E(a,{value:(e+h*f).toFixed(0!=h%1?h.toString().split(".")[1].length:0)}))}function A(a,c,b){return!isNaN(parseFloat(c))&&isFinite(c)&&a>c?c:!isNaN(parseFloat(b))&&
isFinite(b)&&a<b?b:a}function y(a,c){var b={},e;for(e in a)b[e]=a[e];for(e in c)b[e]=c[e];return b}function E(a,c){var b=!/\W/.test(a)?F[a]=F[a]||E(document.getElementById(a).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return c?
b(c):b}var r=this,B={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return 1>(a/=0.5)?0.5*a*a:-0.5*(--a*(a-2)-1)},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1*((a=a/1-1)*a*a+1)},easeInOutCubic:function(a){return 1>(a/=0.5)?0.5*a*a*a:0.5*((a-=2)*a*a+2)},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return-1*((a=a/1-1)*a*a*a-1)},easeInOutQuart:function(a){return 1>(a/=0.5)?
0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)},easeInQuint:function(a){return 1*(a/=1)*a*a*a*a},easeOutQuint:function(a){return 1*((a=a/1-1)*a*a*a*a+1)},easeInOutQuint:function(a){return 1>(a/=0.5)?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)},easeInSine:function(a){return-1*Math.cos(a/1*(Math.PI/2))+1},easeOutSine:function(a){return 1*Math.sin(a/1*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a/1)-1)},easeInExpo:function(a){return 0==a?1:1*Math.pow(2,10*(a/1-1))},easeOutExpo:function(a){return 1==
a?1:1*(-Math.pow(2,-10*a/1)+1)},easeInOutExpo:function(a){return 0==a?0:1==a?1:1>(a/=0.5)?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return 1<=a?a:-1*(Math.sqrt(1-(a/=1)*a)-1)},easeOutCirc:function(a){return 1*Math.sqrt(1-(a=a/1-1)*a)},easeInOutCirc:function(a){return 1>(a/=0.5)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*
Math.PI)*Math.asin(1/e);return-(e*Math.pow(2,10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b))},easeOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(2==(a/=0.5))return 1;b||(b=1*0.3*1.5);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return 1>a?-0.5*e*Math.pow(2,10*
(a-=1))*Math.sin((1*a-c)*2*Math.PI/b):0.5*e*Math.pow(2,-10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInBack:function(a){return 1*(a/=1)*a*(2.70158*a-1.70158)},easeOutBack:function(a){return 1*((a=a/1-1)*a*(2.70158*a+1.70158)+1)},easeInOutBack:function(a){var c=1.70158;return 1>(a/=0.5)?0.5*a*a*(((c*=1.525)+1)*a-c):0.5*((a-=2)*a*(((c*=1.525)+1)*a+c)+2)},easeInBounce:function(a){return 1-B.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=1)<1/2.75?1*7.5625*a*a:a<2/2.75?1*(7.5625*(a-=1.5/2.75)*
a+0.75):a<2.5/2.75?1*(7.5625*(a-=2.25/2.75)*a+0.9375):1*(7.5625*(a-=2.625/2.75)*a+0.984375)},easeInOutBounce:function(a){return 0.5>a?0.5*B.easeInBounce(2*a):0.5*B.easeOutBounce(2*a-1)+0.5}},q=s.canvas.width,u=s.canvas.height;window.devicePixelRatio&&(s.canvas.style.width=q+"px",s.canvas.style.height=u+"px",s.canvas.height=u*window.devicePixelRatio,s.canvas.width=q*window.devicePixelRatio,s.scale(window.devicePixelRatio,window.devicePixelRatio));this.PolarArea=function(a,c){r.PolarArea.defaults={scaleOverlay:!0,
scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",
animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.PolarArea.defaults,c):r.PolarArea.defaults;return new G(a,b,s)};this.Radar=function(a,c){r.Radar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!1,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",
scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,angleShowLineOut:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:12,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Radar.defaults,c):r.Radar.defaults;return new H(a,b,s)};this.Pie=function(a,
c){r.Pie.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.Pie.defaults,c):r.Pie.defaults;return new I(a,b,s)};this.Doughnut=function(a,c){r.Doughnut.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,
onAnimationComplete:null};var b=c?y(r.Doughnut.defaults,c):r.Doughnut.defaults;return new J(a,b,s)};this.Line=function(a,c){r.Line.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,bezierCurve:!0,
pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:2,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Line.defaults,c):r.Line.defaults;return new K(a,b,s)};this.Bar=function(a,c){r.Bar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",
scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Bar.defaults,c):r.Bar.defaults;return new L(a,b,s)};var G=function(a,c,b){var e,h,f,d,g,k,j,l,m;g=Math.min.apply(Math,[q,u])/2;g-=Math.max.apply(Math,[0.5*c.scaleFontSize,0.5*c.scaleLineWidth]);
d=2*c.scaleFontSize;c.scaleShowLabelBackdrop&&(d+=2*c.scaleBackdropPaddingY,g-=1.5*c.scaleBackdropPaddingY);l=g;d=d?d:5;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.length;f++)a[f].value>e&&(e=a[f].value),a[f].value<h&&(h=a[f].value);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,
m);k=g/j.steps;x(c,function(){for(var a=0;a<j.steps;a++)if(c.scaleShowLine&&(b.beginPath(),b.arc(q/2,u/2,k*(a+1),0,2*Math.PI,!0),b.strokeStyle=c.scaleLineColor,b.lineWidth=c.scaleLineWidth,b.stroke()),c.scaleShowLabels){b.textAlign="center";b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;var e=j.labels[a];if(c.scaleShowLabelBackdrop){var d=b.measureText(e).width;b.fillStyle=c.scaleBackdropColor;b.beginPath();b.rect(Math.round(q/2-d/2-c.scaleBackdropPaddingX),Math.round(u/2-k*(a+
1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(d+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY));b.fill()}b.textBaseline="middle";b.fillStyle=c.scaleFontColor;b.fillText(e,q/2,u/2-k*(a+1))}},function(e){var d=-Math.PI/2,g=2*Math.PI/a.length,f=1,h=1;c.animation&&(c.animateScale&&(f=e),c.animateRotate&&(h=e));for(e=0;e<a.length;e++)b.beginPath(),b.arc(q/2,u/2,f*v(a[e].value,j,k),d,d+h*g,!1),b.lineTo(q/2,u/2),b.closePath(),b.fillStyle=a[e].color,b.fill(),
c.segmentShowStroke&&(b.strokeStyle=c.segmentStrokeColor,b.lineWidth=c.segmentStrokeWidth,b.stroke()),d+=h*g},b)},H=function(a,c,b){var e,h,f,d,g,k,j,l,m;a.labels||(a.labels=[]);g=Math.min.apply(Math,[q,u])/2;d=2*c.scaleFontSize;for(e=l=0;e<a.labels.length;e++)b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily,h=b.measureText(a.labels[e]).width,h>l&&(l=h);g-=Math.max.apply(Math,[l,1.5*(c.pointLabelFontSize/2)]);g-=c.pointLabelFontSize;l=g=A(g,null,0);d=d?d:5;e=Number.MIN_VALUE;
h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(m=0;m<a.datasets[f].data.length;m++)a.datasets[f].data[m]>e&&(e=a.datasets[f].data[m]),a.datasets[f].data[m]<h&&(h=a.datasets[f].data[m]);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,m);k=g/j.steps;x(c,function(){var e=2*Math.PI/
a.datasets[0].data.length;b.save();b.translate(q/2,u/2);if(c.angleShowLineOut){b.strokeStyle=c.angleLineColor;b.lineWidth=c.angleLineWidth;for(var d=0;d<a.datasets[0].data.length;d++)b.rotate(e),b.beginPath(),b.moveTo(0,0),b.lineTo(0,-g),b.stroke()}for(d=0;d<j.steps;d++){b.beginPath();if(c.scaleShowLine){b.strokeStyle=c.scaleLineColor;b.lineWidth=c.scaleLineWidth;b.moveTo(0,-k*(d+1));for(var f=0;f<a.datasets[0].data.length;f++)b.rotate(e),b.lineTo(0,-k*(d+1));b.closePath();b.stroke()}c.scaleShowLabels&&
(b.textAlign="center",b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily,b.textBaseline="middle",c.scaleShowLabelBackdrop&&(f=b.measureText(j.labels[d]).width,b.fillStyle=c.scaleBackdropColor,b.beginPath(),b.rect(Math.round(-f/2-c.scaleBackdropPaddingX),Math.round(-k*(d+1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(f+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY)),b.fill()),b.fillStyle=c.scaleFontColor,b.fillText(j.labels[d],0,-k*(d+
1)))}for(d=0;d<a.labels.length;d++){b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily;b.fillStyle=c.pointLabelFontColor;var f=Math.sin(e*d)*(g+c.pointLabelFontSize),h=Math.cos(e*d)*(g+c.pointLabelFontSize);b.textAlign=e*d==Math.PI||0==e*d?"center":e*d>Math.PI?"right":"left";b.textBaseline="middle";b.fillText(a.labels[d],f,-h)}b.restore()},function(d){var e=2*Math.PI/a.datasets[0].data.length;b.save();b.translate(q/2,u/2);for(var g=0;g<a.datasets.length;g++){b.beginPath();
b.moveTo(0,d*-1*v(a.datasets[g].data[0],j,k));for(var f=1;f<a.datasets[g].data.length;f++)b.rotate(e),b.lineTo(0,d*-1*v(a.datasets[g].data[f],j,k));b.closePath();b.fillStyle=a.datasets[g].fillColor;b.strokeStyle=a.datasets[g].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.fill();b.stroke();if(c.pointDot){b.fillStyle=a.datasets[g].pointColor;b.strokeStyle=a.datasets[g].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(f=0;f<a.datasets[g].data.length;f++)b.rotate(e),b.beginPath(),b.arc(0,d*-1*
v(a.datasets[g].data[f],j,k),c.pointDotRadius,2*Math.PI,!1),b.fill(),b.stroke()}b.rotate(e)}b.restore()},b)},I=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=0;f<a.length;f++)e+=a[f].value;x(c,null,function(d){var g=-Math.PI/2,f=1,j=1;c.animation&&(c.animateScale&&(f=d),c.animateRotate&&(j=d));for(d=0;d<a.length;d++){var l=j*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,f*h,g,g+l);b.lineTo(q/2,u/2);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&(b.lineWidth=
c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());g+=l}},b)},J=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=h*(c.percentageInnerCutout/100),d=0;d<a.length;d++)e+=a[d].value;x(c,null,function(d){var k=-Math.PI/2,j=1,l=1;c.animation&&(c.animateScale&&(j=d),c.animateRotate&&(l=d));for(d=0;d<a.length;d++){var m=l*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,j*h,k,k+m,!1);b.arc(q/2,u/2,j*f,k+m,k,!0);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&
(b.lineWidth=c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());k+=m}},b)},K=function(a,c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(s=45,q/a.labels.length<Math.cos(s)*t?(s=90,g-=t):g-=Math.sin(s)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=
0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;
for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=Math.floor(r/(a.labels.length-1));n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<s?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<s?(b.translate(n+d*m,p+c.scaleFontSize),b.rotate(-(s*(Math.PI/180))),b.fillText(a.labels[d],
0,0),b.restore()):b.fillText(a.labels[d],n+d*m,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+d*m,p+3),c.scaleShowGridLines&&0<d?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+d*m,5)):b.lineTo(n+d*m,p+3),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,
b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){function e(b,c){return p-d*v(a.datasets[b].data[c],j,k)}for(var f=0;f<a.datasets.length;f++){b.strokeStyle=a.datasets[f].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.beginPath();b.moveTo(n,p-d*v(a.datasets[f].data[0],j,k));for(var g=1;g<a.datasets[f].data.length;g++)c.bezierCurve?b.bezierCurveTo(n+m*(g-0.5),e(f,g-1),n+m*(g-0.5),
e(f,g),n+m*g,e(f,g)):b.lineTo(n+m*g,e(f,g));b.stroke();c.datasetFill?(b.lineTo(n+m*(a.datasets[f].data.length-1),p),b.lineTo(n,p),b.closePath(),b.fillStyle=a.datasets[f].fillColor,b.fill()):b.closePath();if(c.pointDot){b.fillStyle=a.datasets[f].pointColor;b.strokeStyle=a.datasets[f].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(g=0;g<a.datasets[f].data.length;g++)b.beginPath(),b.arc(n+m*g,p-d*v(a.datasets[f].data[g],j,k),c.pointDotRadius,0,2*Math.PI,!0),b.fill(),b.stroke()}}},b)},L=function(a,
c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s,w=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(w=45,q/a.labels.length<Math.cos(w)*t?(w=90,g-=t):g-=Math.sin(w)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<
h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=
Math.floor(r/a.labels.length);s=(m-2*c.scaleGridLineWidth-2*c.barValueSpacing-(c.barDatasetSpacing*a.datasets.length-1)-(c.barStrokeWidth/2*a.datasets.length-1))/a.datasets.length;n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<w?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<w?(b.translate(n+
d*m,p+c.scaleFontSize),b.rotate(-(w*(Math.PI/180))),b.fillText(a.labels[d],0,0),b.restore()):b.fillText(a.labels[d],n+d*m+m/2,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+(d+1)*m,p+3),b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+(d+1)*m,5),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*
k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){b.lineWidth=c.barStrokeWidth;for(var e=0;e<a.datasets.length;e++){b.fillStyle=a.datasets[e].fillColor;b.strokeStyle=a.datasets[e].strokeColor;for(var f=0;f<a.datasets[e].data.length;f++){var g=n+c.barValueSpacing+m*f+s*e+c.barDatasetSpacing*e+c.barStrokeWidth*e;b.beginPath();
b.moveTo(g,p);b.lineTo(g,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p);c.barShowStroke&&b.stroke();b.closePath();b.fill()}}},b)},D=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)},F={}};
-3
Ver Arquivo
@@ -1,3 +0,0 @@
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
+7
Ver Arquivo
@@ -0,0 +1,7 @@
Copyright (c) 2013 Nick Downie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-21
Ver Arquivo
@@ -1,21 +0,0 @@
About this branch
=================
This branch provides documentation for the Chart.js project. It is set up to
provide the hosting for <http://www.chartjs.org/>
Running and building locally
============================
The documentation is written using Markdown and Jekyll. See GitHub's Jekyll
documentation at <https://help.github.com/articles/using-jekyll-with-pages/> and
see GitHub's `pages-gem` at <https://github.com/github/pages-gem> regarding how
to set up the identical build environment locally.
Syncing
=======
The contents of the `master` branch's `docs` directory should be copied to this
`gh-pages` branch's `_doc-parts` directory. Please submit a pull request to do
this whenever updating the `master` branch, unless the `master `branch is
preparing to make an alpha release.
-15
Ver Arquivo
@@ -1,15 +0,0 @@
# Base URL to work with github pages
baseurl: /Chart.js
repository: nnnick/Chart.js
# Collections of files
collections:
doc-parts:
output: false
doc-parts-v2:
output: false
markdown: kramdown
future: true
-247
Ver Arquivo
@@ -1,247 +0,0 @@
---
title: Getting started
anchor: getting-started
---
### Download Chart.js
To download a zip, go to the [Chart.js on Github](https://github.com/nnnick/Chart.js)
To install via npm / bower:
```bash
npm install chart.js --save
```
```bash
bower install Chart.js --save
```
CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.0.0/Chart.js
### Install Chart.js
To import Chart.js using an old-school script tag:
```html
<script src="Chart.js"></script>
<script>
var myChart = new Chart({...})
</script>
```
To import Chart.js using an awesome module loader:
```javascript
// Using CommonJS
var Chart = require('chart.js')
var myChart = new Chart({...})
// ES6
import Chart from 'chart.js'
let myChart = new Chart({...})
// Using requirejs
require(['path/to/Chartjs'], function(Chart){
var myChart = new Chart({...})
})
```
### Creating a Chart
To create a chart, we need to instantiate the `Chart` class. To do this, we need to pass in the node, jQuery instance, or 2d context of the canvas of where we want to draw the chart. Here's an example.
```html
<canvas id="myChart" width="400" height="400"></canvas>
```
```javascript
// Any of the following formats may be used
var ctx = document.getElementById("myChart");
var ctx = document.getElementById("myChart").getContext("2d");
var ctx = $("#myChart");
```
Once you have the element or context, you're ready to instantiate a pre-defined chart-type or create your own!
The following example instantiates a bar chart showing the number of votes for different colors and the y-axis starting at 0.
```html
<canvas id="myChart" width="400" height="400"></canvas>
<script>
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3]
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
</script>
```
It's that easy to get started using Chart.js! From here you can explore the many options that can help you customise your charts with scales, tooltips, labels, colors, custom actions, and much more.
### Global chart configuration
This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
Chart.js merges configurations and options in a few places with the global defaults using chart type defaults and scales defaults. This way you can be as specific as you want in your individual chart configs, or change the defaults for Chart.js as a whole.
The global options are defined in `Chart.defaults.global`.
Name | Type | Default | Description
--- | --- | --- | ---
responsive | Boolean | true | Resizes when the canvas container does.
responsiveAnimationDuration | Number | 0 | Duration in milliseconds it takes to animate to new size after a resize event.
maintainAspectRatio | Boolean | true | Maintain the original canvas aspect ratio `(width / height)` when resizing
events | Array[String] | `["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"]` | Events that the chart should listen to for tooltips and hovering
hover |-|-|-
*hover*.onHover | Function | null | Called when any of the events fire. Called in the context of the chart and passed an array of active elements (bars, points, etc)
*hover*.mode | String | 'single' | Sets which elements hover. Acceptable options are `'single'`, `'label'`, or `'dataset'`. `single` highlights the closest element. `label` highlights elements in all datasets at the same `X` value. `dataset` highlights the closest dataset.
*hover*.animationDuration | Number | 400 | Duration in milliseconds it takes to animate hover style changes
onClick | Function | null | Called if the event is of type 'mouseup' or 'click'. Called in the context of the chart and passed an array of active elements
defaultColor | Color | 'rgba(0,0,0,0.1)' |
defaultFontColor | Color | '#666' | Default font color for all text
defaultFontFamily | String | "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" | Default font family for all text
defaultFontSize | Number | 12 | Default font size (in px) for text. Does not apply to radialLinear scale point labels
defaultFontStyle | String | 'normal' | Default font style. Does not apply to tooltip title or footer. Does not apply to chart title
legendCallback | Function | ` function (chart) { }` | Function to generate a legend. Receives the chart object to generate a legend from. Default implementation returns an HTML string.
The global options for the chart title is defined in `Chart.defaults.global.title`
Name | Type | Default | Description
--- | --- | --- | ---
display | Boolean | true | Show the title block
position | String | 'top' | Position of the title. 'top' or 'bottom' are allowed
fullWidth | Boolean | true | Marks that this box should take the full width of the canvas (pushing down other boxes)
fontColor | Color | '#666' | Text color
fontFamily | String | 'Helvetica Neue' |
fontSize | Number | 12 |
fontStyle | String | 'bold' |
padding | Number | 10 | Number of pixels to add above and below the title text
text | String | '' | Title text
The global options for the chart legend is defined in `Chart.defaults.global.legend`
Name | Type | Default | Description
--- | --- | --- | ---
display | Boolean | true | Is the legend displayed
position | String | 'top' | Position of the legend. Options are 'top' or 'bottom'
fullWidth | Boolean | true | Marks that this box should take the full width of the canvas (pushing down other boxes)
onClick | Function | `function(event, legendItem) {}` | A callback that is called when a click is registered on top of a label item
labels |-|-|-
*labels*boxWidth | Number | 40 | Width of coloured box
*labels*fontSize | Number | 12 | Font size
*labels*fontStyle | String | "normal" |
*labels*fontColor | Color | "#666" |
*labels*fontFamily | String | "Helvetica Neue" |
*labels*padding | Number | 10 | Padding between rows of colored boxes
*labels*generateLabels: | Function | `function(data) { }` | Generates legend items for each thing in the legend. Default implementation returns the text + styling for the color box. Styles that can be returned are `fillStyle`, `strokeStyle`, `lineCap`, `lineDash`, `lineDashOffset`, `lineWidth`, `lineJoin`. Return a `hidden` attribute to indicate that the label refers to something that is not visible. A strikethrough style will be given to the text in this case.
The global options for tooltips are defined in `Chart.defaults.global.tooltips`.
Name | Type | Default | Description
--- |:---:| --- | ---
enabled | Boolean | true |
custom | | null |
mode | String | 'single' | Sets which elements appear in the tooltip. Acceptable options are `'single'` or `'label'`. `single` highlights the closest element. `label` highlights elements in all datasets at the same `X` value.
backgroundColor | Color | 'rgba(0,0,0,0.8)' | Background color of the tooltip
| | |
Label | | | There are three labels you can control. `title`, `body`, `footer` the star (\*) represents one of these three. *(i.e. titleFontFamily, footerSpacing)*
\*FontFamily | String | "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" |
\*FontSize | Number | 12 |
\*FontStyle | String | title - "bold", body - "normal", footer - "bold" |
\*Spacing | Number | 2 |
\*Color | Color | "#fff" |
\*Align | String | "left" | text alignment. See [MDN Canvas Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign)
titleMarginBottom | Number | 6 | Margin to add on bottom of title section
footerMarginTop | Number | 6 | Margin to add before drawing the footer
xPadding | Number | 6 | Padding to add on left and right of tooltip
yPadding | Number | 6 | Padding to add on top and bottom of tooltip
caretSize | Number | 5 | Size, in px, of the tooltip arrow
cornerRadius | Number | 6 | Radius of tooltip corner curves
multiKeyBackground | Color | "#fff" | Color to draw behind the colored boxes when multiple items are in the tooltip
| | |
callbacks | - | - | V2.0 introduces callback functions as a replacement for the template engine in v1. The tooltip has the following callbacks for providing text. For all functions, 'this' will be the tooltip object create from the Chart.Tooltip constructor
**Callback Functions** | | | All functions are called with the same arguments
xLabel | String or Array[Strings] | | This is the xDataValue for each item to be displayed in the tooltip
yLabel | String or Array[Strings] | | This is the yDataValue for each item to be displayed in the tooltip
index | Number | | Data index.
data | Object | | Data object passed to chart.
`return`| String or Array[Strings] | | All functions must return either a string or an array of strings. Arrays of strings are treated as multiple lines of text.
| | |
*callbacks*.beforeTitle | Function | none | Text to render before the title
*callbacks*.title | Function | `function(tooltipItems, data) { //Pick first xLabel }` | Text to render as the title
*callbacks*.afterTitle | Function | none | Text to render after the ttiel
*callbacks*.beforeBody | Function | none | Text to render before the body section
*callbacks*.beforeLabel | Function | none | Text to render before an individual label
*callbacks*.label | Function | `function(tooltipItem, data) { // Returns "datasetLabel: tooltipItem.yLabel" }` | Text to render as label
*callbacks*.afterLabel | Function | none | Text to render after an individual label
*callbacks*.afterBody | Function | none | Text to render after the body section
*callbacks*.beforeFooter | Function | none | Text to render before the footer section
*callbacks*.footer | Function | none | Text to render as the footer
*callbacks*.afterFooter | Function | none | Text to render after the footer section
The global options for animations are defined in `Chart.defaults.global.animation`.
Name | Type | Default | Description
--- |:---:| --- | ---
duration | Number | 1000 | The number of milliseconds an animation takes.
easing | String | "easeOutQuart" | Easing function to use.
onProgress | Function | none | Callback called on each step of an animation. Passed a single argument, an object, containing the chart instance and an object with details of the animation.
onComplete | Function | none | Callback called at the end of an animation. Passed the same arguments as `onProgress`
The global options for elements are defined in `Chart.defaults.global.elements`.
Name | Type | Default | Description
--- |:---:| --- | ---
arc | - | - | -
*arc*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default fill color for arcs
*arc*.borderColor | Color | "#fff" | Default stroke color for arcs
*arc*.borderWidth | Number | 2 | Default stroke width for arcs
line | - | - | -
*line*.tension | Number | 0.4 | Default bezier curve tension. Set to `0` for no bezier curves.
*line*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default line fill color
*line*.borderWidth | Number | 3 | Default line stroke width
*line*.borderColor | Color | `Chart.defaults.global.defaultColor` | Default line stroke color
*line*.borderCapStyle | String | 'butt' | Default line cap style. See [MDN](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap)
*line*.borderDash | Array | `[]` | Default line dash. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash)
*line*.borderDashOffset | Number | 0.0 | Default line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
*line*.borderJoinStyle | String | 'miter' | Default line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin)
*line*.fill | Boolean | true |
point | - | - | -
*point*.radius | Number | 3 | Default point radius
*point*.pointStyle | String | 'circle' | Default point style
*point*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default point fill color
*point*.borderWidth | Number | 1 | Default point stroke width
*point*.borderColor | Color | `Chart.defaults.global.defaultColor` | Default point stroke color
*point*.hitRadius | Number | 1 | Extra radius added to point radius for hit detection
*point*.hoverRadius | Number | 4 | Default point radius when hovered
*point*.hoverBorderWidth | Number | 1 | Default stroke width when hovered
rectangle | - | - | -
*rectangle*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default bar fill color
*rectangle*.borderWidth | Number | 0 | Default bar stroke width
*rectangle*.borderColor | Color | `Chart.defaults.global.defaultColor` | Default bar stroke color
*rectangle*.borderSkipped | String | 'bottom' | Default skipped (excluded) border for rectangle. Can be one of `bottom`, `left`, `top`, `right`
If for example, you wanted all charts created to be responsive, and resize when the browser window does, the following setting can be changed:
```javascript
Chart.defaults.global.responsive = true;
```
Now, every time we create a chart, `options.responsive` will be `true`.
-297
Ver Arquivo
@@ -1,297 +0,0 @@
---
title: Scales
anchor: scales
---
Scales in v2.0 of Chart.js are significantly more powerful, but also different than those of v1.0.
* Multiple x & y axes are now supported.
* A built-in label auto-skip feature now detects would-be overlapping ticks and labels and removes every nth label to keep things displaying normally.
* Scale titles are now supported
* New scale types can be extended without writing an entirely new chart type
Every scale extends a core scale class with the following options:
Name | Type | Default | Description
--- |:---:| --- | ---
type | String | Chart specific. | Type of scale being employed. Custom scales can be created and registered with a string key. Options: ["category"](#scales-category-scale), ["linear"](#scales-linear-scale), ["logarithmic"](#scales-logarithmic-scale), ["time"](#scales-time-scale), ["radialLinear"](#scales-radial-linear-scale)
display | Boolean | true | If true, show the scale including gridlines, ticks, and labels. Overrides *gridLines.display*, *scaleLabel.display*, and *ticks.display*.
beforeUpdate | Function | undefined | Callback called before the update process starts. Passed a single argument, the scale instance.
beforeSetDimensions | Function | undefined | Callback that runs before dimensions are set. Passed a single argument, the scale instance.
afterSetDimensions | Function | undefined | Callback that runs after dimensions are set. Passed a single argument, the scale instance.
beforeDataLimits | Function | undefined | Callback that runs before data limits are determined. Passed a single argument, the scale instance.
afterDataLimits | Function | undefined | Callback that runs after data limits are determined. Passed a single argument, the scale instance.
beforeBuildTicks | Function | undefined | Callback that runs before ticks are created. Passed a single argument, the scale instance.
afterBuildTicks | Function | undefined | Callback that runs after ticks are created. Useful for filtering ticks. Passed a single argument, the scale instance.
beforeTickToLabelConversion | Function | undefined | Callback that runs before ticks are converted into strings. Passed a single argument, the scale instance.
afterTickToLabelConversion | Function | undefined | Callback that runs after ticks are converted into strings. Passed a single argument, the scale instance.
beforeCalculateTickRotation | Function | undefined | Callback that runs before tick rotation is determined. Passed a single argument, the scale instance.
afterCalculateTickRotation | Function | undefined | Callback that runs after tick rotation is determined. Passed a single argument, the scale instance.
beforeFit | Function | undefined | Callback that runs before the scale fits to the canvas. Passed a single argument, the scale instance.
afterFit | Function | undefined | Callback that runs after the scale fits to the canvas. Passed a single argument, the scale instance.
afterUpdate | Function | undefined | Callback that runs at the end of the update process. Passed a single argument, the scale instance.
**gridLines** | Array | - | Options for the grid lines that run perpendicular to the axis.
*gridLines*.display | Boolean | true |
*gridLines*.color | Color | "rgba(0, 0, 0, 0.1)" | Color of the grid lines.
*gridLines*.lineWidth | Number | 1 | Stroke width of grid lines
*gridLines*.drawOnChartArea | Boolean | true | If true, draw lines on the chart area inside the axis lines. This is useful when there are multiple axes and you need to control which grid lines are drawn
*gridLines*.drawTicks | Boolean | true | If true, draw lines beside the ticks in the axis area beside the chart.
*gridLines*.zeroLineWidth | Number | 1 | Stroke width of the grid line for the first index (index 0).
*gridLines*.zeroLineColor | Color | "rgba(0, 0, 0, 0.25)" | Stroke color of the grid line for the first index (index 0).
*gridLines*.offsetGridLines | Boolean | false | If true, offset labels from grid lines.
**scaleLabel** | Array | | Title for the entire axis.
*scaleLabel*.display | Boolean | false |
*scaleLabel*.labelString | String | "" | The text for the title. (i.e. "# of People", "Response Choices")
*scaleLabel*.fontColor | Color | "#666" | Font color for the scale title.
*scaleLabel*.fontFamily| String | "Helvetica Neue" | Font family for the scale title, follows CSS font-family options.
*scaleLabel*.fontSize | Number | 12 | Font size for the scale title.
*scaleLabel*.fontStyle | String | "normal" | Font style for the scale title, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
**ticks** | Array | | Settings for the labels that run along the axis.
*ticks*.beginAtZero | Boolean | false | If true the scale will be begin at 0, if false the ticks will begin at your smallest data value.
*ticks*.fontColor | Color | "#666" | Font color for the tick labels.
*ticks*.fontFamily | String | "Helvetica Neue" | Font family for the tick labels, follows CSS font-family options.
*ticks*.fontSize | Number | 12 | Font size for the tick labels.
*ticks*.fontStyle | String | "normal" | Font style for the tick labels, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
*ticks*.maxRotation | Number | 90 | Maximum rotation for tick labels when rotating to condense labels. Note: Rotation doesn't occur until necessary. *Note: Only applicable to horizontal scales.*
*ticks*.minRotation | Number | 20 | *currently not-implemented* Minimum rotation for tick labels when condensing is necessary. *Note: Only applicable to horizontal scales.*
*ticks*.maxTicksLimit | Number | 11 | Maximum number of ticks and gridlines to show. If not defined, it will limit to 11 ticks but will show all gridlines.
*ticks*.padding | Number | 10 | Padding between the tick label and the axis. *Note: Only applicable to horizontal scales.*
*ticks*.mirror | Boolean | false | Flips tick labels around axis, displaying the labels inside the chart instead of outside. *Note: Only applicable to vertical scales.*
*ticks*.reverse | Boolean | false | Reverses order of tick labels.
*ticks*.display | Boolean | true | If true, show the ticks.
*ticks*.suggestedMin | Number | - | User defined minimum number for the scale, overrides minimum value *except for if* it is higher than the minimum value.
*ticks*.suggestedMax | Number | - | User defined maximum number for the scale, overrides maximum value *except for if* it is lower than the maximum value.
*ticks*.min | Number | - | User defined minimum number for the scale, overrides minimum value
*ticks*.max | Number | - | User defined minimum number for the scale, overrides maximum value
*ticks*.autoSkip | Boolean | true | If true, automatically calculates how many labels that can be shown and hides labels accordingly. Turn it off to show all labels no matter what
*ticks*.callback | Function | `function(value) { return '' + value; } ` | Returns the string representation of the tick value as it should be displayed on the chart.
The `callback` method may be used for advanced tick customization. The following callback would display every label in scientific notation
```javascript
{
scales: {
xAxes: [{
ticks: {
// Return an empty string to draw the tick line but hide the tick label
// Return `null` or `undefined` to hide the tick line entirely
userCallback: function(value, index, values) {
return value.toExponential();
}
}
}]
}
}
```
### Category Scale
The category scale will be familiar to those who have used v1.0. Labels are drawn in from the labels array included in the chart data.
The category scale extends the core scale class with the following tick template:
```javascript
{
position: "bottom",
}
```
### Linear Scale
The linear scale can be used to display numerical data. It can be placed on either the x or y axis. The scatter chart type automatically configures a line chart to use one of these scales for the x axis.
The linear scale extends the core scale class with the following tick template:
```javascript
{
position: "left",
ticks: {
callback: function(tickValue, index, ticks) {
var delta = ticks[1] - ticks[0];
// If we have a number like 2.5 as the delta, figure out how many decimal places we need
if (Math.abs(delta) > 1) {
if (tickValue !== Math.floor(tickValue)) {
// not an integer
delta = tickValue - Math.floor(tickValue);
}
}
var logDelta = helpers.log10(Math.abs(delta));
var tickString = '';
if (tickValue !== 0) {
var numDecimal = -1 * Math.floor(logDelta);
numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
tickString = tickValue.toFixed(numDecimal);
} else {
tickString = '0'; // never show decimal places for 0
}
return tickString;
}
}
}
```
It also provides additional configuration options:
Name | Type | Default | Description
--- |:---:| --- | ---
*ticks*.stepSize | Number | - | User defined fixed step size for the scale. If set, the scale ticks will be enumerated by multiple of stepSize, having one tick per increment. If not set, the ticks are labeled automatically using the nice numbers algorithm.
### Logarithmic Scale
The logarithmic scale is used to display logarithmic data of course. It can be placed on either the x or y axis.
The log scale extends the core scale class with the following tick template:
```javascript
{
position: "left",
ticks: {
callback: function(value) {
var remain = value / (Math.pow(10, Math.floor(Chart.helpers.log10(value))));
if (remain === 1 || remain === 2 || remain === 5) {
return value.toExponential();
} else {
return '';
}
}
}
}
```
### Time Scale
The time scale is used to display times and dates. It can be placed on the x axis. When building its ticks, it will automatically calculate the most comfortable unit base on the size of the scale.
The time scale extends the core scale class with the following tick template:
```javascript
{
position: "bottom",
time: {
// string/callback - By default, date objects are expected. You may use a pattern string from http://momentjs.com/docs/#/parsing/string-format/ to parse a time string format, or use a callback function that is passed the label, and must return a moment() instance.
parser: false,
// string - By default, unit will automatically be detected. Override with 'week', 'month', 'year', etc. (see supported time measurements)
unit: false,
// Number - The number of steps of the above unit between ticks
unitStepSize: 1
// string - By default, no rounding is applied. To round, set to a supported time unit eg. 'week', 'month', 'year', etc.
round: false,
// Moment js for each of the units. Replaces `displayFormat`
// To override, use a pattern string from http://momentjs.com/docs/#/displaying/format/
displayFormats: {
'millisecond': 'SSS [ms]',
'second': 'h:mm:ss a', // 11:20:01 AM
'minute': 'h:mm:ss a', // 11:20:01 AM
'hour': 'MMM D, hA', // Sept 4, 5PM
'day': 'll', // Sep 4 2015
'week': 'll', // Week 46, or maybe "[W]WW - YYYY" ?
'month': 'MMM YYYY', // Sept 2015
'quarter': '[Q]Q - YYYY', // Q3
'year': 'YYYY', // 2015
},
// Sets the display format used in tooltip generation
tooltipFormat: ''
},
}
```
The following time measurements are supported:
```javascript
{
'millisecond': {
display: 'SSS [ms]', // 002 ms
maxStep: 1000,
},
'second': {
display: 'h:mm:ss a', // 11:20:01 AM
maxStep: 60,
},
'minute': {
display: 'h:mm:ss a', // 11:20:01 AM
maxStep: 60,
},
'hour': {
display: 'MMM D, hA', // Sept 4, 5PM
maxStep: 24,
},
'day': {
display: 'll', // Sep 4 2015
maxStep: 7,
},
'week': {
display: 'll', // Week 46, or maybe "[W]WW - YYYY" ?
maxStep: 4.3333,
},
'month': {
display: 'MMM YYYY', // Sept 2015
maxStep: 12,
},
'quarter': {
display: '[Q]Q - YYYY', // Q3
maxStep: 4,
},
'year': {
display: 'YYYY', // 2015
maxStep: false,
},
}
```
### Radial Linear Scale
The radial linear scale is used specifically for the radar chart type.
The radial linear scale extends the core scale class with the following tick template:
```javascript
{
animate: true,
lineArc: false,
position: "chartArea",
angleLines: {
display: true,
color: "rgba(0, 0, 0, 0.1)",
lineWidth: 1
},
// label settings
ticks: {
//Boolean - Show a backdrop to the scale label
showLabelBackdrop: true,
//String - The colour of the label backdrop
backdropColor: "rgba(255,255,255,0.75)",
//Number - The backdrop padding above & below the label in pixels
backdropPaddingY: 2,
//Number - The backdrop padding to the side of the label in pixels
backdropPaddingX: 2,
//Number - Limit the maximum number of ticks and gridlines
maxTicksLimit: 11,
},
pointLabels: {
//String - Point label font declaration
fontFamily: "'Arial'",
//String - Point label font weight
fontStyle: "normal",
//Number - Point label font size in pixels
fontSize: 10,
//String - Point label font colour
fontColor: "#666",
//Function - Used to determine point labels to show in scale
callback: function(pointLabel) {
return pointLabel;
}
},
}
```
-155
Ver Arquivo
@@ -1,155 +0,0 @@
---
title: Line Chart
anchor: line-chart
---
### Introduction
A line chart is a way of plotting data points on a line.
Often, it is used to show trend data, and the comparison of two data sets.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: options
});
```
Alternatively a line chart can be created using syntax similar to the v1.0 syntax
```javascript
var myLineChart = Chart.Line(ctx, {
data: data,
options: options
});
```
### Data structure
```javascript
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
// Boolean - if true fill the area under the line
fill: false,
// String - the color to fill the area under the line with if fill is true
backgroundColor: "rgba(220,220,220,0.2)",
// The properties below allow an array to be specified to change the value of the item at the given index
// String or array - Line color
borderColor: "rgba(220,220,220,1)",
// String - cap style of the line. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap
borderCapStyle: 'butt',
// Array - Length and spacing of dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
borderDash: [],
// Number - Offset for line dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
borderDashOffset: 0.0,
// String - line join style. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin
borderJoinStyle: 'miter',
// String or array - Point stroke color
pointBorderColor: "rgba(220,220,220,1)",
// String or array - Point fill color
pointBackgroundColor: "#fff",
// Number or array - Stroke width of point border
pointBorderWidth: 1,
// Number or array - Radius of point when hovered
pointHoverRadius: 5,
// String or array - point background color when hovered
pointHoverBackgroundColor: "rgba(220,220,220,1)",
// Point border color when hovered
pointHoverBorderColor: "rgba(220,220,220,1)",
// Number or array - border width of point when hovered
pointHoverBorderWidth: 2,
// Tension - bezier curve tension of the line. Set to 0 to draw straight Wlines connecting points
tension: 0.1,
// The actual data
data: [65, 59, 80, 81, 56, 55, 40],
// String - If specified, binds the dataset to a certain y-axis. If not specified, the first y-axis is used. First id is y-axis-0
yAxisID: "y-axis-0",
},
{
label: "My Second dataset",
fill: false,
backgroundColor: "rgba(220,220,220,0.2)",
borderColor: "rgba(220,220,220,1)",
pointBorderColor: "rgba(220,220,220,1)",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(220,220,220,1)",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
```
The line chart requires an array of labels. This labels are shown on the X axis. There must be one label for each data point. More labels than datapoints are allowed, in which case the line ends at the last data point.
The data for line charts is broken up into an array of datasets. Each dataset has a colour for the fill, a colour for the line and colours for the points and strokes of the points. These colours are strings just like CSS. You can use RGBA, RGB, HEX or HSL notation.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart options
These are the customisation options specific to Line charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
The default options for line chart are defined in `Chart.defaults.Line`.
Name | Type | Default | Description
--- | --- | --- | ---
showLines | Boolean | true | If false, the lines between points are not drawn
stacked | Boolean | false | If true, lines stack on top of each other along the y axis.
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset.
scales | - | - | -
*scales*.xAxes | Array | `[{type:"category","id":"x-axis-1"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options.
*Options for xAxes* | | |
type | String | "category" | As defined in ["Category"](#scales-category-scale).
id | String | "x-axis-1" | Id of the axis so that data can bind to it.
| | |
*scales*.yAxes | Array | `[{type:"linear","id":"y-axis-1"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options.
*Options for yAxes* | | |
type | String | "linear" | As defined in ["Linear"](#scales-linear-scale).
id | String | "y-axis-1" | Id of the axis so that data can bind to it.
You can override these for your `Chart` instance by passing a member `options` into the `Line` method.
For example, we could have a line chart display without an x axis by doing the following. The config merge is smart enough to handle arrays so that you do not need to specify all axis settings to change one thing.
```javascript
new Chart(ctx, {
type: 'line',
data: data,
options: {
xAxes: [{
display: false
}]
}
});
// This will create a chart with all of the default options, merged from the global config,
// and the Line chart defaults, but this particular instance will have the x axis not displaying.
```
We can also change these defaults values for each Line type that is created, this object is available at `Chart.defaults.line`.
-155
Ver Arquivo
@@ -1,155 +0,0 @@
---
title: Bar Chart
anchor: bar-chart
---
### Introduction
A bar chart is a way of showing data as bars.
It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
var myBarChart = new Chart(ctx, {
type: 'bar',
data: data,
options: options
});
```
### Data structure
```javascript
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
// The properties below allow an array to be specified to change the value of the item at the given index
// String or array - the bar color
backgroundColor: "rgba(220,220,220,0.2)",
// String or array - bar stroke color
borderColor: "rgba(220,220,220,1)",
// Number or array - bar border width
borderWidth: 1,
// String or array - fill color when hovered
hoverBackgroundColor: "rgba(220,220,220,0.2)",
// String or array - border color when hovered
hoverBorderColor: "rgba(220,220,220,1)",
// The actual data
data: [65, 59, 80, 81, 56, 55, 40],
// String - If specified, binds the dataset to a certain y-axis. If not specified, the first y-axis is used.
yAxisID: "y-axis-0",
},
{
label: "My Second dataset",
backgroundColor: "rgba(220,220,220,0.2)",
borderColor: "rgba(220,220,220,1)",
borderWidth: 1,
hoverBackgroundColor: "rgba(220,220,220,0.2)",
hoverBorderColor: "rgba(220,220,220,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
```
The bar chart has the a very similar data structure to the line chart, and has an array of datasets, each with colours and an array of data. Again, colours are in CSS format.
We have an array of labels too for display. In the example, we are showing the same data as the previous line chart example.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart Options
These are the customisation options specific to Bar charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
The default options for bar chart are defined in `Chart.defaults.Bar`.
Name | Type | Default | Description
--- |:---:| --- | ---
stacked | Boolean | false |
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset.
scales | Array | - | -
*scales*.xAxes | Array | | The bar chart officially supports only 1 x-axis but uses an array to keep the API consistent. Use a scatter chart if you need multiple x axes.
*Options for xAxes* | | |
type | String | "Category" | As defined in [Scales](#scales-category-scale).
display | Boolean | true | If true, show the scale.
position | String | "bottom" | Position of the scale. Options are "top" and "bottom" for dataset scales.
id | String | "x-axis-1" | Id of the axis so that data can bind to it
categoryPercentage | Number | 0.8 | Percent (0-1) of the available width (the space between the gridlines for small datasets) for each data-point to use for the bars. [Read More](#bar-chart-barpercentage-vs-categorypercentage)
barPercentage | Number | 0.9 | Percent (0-1) of the available width each bar should be within the category percentage. 1.0 will take the whole category width and put the bars right next to each other. [Read More](#bar-chart-barpercentage-vs-categorypercentage)
gridLines | Array | [See Scales](#scales) |
*gridLines*.offsetGridLines | Boolean | true | If true, the bars for a particular data point fall between the grid lines. If false, the grid line will go right down the middle of the bars.
scaleLabel | Array | [See Scales](#scales) |
ticks | Array | [See Scales](#scales) |
| | |
*scales*.yAxes | Array | `[{ type: "linear" }]` |
*Options for xAxes* | | |
type | String | "linear" | As defined in [Scales](#scales-linear-scale).
display | Boolean | true | If true, show the scale.
position | String | "left" | Position of the scale. Options are "left" and "right" for dataset scales.
id | String | "y-axis-1" | Id of the axis so that data can bind to it.
gridLines | Array | [See Scales](#scales) |
scaleLabel | Array | [See Scales](#scales) |
ticks | Array | [See Scales](#scales) |
You can override these for your `Chart` instance by passing a second argument into the `Bar` method as an object with the keys you want to override.
For example, we could have a bar chart without a stroke on each bar by doing the following:
```javascript
new Chart(ctx, {
type: "bar",
data: data,
options: {
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true
}]
}
}
}
});
// This will create a chart with all of the default options, merged from the global config,
// and the Bar chart defaults but this particular instance will have `stacked` set to true
// for both x and y axes.
```
We can also change these defaults values for each Bar type that is created, this object is available at `Chart.defaults.Bar`.
#### barPercentage vs categoryPercentage
The following shows the relationship between the bar percentage option and the category percentage option.
```text
// categoryPercentage: 1.0
// barPercentage: 1.0
Bar: | 1.0 | 1.0 |
Category: | 1.0 |
Sample: |===========|
// categoryPercentage: 1.0
// barPercentage: 0.5
Bar: |.5| |.5|
Category: | 1.0 |
Sample: |==============|
// categoryPercentage: 0.5
// barPercentage: 1.0
Bar: |1.||1.|
Category: | .5 |
Sample: |==============|
```
-93
Ver Arquivo
@@ -1,93 +0,0 @@
---
title: Radar Chart
anchor: radar-chart
---
### Introduction
A radar chart is a way of showing multiple data points and the variation between them.
They are often useful for comparing the points of two or more different data sets.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
var myRadarChart = new Chart(ctx, {
type: 'radar',
data: data,
options: options
});
```
### Data structure
```javascript
var data = {
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
datasets: [
{
label: "My First dataset",
backgroundColor: "rgba(220,220,220,0.2)",
borderColor: "rgba(220,220,220,1)",
pointBackgroundColor: "rgba(220,220,220,1)",
pointBorderColor: "#fff",
pointHoverBackgroundColor: "#fff",
pointHoverBorderColor: "rgba(220,220,220,1)",
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: "My Second dataset",
backgroundColor: "rgba(151,187,205,0.2)",
borderColor: "rgba(151,187,205,1)",
pointBackgroundColor: "rgba(151,187,205,1)",
pointBorderColor: "#fff",
pointHoverBackgroundColor: "#fff",
pointHoverBorderColor: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 96, 27, 100]
}
]
};
```
For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart.
For the radar chart data, we have an array of datasets. Each of these is an object, with a fill colour, a stroke colour, a colour for the fill of each point, and a colour for the stroke of each point. We also have an array of data values.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart Options
These are the customisation options specific to Radar charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
The default options for radar chart are defined in `Chart.defaults.radar`.
Name | Type | Default | Description
--- | --- | --- | ---
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#scales-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid lines.
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
*elements*.line | Array | | Options for all line elements used on the chart, as defined in the global elements, duplicated here to show Radar chart specific defaults.
*elements.line*.tension | Number | 0 | Tension exhibited by lines when calculating splineCurve. Setting to 0 creates straight lines.
You can override these for your `Chart` instance by passing a second argument into the `Radar` method as an object with the keys you want to override.
For example, we could have a radar chart without a point for each on piece of data by doing the following:
```javascript
new Chart(ctx, {
type: "radar",
data: data,
options: {
scale: {
reverse: true,
ticks: {
beginAtZero: true
}
}
}
});
// This will create a chart with all of the default options, merged from the global config,
// and the Radar chart defaults but this particular instance's scale will be reversed as
// well as the ticks beginning at zero.
```
We can also change these defaults values for each Radar type that is created, this object is available at `Chart.defaults.radar`.
-91
Ver Arquivo
@@ -1,91 +0,0 @@
---
title: Polar Area Chart
anchor: polar-area-chart
---
### Introduction
Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.
This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
new Chart(ctx, {
data: data,
type: 'polarArea',
options: options
});
```
### Data structure
```javascript
var data = {
datasets: [{
data: [
10,
32,
53,
14,
22,
],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C",
"#949FB1",
"#4D5360",
],
label: 'My dataset' // for legend
}],
labels: [
"Red",
"Green",
"Yellow",
"Grey",
"Dark Grey"
]
};
```
As you can see, for the chart data you pass in an array of objects, with a value and a colour. The value attribute should be a number, while the color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
### Chart options
These are the customisation options specific to Polar Area charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
Name | Type | Default | Description
--- | --- | --- | ---
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#getting-started-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
*scale*.lineArc | Boolean | true | When true, lines are circular.
animateRotate | Boolean |true | If true, will animate the rotation of the chart.
animateScale | Boolean | true | If true, will animate scaling the chart.
*legend*.*labels*.generateLabels | Function | `function(data) {} ` | Returns labels for each the legend
*legend*.onClick | Function | function(event, legendItem) {} ` | Handles clicking an individual legend item
legendCallback | Function | `function(chart) ` | Generates the HTML legend via calls to `generateLegend`
You can override these for your `Chart` instance by passing a second argument into the `PolarArea` method as an object with the keys you want to override.
For example, we could have a polar area chart with a black stroke on each segment like so:
```javascript
new Chart(ctx, {
data: data,
type: "polarArea",
options: {
elements: {
arc: {
borderColor: "#000000"
}
}
}
});
// This will create a chart with all of the default options, merged from the global config,
// and the PolarArea chart defaults but this particular instance will have `elements.arc.borderColor` set to `"#000000"`.
```
We can also change these defaults values for each PolarArea type that is created, this object is available at `Chart.defaults.polarArea`.
-99
Ver Arquivo
@@ -1,99 +0,0 @@
---
title: Pie & Doughnut Charts
anchor: doughnut-pie-chart
---
### Introduction
Pie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data.
They are excellent at showing the relational proportions between data.
Pie and doughnut charts are effectively the same class in Chart.js, but have one different default value - their `percentageInnerCutout`. This equates what percentage of the inner should be cut out. This defaults to `0` for pie charts, and `50` for doughnuts.
They are also registered under two aliases in the `Chart` core. Other than their different default value, and different alias, they are exactly the same.
<div class="canvas-holder half">
<canvas width="250" height="125"></canvas>
</div>
<div class="canvas-holder half">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
// For a pie chart
var myPieChart = new Chart(ctx[0],{
type:'pie',
data: data,
options: options
});
// And for a doughnut chart
var myDoughnutChart = new Chart(ctx[1], {
type:'doughnut',
data: data,
options: options
});
```
### Data structure
```javascript
var data = {
labels: [
"Red",
"Green",
"Yellow"
],
datasets: [
{
data: [300, 50, 100],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C"
],
hoverBackgroundColor: [
"#FF5A5E",
"#5AD3D1",
"#FFC870"
]
}]
};
```
For a pie chart, you must pass in an array of objects with a value and an optional color property. The value attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
### Chart options
These are the customisation options specific to Pie & Doughnut charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
Name | Type | Default | Description
--- | --- | --- | ---
cutoutPercentage | Number | 50 - for doughnut, 0 - for pie | The percentage of the chart that is cut out of the middle.
scale | Array | [See Scales](#scales) and [Defaults for Radial Linear Scale](#getting-started-radial-linear-scale) | Options for the one scale used on the chart. Use this to style the ticks, labels, and grid.
*scale*.type | String |"radialLinear" | As defined in ["Radial Linear"](#scales-radial-linear-scale).
*scale*.lineArc | Boolean | true | When true, lines are arced compared to straight when false.
*animation*.animateRotate | Boolean |true | If true, will animate the rotation of the chart.
*animation*.animateScale | Boolean | false | If true, will animate scaling the Doughnut from the centre.
*legend*.*labels*.generateLabels | Function | `function(data) {} ` | Returns labels for each the legend
*legend*.onClick | Function | function(event, legendItem) {} ` | Handles clicking an individual legend item
You can override these for your `Chart` instance by passing a second argument into the `Doughnut` method as an object with the keys you want to override.
For example, we could have a doughnut chart that animates by scaling out from the centre like so:
```javascript
new Chart(ctx,{
type:"doughnut",
animation:{
animateScale:true
}
});
// This will create a chart with all of the default options, merged from the global config,
// and the Doughnut chart defaults but this particular instance will have `animateScale` set to `true`.
```
We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.Doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.Pie`, with the only difference being `percentageInnerCutout` being set to 0.
-386
Ver Arquivo
@@ -1,386 +0,0 @@
---
title: Advanced usage
anchor: advanced-usage
---
### Prototype methods
For each chart, there are a set of global prototype methods on the shared `ChartType` which you may find useful. These are available on all charts created with Chart.js, but for the examples, let's use a line chart we've made.
```javascript
// For example:
var myLineChart = new Chart(ctx, config);
```
#### .destroy()
Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
This must be called before the canvas is reused for a new chart.
```javascript
// Destroys a specific chart instance
myLineChart.destroy();
```
#### .update(duration, lazy)
Triggers an update of the chart. This can be safely called after replacing the entire data object. This will update all scales, legends, and then re-render the chart.
```javascript
// duration is the time for the animation of the redraw in miliseconds
// lazy is a boolean. if true, the animation can be interupted by other animations
myLineChart.data.datasets[0].data[2] = 50; // Would update the first dataset's value of 'March' to be 50
myLineChart.update(); // Calling update now animates the position of March from 90 to 50.
```
#### .render(duration, lazy)
Triggers a redraw of all chart elements. Note, this does not update elements for new data. Use `.update()` in that case.
```javascript
// duration is the time for the animation of the redraw in miliseconds
// lazy is a boolean. if true, the animation can be interupted by other animations
myLineChart.render(duration, lazy);
```
#### .stop()
Use this to stop any current animation loop. This will pause the chart during any current animation frame. Call `.render()` to re-animate.
```javascript
// Stops the charts animation loop at its current frame
myLineChart.stop();
// => returns 'this' for chainability
```
#### .resize()
Use this to manually resize the canvas element. This is run each time the canvas container is resized, but you can call this method manually if you change the size of the canvas nodes container element.
```javascript
// Resizes & redraws to fill its container element
myLineChart.resize();
// => returns 'this' for chainability
```
#### .clear()
Will clear the chart canvas. Used extensively internally between animation frames, but you might find it useful.
```javascript
// Will clear the canvas that myLineChart is drawn on
myLineChart.clear();
// => returns 'this' for chainability
```
#### .toBase64Image()
This returns a base 64 encoded string of the chart in it's current state.
```javascript
myLineChart.toBase64Image();
// => returns png data url of the image on the canvas
```
#### .generateLegend()
Returns an HTML string of a legend for that chart. The legend is generated from the `legendCallback` in the options.
```javascript
myLineChart.generateLegend();
// => returns HTML string of a legend for this chart
```
#### .getElementAtEvent(e)
Calling `getElementAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the single element at the event position. If there are multiple items within range, only the first is returned
```javascript
myLineChart.getElementAtEvent(e);
// => returns the first element at the event point.
```
#### .getElementsAtEvent(e)
Looks for the element under the event point, then returns all elements at the same data index. This is used internally for 'label' mode highlighting.
Calling `getElementsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the point elements that are at that the same position of that event.
```javascript
canvas.onclick = function(evt){
var activePoints = myLineChart.getElementsAtEvent(evt);
// => activePoints is an array of points on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .getDatasetAtEvent(e)
Looks for the element under the event point, then returns all elements from that dataset. This is used internally for 'dataset' mode highlighting
```javascript
myLineChart.getDatasetAtEvent(e);
// => returns an array of elements
```
### External Tooltips
You can enable custom tooltips in the global or chart configuration like so:
```javascript
var myPieChart = new Chart(ctx, {
type: 'pie',
data: data,
options: {
tooltips: {
custom: function(tooltip) {
// tooltip will be false if tooltip is not visible or should be hidden
if (!tooltip) {
return;
}
// Otherwise, tooltip will be an object with all tooltip properties like:
// tooltip.caretHeight
// tooltip.caretPadding
// tooltip.chart
// tooltip.cornerRadius
// tooltip.fillColor
// tooltip.font...
// tooltip.text
// tooltip.x
// tooltip.y
// etc...
}
}
}
});
```
See `sample/line-customTooltips.html` for examples on how to get started.
### Writing new scale types
Starting with Chart.js 2.0 scales can be individually extended. Scales should always derive from Chart.Scale.
```javascript
var MyScale = Chart.Scale.extend({
/* extensions ... */
});
// MyScale is now derived from Chart.Scale
```
Once you have created your scale class, you need to register it with the global chart object so that it can be used. A default config for the scale may be provided when registering the constructor. The first parameter to the register function is a string key that is used later to identify which scale type to use for a chart.
```javascript
Chart.scaleService.registerScaleType('myScale', MyScale, defaultConfigObject);
```
To use the new scale, simply pass in the string key to the config when creating a chart.
```javascript
var lineChart = new Chart(ctx, {
data: data,
type: 'line',
options: {
scales: {
yAxes: [{
type: 'myScale' // this is the same key that was passed to the registerScaleType function
}]
}
}
})
```
#### Scale Properties
Scale instances are given the following properties during the fitting process.
```javascript
{
left: Number, // left edge of the scale bounding box
right: Number, // right edge of the bounding box'
top: Number,
bottom: Number,
width: Number, // the same as right - left
height: Number, // the same as bottom - top
// Margin on each side. Like css, this is outside the bounding box.
margins: {
left: Number,
right: Number,
top: Number,
bottom: Number,
},
// Amount of padding on the inside of the bounding box (like CSS)
paddingLeft: Number,
paddingRight: Number,
paddingTop: Number,
paddingBottom: Number,
}
```
#### Scale Interface
To work with Chart.js, custom scale types must implement the following interface.
```javascript
{
// Determines the data limits. Should set this.min and this.max to be the data max/min
determineDataLimits: function() {},
// Generate tick marks. this.chart is the chart instance. The data object can be accessed as this.chart.data
// buildTicks() should create a ticks array on the scale instance, if you intend to use any of the implementations from the base class
buildTicks: function() {},
// Get the value to show for the data at the given index of the the given dataset, ie this.chart.data.datasets[datasetIndex].data[index]
getLabelForIndex: function(index, datasetIndex) {},
// Get the pixel (x coordinate for horizontal scale, y coordinate for vertical scales) for a given value
// @param index: index into the ticks array
// @param includeOffset: if true, get the pixel halway between the given tick and the next
getPixelForTick: function(index, includeOffset) {},
// Get the pixel (x coordinate for horizontal scale, y coordinate for vertical scales) for a given value
// @param value : the value to get the pixel for
// @param index : index into the data array of the value
// @param datasetIndex : index of the dataset the value comes from
// @param includeOffset : if true, get the pixel halway between the given tick and the next
getPixelForValue: function(value, index, datasetIndex, includeOffset) {}
}
```
Optionally, the following methods may also be overwritten, but an implementation is already provided by the `Chart.Scale` base class.
```javascript
// Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks);
convertTicksToLabels: function() {},
// Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal.
calculateTickRotation: function() {},
// Fits the scale into the canvas.
// this.maxWidth and this.maxHeight will tell you the maximum dimensions the scale instance can be. Scales should endeavour to be as efficient as possible with canvas space.
// this.margins is the amount of space you have on either side of your scale that you may expand in to. This is used already for calculating the best label rotation
// You must set this.minSize to be the size of your scale. It must be an object containing 2 properties: width and height.
// You must set this.width to be the width and this.height to be the height of the scale
fit: function() {},
// Draws the scale onto the canvas. this.(left|right|top|bottom) will have been populated to tell you the area on the canvas to draw in
// @param chartArea : an object containing four properties: left, right, top, bottom. This is the rectangle that lines, bars, etc will be drawn in. It may be used, for example, to draw grid lines.
draw: function(chartArea) {},
```
The Core.Scale base class also has some utility functions that you may find useful.
```javascript
{
// Returns true if the scale instance is horizontal
isHorizontal: function() {},
// Get the correct value from the value from this.chart.data.datasets[x].data[]
// If dataValue is an object, returns .x or .y depending on the return of isHorizontal()
// If the value is undefined, returns NaN
// Otherwise returns the value.
// Note that in all cases, the returned value is not guaranteed to be a Number
getRightValue: function(dataValue) {},
}
```
### Writing new chart types
Chart.js 2.0 introduces the concept of controllers for each dataset. Like scales, new controllers can be written as needed.
```javascript
Chart.controllers.MyType = Chart.DatasetController.extend({
});
// Now we can create a new instance of our chart, using the Chart.js API
new Chart(ctx, {
// this is the string the constructor was registered at, ie Chart.controllers.MyType
type: 'MyType',
data: data,
options: options
});
```
#### Dataset Controller Interface
Dataset controllers must implement the following interface.
```javascript
{
// Create elements for each piece of data in the dataset. Store elements in an array on the dataset as dataset.metaData
addElements: function() {},
// Create a single element for the data at the given index and reset its state
addElementAndReset: function(index) {},
// Draw the representation of the dataset
// @param ease : if specified, this number represents how far to transition elements. See the implementation of draw() in any of the provided controllers to see how this should be used
draw: function(ease) {},
// Remove hover styling from the given element
removeHoverStyle: function(element) {},
// Add hover styling to the given element
setHoverStyle: function(element) {},
// Update the elements in response to new data
// @param reset : if true, put the elements into a reset state so they can animate to their final values
update: function(reset) {},
}
```
The following methods may optionally be overridden by derived dataset controllers
```javascript
{
// Initializes the controller
initialize: function(chart, datasetIndex) {},
// Ensures that the dataset represented by this controller is linked to a scale. Overridden to helpers.noop in the polar area and doughnut controllers as these
// chart types using a single scale
linkScales: function() {},
// Called by the main chart controller when an update is triggered. The default implementation handles the number of data points changing and creating elements appropriately.
buildOrUpdateElements: function() {}
}
```
### Extending existing chart types
Extending or replacing an existing controller type is easy. Simply replace the constructor for one of the built in types with your own.
The built in controller types are:
* `Chart.controllers.line`
* `Chart.controllers.bar`
* `Chart.controllers.radar`
* `Chart.controllers.doughnut`
* `Chart.controllers.polarArea`
* `Chart.controllers.bubble`
#### Bar Controller
The bar controller has a special property that you should be aware of. To correctly calculate the width of a bar, the controller must determine the number of datasets that map to bars. To do this, the bar controller attaches a property `bar` to the dataset during initialization. If you are creating a replacement or updated bar controller, you should do the same. This will ensure that charts with regular bars and your new derived bars will work seamlessly.
### Building Chart.js
Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file.
Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following:
```bash
npm install
npm install -g gulp
```
This will install the local development dependencies for Chart.js, along with a CLI for the JavaScript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
Now, we can run the `gulp build` task.
```bash
gulp build
```
-42
Ver Arquivo
@@ -1,42 +0,0 @@
---
title: Notes
anchor: notes
---
### Browser support
Browser support for the canvas element is available in all modern & major mobile browsers <a href="http://caniuse.com/canvas" target="_blank">(caniuse.com/canvas)</a>.
For IE8 & below, I would recommend using the polyfill ExplorerCanvas - available at <a href="https://code.google.com/p/explorercanvas/" target="_blank">https://code.google.com/p/explorercanvas/</a>. It falls back to Internet explorer's format VML when canvas support is not available. Example use:
```html
<head>
<!--[if lte IE 8]>
<script src="excanvas.js"></script>
<![endif]-->
</head>
```
Usually I would recommend feature detection to choose whether or not to load a polyfill, rather than IE conditional comments, however in this case, VML is a Microsoft proprietary format, so it will only work in IE.
Some important points to note in my experience using ExplorerCanvas as a fallback.
- Initialise charts on load rather than DOMContentReady when using the library, as sometimes a race condition will occur, and it will result in an error when trying to get the 2d context of a canvas.
- New VML DOM elements are being created for each animation frame and there is no hardware acceleration. As a result animation is usually slow and jerky, with flashing text. It is a good idea to dynamically turn off animation based on canvas support. I recommend using the excellent <a href="http://modernizr.com/" target="_blank">Modernizr</a> to do this.
- When declaring fonts, the library explorercanvas requires the font name to be in single quotes inside the string. For example, instead of your scaleFontFamily property being simply "Arial", explorercanvas support, use "'Arial'" instead. Chart.js does this for default values.
### Bugs & issues
Please report these on the GitHub page - at <a href="https://github.com/nnnick/Chart.js" target="_blank">github.com/nnnick/Chart.js</a>. If you could include a link to a simple <a href="http://jsbin.com/" target="_blank">jsbin</a> or similar to demonstrate the issue, that'd be really helpful.
### Contributing
New contributions to the library are welcome, just a couple of guidelines:
- Tabs for indentation, not spaces please.
- Please ensure you're changing the individual files in `/src`, not the concatenated output in the `Chart.js` file in the root of the repo.
- Please check that your code will pass `jshint` code standards, `gulp jshint` will run this for you.
- Please keep pull requests concise, and document new functionality in the relevant `.md` file.
- Consider whether your changes are useful for all users, or if creating a Chart.js extension would be more appropriate.
### License
Chart.js is open source and available under the <a href="http://opensource.org/licenses/MIT" target="_blank">MIT license</a>.
-228
Ver Arquivo
@@ -1,228 +0,0 @@
---
title: Getting started
anchor: getting-started
---
###Include Chart.js
First we need to include the Chart.js library on the page. The library occupies a global variable of `Chart`.
```html
<script src="Chart.js"></script>
```
Alternatively, if you're using an AMD loader for JavaScript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to its previous owner.
```javascript
// Using requirejs
require(['path/to/Chartjs'], function(Chart){
// Use Chart.js as normal here.
// Chart.noConflict restores the Chart global variable to its previous owner
// The function returns what was previously Chart, allowing you to reassign.
var Chartjs = Chart.noConflict();
});
```
You can also grab Chart.js using bower:
```bash
bower install Chart.js --save
```
or NPM:
```bash
npm install chart.js --save
```
Also, Chart.js is available from CDN:
https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js
###Creating a chart
To create a chart, we need to instantiate the `Chart` class. To do this, we need to pass in the 2d context of where we want to draw the chart. Here's an example.
```html
<canvas id="myChart" width="400" height="400"></canvas>
```
```javascript
// Get the context of the canvas element we want to select
var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).PolarArea(data);
```
We can also get the context of our canvas with jQuery. To do this, we need to get the DOM node out of the jQuery collection, and call the `getContext("2d")` method on that.
```javascript
// Get context with jQuery - using jQuery's .get() method.
var ctx = $("#myChart").get(0).getContext("2d");
// This will get the first returned node in the jQuery collection.
var myNewChart = new Chart(ctx);
```
After we've instantiated the Chart class on the canvas we want to draw on, Chart.js will handle the scaling for retina displays.
With the Chart class set up, we can go on to create one of the charts Chart.js has available. In the example below, we would be drawing a Polar area chart.
```javascript
new Chart(ctx).PolarArea(data, options);
```
We call a method of the name of the chart we want to create. We pass in the data for that chart type, and the options for that chart as parameters. Chart.js will merge the global defaults with chart type specific defaults, then merge any options passed in as a second argument after data.
###Global chart configuration
This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
Templates are based on micro templating by John Resig:
http://ejohn.org/blog/javascript-micro-templating/
```javascript
Chart.defaults.global = {
// Boolean - Whether to animate the chart
animation: true,
// Number - Number of animation steps
animationSteps: 60,
// String - Animation easing effect
// Possible effects are:
// [easeInOutQuart, linear, easeOutBounce, easeInBack, easeInOutQuad,
// easeOutQuart, easeOutQuad, easeInOutBounce, easeOutSine, easeInOutCubic,
// easeInExpo, easeInOutBack, easeInCirc, easeInOutElastic, easeOutBack,
// easeInQuad, easeInOutExpo, easeInQuart, easeOutQuint, easeInOutCirc,
// easeInSine, easeOutExpo, easeOutCirc, easeOutCubic, easeInQuint,
// easeInElastic, easeInOutSine, easeInOutQuint, easeInBounce,
// easeOutElastic, easeInCubic]
animationEasing: "easeOutQuart",
// Boolean - If we should show the scale at all
showScale: true,
// Boolean - If we want to override with a hard coded scale
scaleOverride: false,
// ** Required if scaleOverride is true **
// Number - The number of steps in a hard coded scale
scaleSteps: null,
// Number - The value jump in the hard coded scale
scaleStepWidth: null,
// Number - The scale starting value
scaleStartValue: null,
// String - Colour of the scale line
scaleLineColor: "rgba(0,0,0,.1)",
// Number - Pixel width of the scale line
scaleLineWidth: 1,
// Boolean - Whether to show labels on the scale
scaleShowLabels: true,
// Interpolated JS string - can access value
scaleLabel: "<%=value%>",
// Boolean - Whether the scale should stick to integers, not floats even if drawing space is there
scaleIntegersOnly: true,
// Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
scaleBeginAtZero: false,
// String - Scale label font declaration for the scale label
scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
// Number - Scale label font size in pixels
scaleFontSize: 12,
// String - Scale label font weight style
scaleFontStyle: "normal",
// String - Scale label font colour
scaleFontColor: "#666",
// Boolean - whether or not the chart should be responsive and resize when the browser does.
responsive: false,
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
maintainAspectRatio: true,
// Boolean - Determines whether to draw tooltips on the canvas or not
showTooltips: true,
// Function - Determines whether to execute the customTooltips function instead of drawing the built in tooltips (See [Advanced - External Tooltips](#advanced-usage-external-tooltips))
customTooltips: false,
// Array - Array of string names to attach tooltip events
tooltipEvents: ["mousemove", "touchstart", "touchmove"],
// String - Tooltip background colour
tooltipFillColor: "rgba(0,0,0,0.8)",
// String - Tooltip label font declaration for the scale label
tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
// Number - Tooltip label font size in pixels
tooltipFontSize: 14,
// String - Tooltip font weight style
tooltipFontStyle: "normal",
// String - Tooltip label font colour
tooltipFontColor: "#fff",
// String - Tooltip title font declaration for the scale label
tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
// Number - Tooltip title font size in pixels
tooltipTitleFontSize: 14,
// String - Tooltip title font weight style
tooltipTitleFontStyle: "bold",
// String - Tooltip title font colour
tooltipTitleFontColor: "#fff",
// String - Tooltip title template
tooltipTitleTemplate: "<%= label%>",
// Number - pixel width of padding around tooltip text
tooltipYPadding: 6,
// Number - pixel width of padding around tooltip text
tooltipXPadding: 6,
// Number - Size of the caret on the tooltip
tooltipCaretSize: 8,
// Number - Pixel radius of the tooltip border
tooltipCornerRadius: 6,
// Number - Pixel offset from point x to tooltip edge
tooltipXOffset: 10,
{% raw %}
// String - Template string for single tooltips
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
{% endraw %}
// String - Template string for multiple tooltips
multiTooltipTemplate: "<%= value %>",
// Function - Will fire on animation progression.
onAnimationProgress: function(){},
// Function - Will fire on animation completion.
onAnimationComplete: function(){}
}
```
If for example, you wanted all charts created to be responsive, and resize when the browser window does, the following setting can be changed:
```javascript
Chart.defaults.global.responsive = true;
```
Now, every time we create a chart, `options.responsive` will be `true`.
-169
Ver Arquivo
@@ -1,169 +0,0 @@
---
title: Line Chart
anchor: line-chart
---
###Introduction
A line chart is a way of plotting data points on a line.
Often, it is used to show trend data, and the comparison of two data sets.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
###Example usage
```javascript
var myLineChart = new Chart(ctx).Line(data, options);
```
###Data structure
```javascript
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
```
The line chart requires an array of labels for each of the data points. This is shown on the X axis.
The data for line charts is broken up into an array of datasets. Each dataset has a colour for the fill, a colour for the line and colours for the points and strokes of the points. These colours are strings just like CSS. You can use RGBA, RGB, HEX or HSL notation.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart options
These are the customisation options specific to Line charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
```javascript
{
///Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - Whether the line is curved between points
bezierCurve : true,
//Number - Tension of the bezier curve between points
bezierCurveTension : 0.4,
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 4,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
pointHitDetectionRadius : 20,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
//Boolean - Whether to horizontally center the label and point dot inside the grid
offsetGridLines : false
};
```
You can override these for your `Chart` instance by passing a second argument into the `Line` method as an object with the keys you want to override.
For example, we could have a line chart without bezier curves between points by doing the following:
```javascript
new Chart(ctx).Line(data, {
bezierCurve: false
});
// This will create a chart with all of the default options, merged from the global config,
// and the Line chart defaults, but this particular instance will have `bezierCurve` set to false.
```
We can also change these defaults values for each Line type that is created, this object is available at `Chart.defaults.Line`.
### Prototype methods
#### .getPointsAtEvent( event )
Calling `getPointsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the point elements that are at that the same position of that event.
```javascript
canvas.onclick = function(evt){
var activePoints = myLineChart.getPointsAtEvent(evt);
// => activePoints is an array of points on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .update( )
Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
```javascript
myLineChart.datasets[0].points[2].value = 50;
// Would update the first dataset's value of 'March' to be 50
myLineChart.update();
// Calling update now animates the position of March from 90 to 50.
```
#### .addData( valuesArray, label )
Calling `addData(valuesArray, label)` on your Chart instance passing an array of values for each dataset, along with a label for those points.
```javascript
// The values array passed into addData should be one for each dataset in the chart
myLineChart.addData([40, 60], "August");
// This new data will now animate at the end of the chart.
```
#### .removeData( )
Calling `removeData()` on your Chart instance will remove the first value for all datasets on the chart.
```javascript
myLineChart.removeData();
// The chart will remove the first point and animate other points into place
```
-149
Ver Arquivo
@@ -1,149 +0,0 @@
---
title: Bar Chart
anchor: bar-chart
---
### Introduction
A bar chart is a way of showing data as bars.
It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
var myBarChart = new Chart(ctx).Bar(data, options);
```
### Data structure
```javascript
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.5)",
strokeColor: "rgba(220,220,220,0.8)",
highlightFill: "rgba(220,220,220,0.75)",
highlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.5)",
strokeColor: "rgba(151,187,205,0.8)",
highlightFill: "rgba(151,187,205,0.75)",
highlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
```
The bar chart has the a very similar data structure to the line chart, and has an array of datasets, each with colours and an array of data. Again, colours are in CSS format.
We have an array of labels too for display. In the example, we are showing the same data as the previous line chart example.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart Options
These are the customisation options specific to Bar charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
```javascript
{
//Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
scaleBeginAtZero : true,
//Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
//Number - Pixel width of the bar stroke
barStrokeWidth : 2,
//Number - Spacing between each of the X value sets
barValueSpacing : 5,
//Number - Spacing between data sets within X values
barDatasetSpacing : 1,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
You can override these for your `Chart` instance by passing a second argument into the `Bar` method as an object with the keys you want to override.
For example, we could have a bar chart without a stroke on each bar by doing the following:
```javascript
new Chart(ctx).Bar(data, {
barShowStroke: false
});
// This will create a chart with all of the default options, merged from the global config,
// and the Bar chart defaults but this particular instance will have `barShowStroke` set to false.
```
We can also change these defaults values for each Bar type that is created, this object is available at `Chart.defaults.Bar`.
### Prototype methods
#### .getBarsAtEvent( event )
Calling `getBarsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the bar elements that are at that the same position of that event.
```javascript
canvas.onclick = function(evt){
var activeBars = myBarChart.getBarsAtEvent(evt);
// => activeBars is an array of bars on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .update( )
Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
```javascript
myBarChart.datasets[0].bars[2].value = 50;
// Would update the first dataset's value of 'March' to be 50
myBarChart.update();
// Calling update now animates the position of March from 90 to 50.
```
#### .addData( valuesArray, label )
Calling `addData(valuesArray, label)` on your Chart instance passing an array of values for each dataset, along with a label for those bars.
```javascript
// The values array passed into addData should be one for each dataset in the chart
myBarChart.addData([40, 60], "August");
// The new data will now animate at the end of the chart.
```
#### .removeData( )
Calling `removeData()` on your Chart instance will remove the first value for all datasets on the chart.
```javascript
myBarChart.removeData();
// The chart will now animate and remove the first bar
```
-177
Ver Arquivo
@@ -1,177 +0,0 @@
---
title: Radar Chart
anchor: radar-chart
---
###Introduction
A radar chart is a way of showing multiple data points and the variation between them.
They are often useful for comparing the points of two or more different data sets.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
###Example usage
```javascript
var myRadarChart = new Chart(ctx).Radar(data, options);
```
###Data structure
```javascript
var data = {
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 96, 27, 100]
}
]
};
```
For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart.
For the radar chart data, we have an array of datasets. Each of these is an object, with a fill colour, a stroke colour, a colour for the fill of each point, and a colour for the stroke of each point. We also have an array of data values.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
### Chart options
These are the customisation options specific to Radar charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
```javascript
{
//Boolean - Whether to show lines for each scale point
scaleShowLine : true,
//Boolean - Whether we show the angle lines out of the radar
angleShowLineOut : true,
//Boolean - Whether to show labels on the scale
scaleShowLabels : false,
// Boolean - Whether the scale should begin at zero
scaleBeginAtZero : true,
//String - Colour of the angle line
angleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the angle line
angleLineWidth : 1,
//String - Point label font declaration
pointLabelFontFamily : "'Arial'",
//String - Point label font weight
pointLabelFontStyle : "normal",
//Number - Point label font size in pixels
pointLabelFontSize : 10,
//String - Point label font colour
pointLabelFontColor : "#666",
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 3,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
pointHitDetectionRadius : 20,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
You can override these for your `Chart` instance by passing a second argument into the `Radar` method as an object with the keys you want to override.
For example, we could have a radar chart without a point for each on piece of data by doing the following:
```javascript
new Chart(ctx).Radar(data, {
pointDot: false
});
// This will create a chart with all of the default options, merged from the global config,
// and the Bar chart defaults but this particular instance will have `pointDot` set to false.
```
We can also change these defaults values for each Radar type that is created, this object is available at `Chart.defaults.Radar`.
### Prototype methods
#### .getPointsAtEvent( event )
Calling `getPointsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the point elements that are at that the same position of that event.
```javascript
canvas.onclick = function(evt){
var activePoints = myRadarChart.getPointsAtEvent(evt);
// => activePoints is an array of points on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .update( )
Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
```javascript
myRadarChart.datasets[0].points[2].value = 50;
// Would update the first dataset's value of 'Sleeping' to be 50
myRadarChart.update();
// Calling update now animates the position of Sleeping from 90 to 50.
```
#### .addData( valuesArray, label )
Calling `addData(valuesArray, label)` on your Chart instance passing an array of values for each dataset, along with a label for those points.
```javascript
// The values array passed into addData should be one for each dataset in the chart
myRadarChart.addData([40, 60], "Dancing");
// The new data will now animate at the end of the chart.
```
#### .removeData( )
Calling `removeData()` on your Chart instance will remove the first value for all datasets on the chart.
```javascript
myRadarChart.removeData();
// Other points will now animate to their correct positions.
```
-172
Ver Arquivo
@@ -1,172 +0,0 @@
---
title: Polar Area Chart
anchor: polar-area-chart
---
### Introduction
Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.
This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.
<div class="canvas-holder">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
new Chart(ctx).PolarArea(data, options);
```
### Data structure
```javascript
var data = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
},
{
value: 40,
color: "#949FB1",
highlight: "#A8B3C5",
label: "Grey"
},
{
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}
];
```
As you can see, for the chart data you pass in an array of objects, with a value and a colour. The value attribute should be a number, while the color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
### Chart options
These are the customisation options specific to Polar Area charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
```javascript
{
//Boolean - Show a backdrop to the scale label
scaleShowLabelBackdrop : true,
//String - The colour of the label backdrop
scaleBackdropColor : "rgba(255,255,255,0.75)",
// Boolean - Whether the scale should begin at zero
scaleBeginAtZero : true,
//Number - The backdrop padding above & below the label in pixels
scaleBackdropPaddingY : 2,
//Number - The backdrop padding to the side of the label in pixels
scaleBackdropPaddingX : 2,
//Boolean - Show line for each value in the scale
scaleShowLine : true,
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segment.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
segmentStrokeWidth : 2,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect.
animationEasing : "easeOutBounce",
//Boolean - Whether to animate the rotation of the chart
animateRotate : true,
//Boolean - Whether to animate scaling the chart from the centre
animateScale : false,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
You can override these for your `Chart` instance by passing a second argument into the `PolarArea` method as an object with the keys you want to override.
For example, we could have a polar area chart with a black stroke on each segment like so:
```javascript
new Chart(ctx).PolarArea(data, {
segmentStrokeColor: "#000000"
});
// This will create a chart with all of the default options, merged from the global config,
// and the PolarArea chart defaults but this particular instance will have `segmentStrokeColor` set to `"#000000"`.
```
We can also change these defaults values for each PolarArea type that is created, this object is available at `Chart.defaults.PolarArea`.
### Prototype methods
#### .getSegmentsAtEvent( event )
Calling `getSegmentsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the segment elements that are at that the same position of that event.
```javascript
canvas.onclick = function(evt){
var activePoints = myPolarAreaChart.getSegmentsAtEvent(evt);
// => activePoints is an array of segments on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .update( )
Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
```javascript
myPolarAreaChart.segments[1].value = 10;
// Would update the first dataset's value of 'Green' to be 10
myPolarAreaChart.update();
// Calling update now animates the position of Green from 50 to 10.
```
#### .addData( segmentData, index )
Calling `addData(segmentData, index)` on your Chart instance passing an object in the same format as in the constructor. There is an option second argument of 'index', this determines at what index the new segment should be inserted into the chart.
```javascript
// An object in the same format as the original data source
myPolarAreaChart.addData({
value: 130,
color: "#B48EAD",
highlight: "#C69CBE",
label: "Purple"
});
// The new segment will now animate in.
```
#### .removeData( index )
Calling `removeData(index)` on your Chart instance will remove segment at that particular index. If none is provided, it will default to the last segment.
```javascript
myPolarAreaChart.removeData();
// Other segments will update to fill the empty space left.
```
-158
Ver Arquivo
@@ -1,158 +0,0 @@
---
title: Pie & Doughnut Charts
anchor: doughnut-pie-chart
---
###Introduction
Pie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data.
They are excellent at showing the relational proportions between data.
Pie and doughnut charts are effectively the same class in Chart.js, but have one different default value - their `percentageInnerCutout`. This equates what percentage of the inner should be cut out. This defaults to `0` for pie charts, and `50` for doughnuts.
They are also registered under two aliases in the `Chart` core. Other than their different default value, and different alias, they are exactly the same.
<div class="canvas-holder half">
<canvas width="250" height="125"></canvas>
</div>
<div class="canvas-holder half">
<canvas width="250" height="125"></canvas>
</div>
### Example usage
```javascript
// For a pie chart
var myPieChart = new Chart(ctx[0]).Pie(data,options);
// And for a doughnut chart
var myDoughnutChart = new Chart(ctx[1]).Doughnut(data,options);
```
### Data structure
```javascript
var data = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
]
```
For a pie chart, you must pass in an array of objects with a value and an optional color property. The value attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
### Chart options
These are the customisation options specific to Pie & Doughnut charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
```javascript
{
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke : true,
//String - The colour of each segment stroke
segmentStrokeColor : "#fff",
//Number - The width of each segment stroke
segmentStrokeWidth : 2,
//Number - The percentage of the chart that we cut out of the middle
percentageInnerCutout : 50, // This is 0 for Pie charts
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect
animationEasing : "easeOutBounce",
//Boolean - Whether we animate the rotation of the Doughnut
animateRotate : true,
//Boolean - Whether we animate scaling the Doughnut from the centre
animateScale : false,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
You can override these for your `Chart` instance by passing a second argument into the `Doughnut` method as an object with the keys you want to override.
For example, we could have a doughnut chart that animates by scaling out from the centre like so:
```javascript
new Chart(ctx).Doughnut(data, {
animateScale: true
});
// This will create a chart with all of the default options, merged from the global config,
// and the Doughnut chart defaults but this particular instance will have `animateScale` set to `true`.
```
We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.Doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.Pie`, with the only difference being `percentageInnerCutout` being set to 0.
### Prototype methods
#### .getSegmentsAtEvent( event )
Calling `getSegmentsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the segment elements that are at the same position of that event.
```javascript
canvas.onclick = function(evt){
var activePoints = myDoughnutChart.getSegmentsAtEvent(evt);
// => activePoints is an array of segments on the canvas that are at the same position as the click event.
};
```
This functionality may be useful for implementing DOM based tooltips, or triggering custom behaviour in your application.
#### .update( )
Calling `update()` on your Chart instance will re-render the chart with any updated values, allowing you to edit the value of multiple existing points, then render those in one animated render loop.
```javascript
myDoughnutChart.segments[1].value = 10;
// Would update the first dataset's value of 'Green' to be 10
myDoughnutChart.update();
// Calling update now animates the circumference of the segment 'Green' from 50 to 10.
// and transitions other segment widths
```
#### .addData( segmentData, index )
Calling `addData(segmentData, index)` on your Chart instance passing an object in the same format as in the constructor. There is an optional second argument of 'index', this determines at what index the new segment should be inserted into the chart.
```javascript
// An object in the same format as the original data source
myDoughnutChart.addData({
value: 130,
color: "#B48EAD",
highlight: "#C69CBE",
label: "Purple"
});
// The new segment will now animate in.
```
#### .removeData( index )
Calling `removeData(index)` on your Chart instance will remove segment at that particular index. If none is provided, it will default to the last segment.
```javascript
myDoughnutChart.removeData();
// Other segments will update to fill the empty space left.
```
-187
Ver Arquivo
@@ -1,187 +0,0 @@
---
title: Advanced usage
anchor: advanced-usage
---
### Prototype methods
For each chart, there are a set of global prototype methods on the shared `ChartType` which you may find useful. These are available on all charts created with Chart.js, but for the examples, let's use a line chart we've made.
```javascript
// For example:
var myLineChart = new Chart(ctx).Line(data);
```
#### .clear()
Will clear the chart canvas. Used extensively internally between animation frames, but you might find it useful.
```javascript
// Will clear the canvas that myLineChart is drawn on
myLineChart.clear();
// => returns 'this' for chainability
```
#### .stop()
Use this to stop any current animation loop. This will pause the chart during any current animation frame. Call `.render()` to re-animate.
```javascript
// Stops the charts animation loop at its current frame
myLineChart.stop();
// => returns 'this' for chainability
```
#### .resize()
Use this to manually resize the canvas element. This is run each time the browser is resized, but you can call this method manually if you change the size of the canvas nodes container element.
```javascript
// Resizes & redraws to fill its container element
myLineChart.resize();
// => returns 'this' for chainability
```
#### .destroy()
Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
```javascript
// Destroys a specific chart instance
myLineChart.destroy();
```
#### .toBase64Image()
This returns a base 64 encoded string of the chart in its current state.
```javascript
myLineChart.toBase64Image();
// => returns png data url of the image on the canvas
```
#### .generateLegend()
Returns an HTML string of a legend for that chart. The template for this legend is at `legendTemplate` in the chart options.
```javascript
myLineChart.generateLegend();
// => returns HTML string of a legend for this chart
```
### External Tooltips
You can enable custom tooltips in the global or chart configuration like so:
```javascript
var myPieChart = new Chart(ctx).Pie(data, {
customTooltips: function(tooltip) {
// tooltip will be false if tooltip is not visible or should be hidden
if (!tooltip) {
return;
}
// Otherwise, tooltip will be an object with all tooltip properties like:
// tooltip.caretHeight
// tooltip.caretPadding
// tooltip.chart
// tooltip.cornerRadius
// tooltip.fillColor
// tooltip.font...
// tooltip.text
// tooltip.x
// tooltip.y
// etc...
};
});
```
See files `sample/pie-customTooltips.html` and `sample/line-customTooltips.html` for examples on how to get started.
### Writing new chart types
Chart.js 1.0 has been rewritten to provide a platform for developers to create their own custom chart types, and be able to share and utilise them through the Chart.js API.
The format is relatively simple, there are a set of utility helper methods under `Chart.helpers`, including things such as looping over collections, requesting animation frames, and easing equations.
On top of this, there are also some simple base classes of Chart elements, these all extend from `Chart.Element`, and include things such as points, bars and scales.
```javascript
Chart.Type.extend({
// Passing in a name registers this chart in the Chart namespace
name: "Scatter",
// Providing a defaults will also register the deafults in the chart namespace
defaults : {
options: "Here",
available: "at this.options"
},
// Initialize is fired when the chart is initialized - Data is passed in as a parameter
// Config is automatically merged by the core of Chart.js, and is available at this.options
initialize: function(data){
this.chart.ctx // The drawing context for this chart
this.chart.canvas // the canvas node for this chart
},
// Used to draw something on the canvas
draw: function() {
}
});
// Now we can create a new instance of our chart, using the Chart.js API
new Chart(ctx).Scatter(data);
// initialize is now run
```
### Extending existing chart types
We can also extend existing chart types, and expose them to the API in the same way. Let's say for example, we might want to run some more code when we initialize every Line chart.
```javascript
// Notice now we're extending the particular Line chart type, rather than the base class.
Chart.types.Line.extend({
// Passing in a name registers this chart in the Chart namespace in the same way
name: "LineAlt",
initialize: function(data){
console.log('My Line chart extension');
Chart.types.Line.prototype.initialize.apply(this, arguments);
}
});
// Creates a line chart in the same way
new Chart(ctx).LineAlt(data);
// but this logs 'My Line chart extension' in the console.
```
### Community extensions
- <a href="https://github.com/Regaddi/Chart.StackedBar.js" target="_blank">Stacked Bar Chart</a> by <a href="https://twitter.com/Regaddi" target="_blank">@Regaddi</a>
- <a href="https://github.com/tannerlinsley/Chart.StackedArea.js" target="_blank">Stacked Bar Chart</a> by <a href="https://twitter.com/tannerlinsley" target="_blank">@tannerlinsley</a>
- <a href="https://github.com/CAYdenberg/Chart.js" target="_blank">Error bars (bar and line charts)</a> by <a href="https://twitter.com/CAYdenberg" target="_blank">@CAYdenberg</a>
- <a href="http://dima117.github.io/Chart.Scatter/" target="_blank">Scatter chart (number & date scales are supported)</a> by <a href="https://github.com/dima117" target="_blank">@dima117</a>
### Creating custom builds
Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file. We can use this same build script with custom parameters in order to build a custom version.
Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following:
```bash
npm install
npm install -g gulp
```
This will install the local development dependencies for Chart.js, along with a CLI for the JavaScript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
Now, we can run the `gulp build` task, and pass in a comma-separated list of types as an argument to build a custom version of Chart.js with only specified chart types.
Here we will create a version of Chart.js with only Line, Radar and Bar charts included:
```bash
gulp build --types=Line,Radar,Bar
```
This will output to the `/custom` directory, and write two files, Chart.js, and Chart.min.js with only those chart types included.
-42
Ver Arquivo
@@ -1,42 +0,0 @@
---
title: Notes
anchor: notes
---
### Browser support
Browser support for the canvas element is available in all modern & major mobile browsers <a href="http://caniuse.com/canvas" target="_blank">(caniuse.com/canvas)</a>.
For IE8 & below, I would recommend using the polyfill ExplorerCanvas - available at <a href="https://code.google.com/p/explorercanvas/" target="_blank">https://code.google.com/p/explorercanvas/</a>. It falls back to Internet explorer's format VML when canvas support is not available. Example use:
```html
<head>
<!--[if lte IE 8]>
<script src="excanvas.js"></script>
<![endif]-->
</head>
```
Usually I would recommend feature detection to choose whether or not to load a polyfill, rather than IE conditional comments, however in this case, VML is a Microsoft proprietary format, so it will only work in IE.
Some important points to note in my experience using ExplorerCanvas as a fallback.
- Initialise charts on load rather than DOMContentReady when using the library, as sometimes a race condition will occur, and it will result in an error when trying to get the 2d context of a canvas.
- New VML DOM elements are being created for each animation frame and there is no hardware acceleration. As a result animation is usually slow and jerky, with flashing text. It is a good idea to dynamically turn off animation based on canvas support. I recommend using the excellent <a href="http://modernizr.com/" target="_blank">Modernizr</a> to do this.
- When declaring fonts, the library explorercanvas requires the font name to be in single quotes inside the string. For example, instead of your scaleFontFamily property being simply "Arial", explorercanvas support, use "'Arial'" instead. Chart.js does this for default values.
### Bugs & issues
Please report these on the GitHub page - at <a href="https://github.com/nnnick/Chart.js" target="_blank">github.com/nnnick/Chart.js</a>. If you could include a link to a simple <a href="http://jsbin.com/" target="_blank">jsbin</a> or similar to demonstrate the issue, that'd be really helpful.
### Contributing
New contributions to the library are welcome, just a couple of guidelines:
- Tabs for indentation, not spaces please.
- Please ensure you're changing the individual files in `/src`, not the concatenated output in the `Chart.js` file in the root of the repo.
- Please check that your code will pass `jshint` code standards, `gulp jshint` will run this for you.
- Please keep pull requests concise, and document new functionality in the relevant `.md` file.
- Consider whether your changes are useful for all users, or if creating a Chart.js extension would be more appropriate.
### License
Chart.js is open source and available under the <a href="http://opensource.org/licenses/MIT" target="_blank">MIT license</a>.
-11
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
-673
Ver Arquivo
@@ -1,673 +0,0 @@
* {
padding: 0;
margin: 0;
color: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
position: relative;
font-family: "proxima-nova", 'Helvetica Neue', 'Helvetica', 'sans-serif';
color: #232830;
}
lesshat-selector {
-lh-property: 0; }
::selection{color: #dfe1e8; background: #5b90bf}
::-moz-selection{color: #dfe1e8; background: #5b90bf;
}
.hll {
background-color: #ffffcc;
}
.c {
color: #999988;
font-style: italic;
}
/* Comment */
.err {
color: #a61717;
background-color: #e3d2d2;
}
/* Error */
.k {
color: #000000;
font-weight: bold;
}
/* Keyword */
.o {
color: #000000;
font-weight: bold;
}
/* Operator */
.cm {
color: #999988;
font-style: italic;
}
/* Comment.Multiline */
.cp {
color: #999999;
font-weight: bold;
font-style: italic;
}
/* Comment.Preproc */
.c1 {
color: #999988;
font-style: italic;
}
/* Comment.Single */
.cs {
color: #999999;
font-weight: bold;
font-style: italic;
}
/* Comment.Special */
.gd {
color: #000000;
background-color: #ffdddd;
}
/* Generic.Deleted */
.ge {
color: #000000;
font-style: italic;
}
/* Generic.Emph */
.gr {
color: #aa0000;
}
/* Generic.Error */
.gh {
color: #999999;
}
/* Generic.Heading */
.gi {
color: #000000;
background-color: #ddffdd;
}
/* Generic.Inserted */
.go {
color: #888888;
}
/* Generic.Output */
.gp {
color: #555555;
}
/* Generic.Prompt */
.gs {
font-weight: bold;
}
/* Generic.Strong */
.gu {
color: #aaaaaa;
}
/* Generic.Subheading */
.gt {
color: #aa0000;
}
/* Generic.Traceback */
.kc {
color: #000000;
font-weight: bold;
}
/* Keyword.Constant */
.kd {
color: #000000;
font-weight: bold;
}
/* Keyword.Declaration */
.kn {
color: #000000;
font-weight: bold;
}
/* Keyword.Namespace */
.kp {
color: #000000;
font-weight: bold;
}
/* Keyword.Pseudo */
.kr {
color: #000000;
font-weight: bold;
}
/* Keyword.Reserved */
.kt {
color: #445588;
font-weight: bold;
}
/* Keyword.Type */
.m {
color: #009999;
}
/* Literal.Number */
.s {
color: #d01040;
}
/* Literal.String */
.na {
color: #008080;
}
/* Name.Attribute */
.nb {
color: #0086b3;
}
/* Name.Builtin */
.nc {
color: #445588;
font-weight: bold;
}
/* Name.Class */
.no {
color: #008080;
}
/* Name.Constant */
.nd {
color: #3c5d5d;
font-weight: bold;
}
/* Name.Decorator */
.ni {
color: #800080;
}
/* Name.Entity */
.ne {
color: #990000;
font-weight: bold;
}
/* Name.Exception */
.nf {
color: #990000;
font-weight: bold;
}
/* Name.Function */
.nl {
color: #990000;
font-weight: bold;
}
/* Name.Label */
.nn {
color: #555555;
}
/* Name.Namespace */
.nt {
color: #000080;
}
/* Name.Tag */
.nv {
color: #008080;
}
/* Name.Variable */
.ow {
color: #000000;
font-weight: bold;
}
/* Operator.Word */
.w {
color: #bbbbbb;
}
/* Text.Whitespace */
.mf {
color: #009999;
}
/* Literal.Number.Float */
.mh {
color: #009999;
}
/* Literal.Number.Hex */
.mi {
color: #009999;
}
/* Literal.Number.Integer */
.mo {
color: #009999;
}
/* Literal.Number.Oct */
.sb {
color: #d01040;
}
/* Literal.String.Backtick */
.sc {
color: #d01040;
}
/* Literal.String.Char */
.sd {
color: #d01040;
}
/* Literal.String.Doc */
.s2 {
color: #d01040;
}
/* Literal.String.Double */
.se {
color: #d01040;
}
/* Literal.String.Escape */
.sh {
color: #d01040;
}
/* Literal.String.Heredoc */
.si {
color: #d01040;
}
/* Literal.String.Interpol */
.sx {
color: #d01040;
}
/* Literal.String.Other */
.sr {
color: #009926;
}
/* Literal.String.Regex */
.s1 {
color: #d01040;
}
/* Literal.String.Single */
.ss {
color: #990073;
}
/* Literal.String.Symbol */
.bp {
color: #999999;
}
/* Name.Builtin.Pseudo */
.vc {
color: #008080;
}
/* Name.Variable.Class */
.vg {
color: #008080;
}
/* Name.Variable.Global */
.vi {
color: #008080;
}
/* Name.Variable.Instance */
.il {
color: #009999;
}
/* Literal.Number.Integer.Long */
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-top{ 0%{ -webkit-transform: translate3d(0,0,0) rotate(0); } 50%{ -webkit-transform: translate3d(0,8px,0) rotate(0); } 100%{ -webkit-transform: translate3d(0,8px,0) rotate(45deg); }}
@-moz-keyframes hamburger-top{ 0%{ -moz-transform: translate3d(0,0,0) rotate(0); } 50%{ -moz-transform: translate3d(0,8px,0) rotate(0); } 100%{ -moz-transform: translate3d(0,8px,0) rotate(45deg); }}
@-o-keyframes hamburger-top{ 0%{ -o-transform: translate3d(0,0,0) rotate(0); } 50%{ -o-transform: translate3d(0,8px,0) rotate(0); } 100%{ -o-transform: translate3d(0,8px,0) rotate(45deg); }}
@keyframes hamburger-top{ 0%{-webkit-transform: translate3d(0,0,0) rotate(0);-moz-transform: translate3d(0,0,0) rotate(0);-ms-transform: translate3d(0,0,0) rotate(0);transform: translate3d(0,0,0) rotate(0); } 50%{-webkit-transform: translate3d(0,8px,0) rotate(0);-moz-transform: translate3d(0,8px,0) rotate(0);-ms-transform: translate3d(0,8px,0) rotate(0);transform: translate3d(0,8px,0) rotate(0); } 100%{-webkit-transform: translate3d(0,8px,0) rotate(45deg);-moz-transform: translate3d(0,8px,0) rotate(45deg);-ms-transform: translate3d(0,8px,0) rotate(45deg);transform: translate3d(0,8px,0) rotate(45deg); }
}
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-middle{ 0%{ opacity:1; } 50%{ opacity: 1; } 51%{ opacity:0; } 100%{ opacity:0; }}
@-moz-keyframes hamburger-middle{ 0%{ opacity:1; } 50%{ opacity: 1; } 51%{ opacity:0; } 100%{ opacity:0; }}
@-o-keyframes hamburger-middle{ 0%{ opacity:1; } 50%{ opacity: 1; } 51%{ opacity:0; } 100%{ opacity:0; }}
@keyframes hamburger-middle{ 0%{ opacity:1; } 50%{ opacity: 1; } 51%{ opacity:0; } 100%{ opacity:0; }
}
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-bottom{ 0%{ -webkit-transform: translate3d(0,0,0) rotate(0); } 50%{ -webkit-transform: translate3d(0,-8px,0) rotate(0); } 100%{ -webkit-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@-moz-keyframes hamburger-bottom{ 0%{ -moz-transform: translate3d(0,0,0) rotate(0); } 50%{ -moz-transform: translate3d(0,-8px,0) rotate(0); } 100%{ -moz-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@-o-keyframes hamburger-bottom{ 0%{ -o-transform: translate3d(0,0,0) rotate(0); } 50%{ -o-transform: translate3d(0,-8px,0) rotate(0); } 100%{ -o-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@keyframes hamburger-bottom{ 0%{-webkit-transform: translate3d(0,0,0) rotate(0);-moz-transform: translate3d(0,0,0) rotate(0);-ms-transform: translate3d(0,0,0) rotate(0);transform: translate3d(0,0,0) rotate(0); } 50%{-webkit-transform: translate3d(0,-8px,0) rotate(0);-moz-transform: translate3d(0,-8px,0) rotate(0);-ms-transform: translate3d(0,-8px,0) rotate(0);transform: translate3d(0,-8px,0) rotate(0); } 100%{-webkit-transform: translate3d(0,-8px,0) rotate(-45deg);-moz-transform: translate3d(0,-8px,0) rotate(-45deg);-ms-transform: translate3d(0,-8px,0) rotate(-45deg);transform: translate3d(0,-8px,0) rotate(-45deg); }
}
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-top-reverse{ 100%{ -webkit-transform: translate3d(0,0,0) rotate(0); } 50%{ -webkit-transform: translate3d(0,8px,0) rotate(0); } 0%{ -webkit-transform: translate3d(0,8px,0) rotate(45deg); }}
@-moz-keyframes hamburger-top-reverse{ 100%{ -moz-transform: translate3d(0,0,0) rotate(0); } 50%{ -moz-transform: translate3d(0,8px,0) rotate(0); } 0%{ -moz-transform: translate3d(0,8px,0) rotate(45deg); }}
@-o-keyframes hamburger-top-reverse{ 100%{ -o-transform: translate3d(0,0,0) rotate(0); } 50%{ -o-transform: translate3d(0,8px,0) rotate(0); } 0%{ -o-transform: translate3d(0,8px,0) rotate(45deg); }}
@keyframes hamburger-top-reverse{ 100%{-webkit-transform: translate3d(0,0,0) rotate(0);-moz-transform: translate3d(0,0,0) rotate(0);-ms-transform: translate3d(0,0,0) rotate(0);transform: translate3d(0,0,0) rotate(0); } 50%{-webkit-transform: translate3d(0,8px,0) rotate(0);-moz-transform: translate3d(0,8px,0) rotate(0);-ms-transform: translate3d(0,8px,0) rotate(0);transform: translate3d(0,8px,0) rotate(0); } 0%{-webkit-transform: translate3d(0,8px,0) rotate(45deg);-moz-transform: translate3d(0,8px,0) rotate(45deg);-ms-transform: translate3d(0,8px,0) rotate(45deg);transform: translate3d(0,8px,0) rotate(45deg); }
}
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-middle-reverse{ 100%{ opacity:1; } 51%{ opacity:1; } 50%{ opacity: 0; } 0%{ opacity:0; }}
@-moz-keyframes hamburger-middle-reverse{ 100%{ opacity:1; } 51%{ opacity:1; } 50%{ opacity: 0; } 0%{ opacity:0; }}
@-o-keyframes hamburger-middle-reverse{ 100%{ opacity:1; } 51%{ opacity:1; } 50%{ opacity: 0; } 0%{ opacity:0; }}
@keyframes hamburger-middle-reverse{ 100%{ opacity:1; } 51%{ opacity:1; } 50%{ opacity: 0; } 0%{ opacity:0; }
}
lesshat-selector {
-lh-property: 0; }
@-webkit-keyframes hamburger-bottom-reverse{ 100%{ -webkit-transform: translate3d(0,0,0) rotate(0); } 50%{ -webkit-transform: translate3d(0,-8px,0) rotate(0); } 0%{ -webkit-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@-moz-keyframes hamburger-bottom-reverse{ 100%{ -moz-transform: translate3d(0,0,0) rotate(0); } 50%{ -moz-transform: translate3d(0,-8px,0) rotate(0); } 0%{ -moz-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@-o-keyframes hamburger-bottom-reverse{ 100%{ -o-transform: translate3d(0,0,0) rotate(0); } 50%{ -o-transform: translate3d(0,-8px,0) rotate(0); } 0%{ -o-transform: translate3d(0,-8px,0) rotate(-45deg); }}
@keyframes hamburger-bottom-reverse{ 100%{-webkit-transform: translate3d(0,0,0) rotate(0);-moz-transform: translate3d(0,0,0) rotate(0);-ms-transform: translate3d(0,0,0) rotate(0);transform: translate3d(0,0,0) rotate(0); } 50%{-webkit-transform: translate3d(0,-8px,0) rotate(0);-moz-transform: translate3d(0,-8px,0) rotate(0);-ms-transform: translate3d(0,-8px,0) rotate(0);transform: translate3d(0,-8px,0) rotate(0); } 0%{-webkit-transform: translate3d(0,-8px,0) rotate(-45deg);-moz-transform: translate3d(0,-8px,0) rotate(-45deg);-ms-transform: translate3d(0,-8px,0) rotate(-45deg);transform: translate3d(0,-8px,0) rotate(-45deg); }
}
body {
-webkit-text-size-adjust: 100%;
padding-left: 250px;
overflow-x: hidden;
}
@media only screen and (max-width: 978px) {
body {
padding-left: 200px;
}
}
@media only screen and (max-width: 600px) {
body {
padding-left: 0px;
padding-top: 40px;
}
body.open-menu aside {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-o-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
body.open-menu .docs-container {
pointer-events: none;
-webkit-transform: translateX(250px);
-moz-transform: translateX(250px);
-o-transform: translateX(250px);
-ms-transform: translateX(250px);
transform: translateX(250px);
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #232830;
}
h1 {
font-size: 42px;
margin-bottom: 30px;
}
@media only screen and (max-width: 600px) {
h1 {
font-size: 28px;
margin-bottom: 22px;
}
}
h2 {
font-size: 32px;
padding-top: 12px;
margin-bottom: 14px;
}
@media only screen and (max-width: 600px) {
h2 {
font-size: 22px;
margin-bottom: 8px;
}
}
h3 {
clear: both;
font-size: 22px;
margin-bottom: 12px;
padding-top: 32px;
}
@media only screen and (max-width: 600px) {
h3 {
font-size: 18px;
}
}
h4 {
font-size: 18px;
margin-bottom: 10px;
padding-top: 10px;
}
@media only screen and (max-width: 600px) {
h4 {
font-size: 16px;
margin-bottom: 6px;
}
}
p {
color: #566076;
margin-bottom: 12px;
line-height: 22px;
}
p code {
background-color: #fafafa;
padding: 4px 8px;
border-radius: 6px;
color: #232830;
}
@media only screen and (max-width: 600px) {
p {
font-size: 14px;
}
}
code {
font-family: 'source-code-pro', monospace;
font-size: 14px;
}
@media only screen and (max-width: 600px) {
code {
font-size: 12px;
}
}
canvas {
margin-bottom: 22px;
}
.half {
width: 50%;
float: left;
}
@media only screen and (max-width: 600px) {
.half {
float: none;
width: 100%;
}
}
.docs-container {
padding: 40px 80px;
max-width: 978px;
margin: 0 auto;
-webkit-transition: -webkit-transform 200ms ease-in-out;
-moz-transition: -moz-transform 200ms ease-in-out;
-o-transition: -o-transform 200ms ease-in-out;
transition: -webkit-transform 200ms ease-in-out,-moz-transform 200ms ease-in-out,-o-transform 200ms ease-in-out,transform 200ms ease-in-out;
}
@media only screen and (max-width: 978px) {
.docs-container {
padding: 40px;
}
}
@media only screen and (max-width: 600px) {
.docs-container {
padding: 20px;
}
}
.highlight {
padding: 8px 12px;
margin: 20px 0;
background-color: #fafafa;
border-radius: 6px;
overflow: scroll;
overflow-x: visible;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.intro h3 {
color: #566076;
font-weight: normal;
}
article {
border-bottom: 1px solid #e1e1e1;
padding-bottom: 40px;
padding-top: 40px;
}
@media only screen and (max-width: 600px) {
article {
padding-top: 20px;
padding-bottom: 20px;
}
}
article:first-child {
padding-top: 0;
}
article ul {
padding-left: 20px;
}
article ul li {
color: #566076;
margin-bottom: 12px;
line-height: 22px;
}
@media only screen and (max-width: 600px) {
article ul li {
font-size: 14px;
}
}
/* Styles for the tables in v2 documentation */
table {
margin-top: 10px;
margin-bottom: 10px;
border-collapse: collapse;
}
th, td {
border: 1px solid #e1e1e1;
padding-top: 10px;
padding-bottom: 10px;
}
td {
padding-left: 5px;
padding-right: 5px;
}
thead {
background-color:
}
tbody tr:nth-child(even) {
background-color: #ffffff
}
tbody tr:nth-child(odd) {
background-color: #eeeeee;
}
/* Left navigation menu */
aside {
position: fixed;
height: 100%;
background-color: #232830;
left: 0;
top: 0;
width: 250px;
border-right: 10px solid #5b90bf;
z-index: 10;
-webkit-transition: -webkit-transform 200ms ease-in-out;
-moz-transition: -moz-transform 200ms ease-in-out;
-o-transition: -o-transform 200ms ease-in-out;
transition: -webkit-transform 200ms ease-in-out,-moz-transform 200ms ease-in-out,-o-transform 200ms ease-in-out,transform 200ms ease-in-out;
}
aside .hamburger-menu {
display: none;
cursor: pointer;
padding: 10px;
}
aside .hamburger-menu li {
list-style: none;
height: 4px;
margin-bottom: 4px;
display: block;
background-color: #fafafa;
-webkit-transition: -webkit-transform 400ms ease-out;
-moz-transition: -moz-transform 400ms ease-out;
-o-transition: -o-transform 400ms ease-out;
transition: -webkit-transform 400ms ease-out,-moz-transform 400ms ease-out,-o-transform 400ms ease-out,transform 400ms ease-out;
}
aside .hamburger-menu li:last-child {
margin-bottom: 0;
}
@media only screen and (max-width: 978px) {
aside {
width: 200px;
}
}
@media only screen and (max-width: 600px) {
aside {
width: 250px;
-webkit-transform: translateX(-250px);
-moz-transform: translateX(-250px);
-o-transform: translateX(-250px);
-ms-transform: translateX(-250px);
transform: translateX(-250px);
}
aside .hamburger-menu {
display: block;
position: absolute;
width: 40px;
height: 40px;
top: 0;
right: -50px;
background-color: #232830;
}
.open-menu aside .hamburger-menu li {
-webkit-animation: hamburger-middle 400ms ease-out forwards;
-moz-animation: hamburger-middle 400ms ease-out forwards;
-o-animation: hamburger-middle 400ms ease-out forwards;
animation: hamburger-middle 400ms ease-out forwards;
}
.open-menu aside .hamburger-menu li:first-child {
-webkit-animation: hamburger-top 400ms ease-out forwards;
-moz-animation: hamburger-top 400ms ease-out forwards;
-o-animation: hamburger-top 400ms ease-out forwards;
animation: hamburger-top 400ms ease-out forwards;
}
.open-menu aside .hamburger-menu li:last-child {
-webkit-animation: hamburger-bottom 400ms ease-out forwards;
-moz-animation: hamburger-bottom 400ms ease-out forwards;
-o-animation: hamburger-bottom 400ms ease-out forwards;
animation: hamburger-bottom 400ms ease-out forwards;
}
.closed-menu aside .hamburger-menu li {
-webkit-animation: hamburger-middle-reverse 400ms ease-out forwards;
-moz-animation: hamburger-middle-reverse 400ms ease-out forwards;
-o-animation: hamburger-middle-reverse 400ms ease-out forwards;
animation: hamburger-middle-reverse 400ms ease-out forwards;
}
.closed-menu aside .hamburger-menu li:first-child {
-webkit-animation: hamburger-top-reverse 400ms ease-out forwards;
-moz-animation: hamburger-top-reverse 400ms ease-out forwards;
-o-animation: hamburger-top-reverse 400ms ease-out forwards;
animation: hamburger-top-reverse 400ms ease-out forwards;
}
.closed-menu aside .hamburger-menu li:last-child {
-webkit-animation: hamburger-bottom-reverse 400ms ease-out forwards;
-moz-animation: hamburger-bottom-reverse 400ms ease-out forwards;
-o-animation: hamburger-bottom-reverse 400ms ease-out forwards;
animation: hamburger-bottom-reverse 400ms ease-out forwards;
}
}
aside nav {
height: 100%;
padding-bottom: 20px;
overflow: auto;
overflow-x: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
aside nav li {
display: block;
}
aside nav li a {
display: block;
color: #fafafa;
padding: 10px 12px;
text-decoration: none;
-webkit-transition: background-color 200ms ease-in-out;
-moz-transition: background-color 200ms ease-in-out;
-o-transition: background-color 200ms ease-in-out;
transition: background-color 200ms ease-in-out;
}
aside nav li a:hover {
background-color: #2b303b;
}
aside .subsection-navigation li {
font-size: 12px;
margin-left: 12px;
border-left: 1px solid #2b303b;
}
aside .subsection-navigation li a {
padding: 6px 12px;
}
Diff do arquivo suprimido porque uma ou mais linhas são muito longas

Antes

Largura:  |  Altura:  |  Tamanho: 66 KiB

-404
Ver Arquivo
@@ -1,404 +0,0 @@
* {
padding: 0;
margin: 0;
color: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
position: relative;
font-family: "proxima-nova", 'Helvetica Neue', 'Helvetica', 'sans-serif';
color: #232830;
}
lesshat-selector {
-lh-property: 0; }
::selection{color: #dfe1e8; background: #5b90bf}
::-moz-selection{color: #dfe1e8; background: #5b90bf;
}
.aspect-ratio {
width: 100%;
padding-bottom: 40%;
position: relative;
background-color: #232830;
border-bottom: 10px solid #5b90bf;
}
header {
position: absolute;
left: 0;
width: 100%;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
text-align: center;
color: #dfe1e8;
z-index: 3;
}
header h1 {
margin-bottom: 30px;
}
header h2 {
margin-bottom: 30px;
}
@media only screen and (max-width: 600px) {
header {
color: #232830;
top: 100%;
margin-top: 10px;
padding: 40px 10px;
background-color: #fafafa;
border-bottom: 1px solid #e1e1e1;
-webkit-transform: translateY(0%);
-moz-transform: translateY(0%);
-o-transform: translateY(0%);
-ms-transform: translateY(0%);
transform: translateY(0%);
}
header h1 {
font-size: 38px;
margin-bottom: 10px;
}
header h2 {
font-size: 16px;
margin-bottom: 20px;
}
header .btn {
min-width: 136px;
font-size: 14px;
padding: 18px 20px;
margin: 0 5px;
}
}
.content-main {
background-color: #fff;
z-index: 2;
position: relative;
max-width: 1440px;
margin: 0 auto;
}
@media only screen and (max-width: 600px) {
.content-main {
padding-top: 256px;
}
}
.container {
margin: 0 auto;
}
.container:after {
content: '';
display: table;
}
.canvas-holder {
padding: 4px 0;
margin: 20px 0;
position: relative;
}
.canvas-holder img {
width: 100%;
height: auto;
}
.aspect-spacer {
width: 100% !important;
height: auto !important;
display: inline-block;
}
.canvas-node-demo {
position: relative;
}
.canvas-node-demo code {
z-index: -1;
position: absolute;
width: 100%;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
font-family: "proxima-nova", 'Helvetica Neue', 'Helvetica', 'sans-serif';
text-align: center;
color: #b0bace;
}
.canvas-node-demo .operator {
font-size: 36px;
}
.canvas-node-demo .node-name {
font-size: 50px;
}
.labeled-chart-container {
padding-right: 150px;
min-height: 180px;
position: relative;
}
@media only screen and (max-width: 600px) {
.labeled-chart-container {
padding-right: 130px;
}
}
.doughnut-legend {
list-style: none;
position: absolute;
right: 8px;
top: 0;
}
.doughnut-legend li {
display: block;
padding-left: 30px;
position: relative;
margin-bottom: 4px;
border-radius: 5px;
padding: 2px 8px 2px 28px;
font-size: 14px;
cursor: default;
-webkit-transition: background-color 200ms ease-in-out;
-moz-transition: background-color 200ms ease-in-out;
-o-transition: background-color 200ms ease-in-out;
transition: background-color 200ms ease-in-out;
}
.doughnut-legend li:hover {
background-color: #fafafa;
}
.doughnut-legend li span {
display: block;
position: absolute;
left: 0;
top: 0;
width: 20px;
height: 100%;
border-radius: 5px;
}
.carousel {
white-space: nowrap;
overflow: hidden;
}
.carousel canvas {
display: inline-block;
-webkit-transition: -webkit-transform 400ms ease-out;
-moz-transition: -moz-transform 400ms ease-out;
-o-transition: -o-transform 400ms ease-out;
transition: -webkit-transform 400ms ease-out,-moz-transform 400ms ease-out,-o-transform 400ms ease-out,transform 400ms ease-out;
}
.position-6 canvas {
-webkit-transform: translateX(-500%);
-moz-transform: translateX(-500%);
-o-transform: translateX(-500%);
-ms-transform: translateX(-500%);
transform: translateX(-500%);
}
.position-5 canvas {
-webkit-transform: translateX(-400%);
-moz-transform: translateX(-400%);
-o-transform: translateX(-400%);
-ms-transform: translateX(-400%);
transform: translateX(-400%);
}
.position-4 canvas {
-webkit-transform: translateX(-300%);
-moz-transform: translateX(-300%);
-o-transform: translateX(-300%);
-ms-transform: translateX(-300%);
transform: translateX(-300%);
}
.position-3 canvas {
-webkit-transform: translateX(-200%);
-moz-transform: translateX(-200%);
-o-transform: translateX(-200%);
-ms-transform: translateX(-200%);
transform: translateX(-200%);
}
.position-2 canvas {
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-o-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
.position-1 canvas {
-webkit-transform: translateX(0%);
-moz-transform: translateX(0%);
-o-transform: translateX(0%);
-ms-transform: translateX(0%);
transform: translateX(0%);
}
.hover-highlight {
border-radius: 10px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: background-color 200ms ease-in-out;
-moz-transition: background-color 200ms ease-in-out;
-o-transition: background-color 200ms ease-in-out;
transition: background-color 200ms ease-in-out;
}
.hover-highlight:hover {
background-color: rgba(239, 241, 245, 0.3);
border-radius: 10px;
}
.hover-highlight canvas {
cursor: pointer;
}
#hero-bar {
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
h1 {
font-size: 62px;
font-weight: 600;
}
@media only screen and (max-width: 978px) {
h1 {
font-size: 48px;
}
}
h2 {
font-weight: 400;
}
h3 {
text-align: center;
}
p {
margin: 20px 0;
text-align: center;
font-size: 18px;
line-height: 28px;
}
a {
color: #5b90bf;
text-decoration: none;
border-bottom: 1px solid;
}
.features article {
width: 33.33%;
padding: 40px;
float: left;
}
@media only screen and (max-width: 978px) {
.features article {
width: 50%;
}
.features article:nth-child(2n+1) {
clear: left;
}
}
@media only screen and (max-width: 600px) {
.features article {
width: auto;
float: none;
border-bottom: 1px solid #e1e1e1;
padding: 20px 12px;
}
.features article:last-child {
border-bottom: none;
}
}
.features h3 {
margin: 40px 0 60px 0;
font-size: 32px;
}
@media only screen and (max-width: 600px) {
.features h3 {
font-size: 28px;
}
}
.btn {
margin: 0 10px;
padding: 18px 26px;
min-width: 220px;
border: none;
text-align: center;
display: inline-block;
text-decoration: none;
background-color: #1C1F26;
border-radius: 5px;
font-size: 18px;
color: #dfe1e8;
-webkit-transition: 200ms background-color;
-moz-transition: 200ms background-color;
-o-transition: 200ms background-color;
transition: 200ms background-color;
}
.btn.red {
background-color: #bf616a;
}
.btn.red:hover {
background-color: #b9525c;
}
.btn.blue {
background-color: #5b90bf;
}
.btn.blue:hover {
background-color: #4c86b9;
}
.documentation-button-container {
margin-top: 20px;
}
.badge {
background-color: #ebcb8b;
padding: 4px 8px;
font-size: 14px;
border-radius: 6px;
color: #fff;
vertical-align: top;
margin-left: 4px;
}
footer {
margin-top: 20px;
text-align: center;
clear: both;
}
.download-banner {
padding: 60px 12px;
background-color: #eff1f5;
}
.download-banner h2 {
line-height: 40px;
}
.download-banner h2 span {
padding: 0 5px;
}
@media only screen and (max-width: 600px) {
.download-banner h2 {
line-height: normal;
font-size: 22px;
}
.download-banner h2 span {
display: block;
margin: 12px 0;
font-size: 16px;
}
}
.owner-notice {
padding: 20px 12px;
background-color: #232830;
color: rgba(250, 250, 250, 0.3);
border-top: 10px solid #5b90bf;
-webkit-transition: color 200ms ease-out;
-moz-transition: color 200ms ease-out;
-o-transition: color 200ms ease-out;
transition: color 200ms ease-out;
}
.owner-notice a {
color: rgba(250, 250, 250, 0.3);
-webkit-transition: color 200ms ease-out;
-moz-transition: color 200ms ease-out;
-o-transition: color 200ms ease-out;
transition: color 200ms ease-out;
}
.owner-notice:hover {
color: #fafafa;
}
.owner-notice:hover a {
color: #fafafa;
}
+11
Ver Arquivo
@@ -0,0 +1,11 @@
{
"name": "Chart.js",
"version": "0.2.0",
"description": "Simple HTML5 Charts using the canvas element",
"keywords": ["charts"],
"homepage": "https://github.com/nnnick/Chart.js",
"author": "nnnick",
"main": ["Chart.min.js"],
"dependencies": {
}
}
-54
Ver Arquivo
@@ -1,54 +0,0 @@
---
---
<!doctype html>
<html>
<head>
<title>Chart.js | Documentation</title>
<link rel="stylesheet" type="text/css" href="../assets/docs.css">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimal-ui">
<script type="text/javascript" src="//use.typekit.net/dqv7hih.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
<body>
<aside id="js-toggle-menu">
<ul class="hamburger-menu">
<li></li>
<li></li>
<li></li>
</ul>
<nav>
<ul>
{% for doc in site.collections[1].docs %}
<li id="link-{{ doc.anchor }}">
<a href="#{{ doc.anchor }}">{{ doc.title | escape }}</a>
</li>
{% endfor %}
</ul>
</nav>
</aside>
<section class="docs-container">
<article class="intro">
<h1>Chart.js V2 Documentation</h1>
<h3>Everything you need to know to build great looking charts using Chart.js</h3>
</article>
{% for doc in site.collections[1].docs %}
<article id="{{ doc.anchor }}">
<h2>{{ doc.title | escape }}</h2>
{{ doc.content }}
</article>
{% endfor %}
</section>
<script src="../assets/Chart.min.js"></script>
<script>!function(){var e=Chart.helpers;Chart.defaults.global.responsive=!0,Chart.defaults.global.animation=!1;var t=document.getElementById("js-toggle-menu");e.addEvent(t,"click",function(){document.body.className=-1!==document.body.className.indexOf("open-menu")?"closed-menu":"open-menu"});var n=document.getElementsByTagName("article");e.each(n,function(t){if(t.id){var n=t.getElementsByTagName("canvas"),a=t.getElementsByTagName("h3"),l=t.querySelectorAll(".javascript"),i=Array.prototype.slice.call(l,0,2);if(articleId=t.id,list=document.createElement("ul"),navigationItem=document.getElementById("link-"+articleId),list.className="subsection-navigation",e.each(a,function(e){var t=document.createElement("li");e.id=articleId+"-"+e.textContent.replace(/\s+/g,"-").toLowerCase(),t.innerHTML='<a href="#'+e.id+'">'+e.textContent+"</a>",list.appendChild(t)}),a.length>0&&navigationItem.appendChild(list),n.length>0){var o="",c=[];e.each(n,function(e){c.push(e.getContext("2d"))}),c=c.length>1?c:c[0];for(var d=i.length-1;d>=0;d--)o+=i[d].textContent;new Function("ctx","options",o)(c)}}})}();</script>
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-28909194-3', 'auto');
ga('send', 'pageview');</script>
</body>
</html>
externo Arquivo executável
+1443
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+754 -45
Ver Arquivo
@@ -1,57 +1,766 @@
---
---
<!doctype html>
<html>
<head>
<title>Chart.js | Documentation</title>
<link rel="stylesheet" type="text/css" href="../assets/docs.css">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimal-ui">
<script type="text/javascript" src="//use.typekit.net/dqv7hih.js"></script>
<title>Chart.js Documentation</title>
<link href="styles.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="prettify.js"></script>
<script src="Chart.js"></script>
<script type="text/javascript" src="//use.typekit.net/puc1imu.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
<body>
<div class="redBorder"></div>
<div class="greenBorder"></div>
<div class="yellowBorder"></div>
<div id="wrapper">
<nav>
<dl>
</dl>
</nav>
<div id="contentWrapper">
<h1 id="mainHeader">Chart.js Documentation</h1>
<h2 id="introText">Everything you need to know to create great looking charts using Chart.js</h2>
<article id="gettingStarted">
<h1>Getting started</h1>
<h2>Include Chart.js</h2>
<p>First we need to include the Chart.js library on the page. The library occupies a global variable of <code>Chart</code>.</p>
<pre data-type="html"><code>&lt;script src=&quot;Chart.js&quot;&gt;&lt;/script&gt;</code></pre>
<h2>Creating a chart</h2>
<p>To create a chart, we need to instantiate the Chart class. To do this, we need to pass in the 2d context of where we want to draw the chart. Here's an example.</p>
<pre data-type="html"><code>&lt;canvas id=&quot;myChart&quot; width=&quot;400&quot; height=&quot;400&quot;&gt;&lt;/canvas&gt;</code></pre>
<pre data-type="javascript"><code>//Get the context of the canvas element we want to select
var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).PolarArea(data);</code></pre>
<p>We can also get the context of our canvas with jQuery. To do this, we need to get the DOM node out of the jQuery collection, and call the <code>getContext("2d")</code> method on that.</p>
<pre data-type="javascript"><code>//Get context with jQuery - using jQuery's .get() method.
var ctx = $("#myChart").get(0).getContext("2d");
//This will get the first returned node in the jQuery collection.
var myNewChart = new Chart(ctx);</code></pre>
<p>After we've instantiated the Chart class on the canvas we want to draw on, Chart.js will handle the scaling for retina displays.</p>
<p>With the Chart class set up, we can go on to create one of the charts Chart.js has available. In the example below, we would be drawing a Polar area chart.</p>
<pre data-type="javascript"><code>new Chart(ctx).PolarArea(data,options);</code></pre>
<p>We call a method of the name of the chart we want to create. We pass in the data for that chart type, and the options for that chart as parameters. Chart.js will merge the options you pass in with the default options for that chart type.</p>
</article>
<article id="lineChart">
<h1>Line chart</h1>
<h2>Introduction</h2>
<p>A line chart is a way of plotting data points on a line.</p>
<p>Often, it is used to show trend data, and the comparison of two data sets.</p>
<h2>Example usage</h2>
<canvas id="line" data-type="Line" width="600" height="400"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).Line(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="line">var data = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
}</code></pre>
<p>The line chart requires an array of labels for each of the data points. This is show on the X axis.</p>
<p>The data for line charts is broken up into an array of datasets. Each dataset has a colour for the fill, a colour for the line and colours for the points and strokes of the points. These colours are strings just like CSS. You can use RGBA, RGB, HEX or HSL notation.</p>
<h2>Chart options</h2>
<pre data-type="javascript"><code>Line.defaults = {
//Boolean - If we show the scale above the chart data
scaleOverlay : false,
//Boolean - If we want to override with a hard coded scale
scaleOverride : false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
scaleSteps : null,
//Number - The value jump in the hard coded scale
scaleStepWidth : null,
//Number - The scale starting value
scaleStartValue : null,
<aside id="js-toggle-menu">
<ul class="hamburger-menu">
<li></li>
<li></li>
<li></li>
</ul>
<nav>
//String - Colour of the scale line
scaleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the scale line
scaleLineWidth : 1,
//Boolean - Whether to show labels on the scale
scaleShowLabels : true,
//Interpolated JS string - can access value
scaleLabel : "<%=value%>",
//String - Scale label font declaration for the scale label
scaleFontFamily : "'Arial'",
//Number - Scale label font size in pixels
scaleFontSize : 12,
//String - Scale label font weight style
scaleFontStyle : "normal",
//String - Scale label font colour
scaleFontColor : "#666",
///Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether the line is curved between points
bezierCurve : true,
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 3,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
//Boolean - Whether to animate the chart
animation : true,
//Number - Number of animation steps
animationSteps : 60,
//String - Animation easing effect
animationEasing : "easeOutQuart",
//Function - Fires when the animation is complete
onAnimationComplete : null
}</code></pre>
</article>
<article id="barChart">
<h1>Bar chart</h1>
<h2>Introduction</h2>
<p>A bar chart is a way of showing data as bars.</p>
<p>It is sometimes used to show trend data, and the comparison of multiple data sets side by side.</p>
<h2>Example usage</h2>
<canvas id="bar" data-type="Bar" width="600" height="400"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).Bar(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="bar">var data = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
data : [28,48,40,19,96,27,100]
}
]
}</code></pre>
<p>The bar chart has the a very similar data structure to the line chart, and has an array of datasets, each with colours and an array of data. Again, colours are in CSS format.</p>
<p>We have an array of labels too for display. In the example, we are showing the same data as the previous line chart example.</p>
<h2>Chart options</h2>
<pre data-type="javascript"><code>Bar.defaults = {
//Boolean - If we show the scale above the chart data
scaleOverlay : false,
//Boolean - If we want to override with a hard coded scale
scaleOverride : false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
scaleSteps : null,
//Number - The value jump in the hard coded scale
scaleStepWidth : null,
//Number - The scale starting value
scaleStartValue : null,
//String - Colour of the scale line
scaleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the scale line
scaleLineWidth : 1,
//Boolean - Whether to show labels on the scale
scaleShowLabels : true,
//Interpolated JS string - can access value
scaleLabel : "<%=value%>",
//String - Scale label font declaration for the scale label
scaleFontFamily : "'Arial'",
//Number - Scale label font size in pixels
scaleFontSize : 12,
//String - Scale label font weight style
scaleFontStyle : "normal",
//String - Scale label font colour
scaleFontColor : "#666",
///Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
//Number - Pixel width of the bar stroke
barStrokeWidth : 2,
//Number - Spacing between each of the X value sets
barValueSpacing : 5,
//Number - Spacing between data sets within X values
barDatasetSpacing : 1,
//Boolean - Whether to animate the chart
animation : true,
//Number - Number of animation steps
animationSteps : 60,
//String - Animation easing effect
animationEasing : "easeOutQuart",
//Function - Fires when the animation is complete
onAnimationComplete : null
}</code></pre>
</article>
<article id="radarChart">
<h1>Radar chart</h1>
<h2>Introduction</h2>
<p>A radar chart is a way of showing multiple data points and the variation between them.</p>
<p>They are often useful for comparing the points of two or more different data sets</p>
<h2>Example usage</h2>
<canvas id="radar" data-type="Radar" width="400" height="400"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).Radar(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="radar">var data = {
labels : ["Eating","Drinking","Sleeping","Designing","Coding","Partying","Running"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
}</code></pre>
<p>For a radar chart, usually you will want to show a label on each point of the chart, so we include an array of strings that we show around each point in the chart. If you do not want this, you can either not include the array of labels, or choose to hide them in the chart options.</p>
<p>For the radar chart data, we have an array of datasets. Each of these is an object, with a fill colour, a stroke colour, a colour for the fill of each point, and a colour for the stroke of each point. We also have an array of data values.</p>
<h2>Chart options</h2>
<pre data-type="javascript"><code>Radar.defaults = {
//Boolean - If we show the scale above the chart data
scaleOverlay : false,
//Boolean - If we want to override with a hard coded scale
scaleOverride : false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
scaleSteps : null,
//Number - The value jump in the hard coded scale
scaleStepWidth : null,
//Number - The centre starting value
scaleStartValue : null,
//Boolean - Whether to show lines for each scale point
scaleShowLine : true,
//String - Colour of the scale line
scaleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the scale line
scaleLineWidth : 1,
//Boolean - Whether to show labels on the scale
scaleShowLabels : false,
//Interpolated JS string - can access value
scaleLabel : "<%=value%>",
//String - Scale label font declaration for the scale label
scaleFontFamily : "'Arial'",
//Number - Scale label font size in pixels
scaleFontSize : 12,
//String - Scale label font weight style
scaleFontStyle : "normal",
//String - Scale label font colour
scaleFontColor : "#666",
//Boolean - Show a backdrop to the scale label
scaleShowLabelBackdrop : true,
//String - The colour of the label backdrop
scaleBackdropColor : "rgba(255,255,255,0.75)",
//Number - The backdrop padding above & below the label in pixels
scaleBackdropPaddingY : 2,
//Number - The backdrop padding to the side of the label in pixels
scaleBackdropPaddingX : 2,
//Boolean - Whether we show the angle lines out of the radar
angleShowLineOut : true,
//String - Colour of the angle line
angleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the angle line
angleLineWidth : 1,
//String - Point label font declaration
pointLabelFontFamily : "'Arial'",
//String - Point label font weight
pointLabelFontStyle : "normal",
//Number - Point label font size in pixels
pointLabelFontSize : 12,
//String - Point label font colour
pointLabelFontColor : "#666",
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 3,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
//Boolean - Whether to animate the chart
animation : true,
//Number - Number of animation steps
animationSteps : 60,
//String - Animation easing effect
animationEasing : "easeOutQuart",
//Function - Fires when the animation is complete
onAnimationComplete : null
}</code></pre>
</article>
<article id="polarAreaChart">
<h1>Polar area chart</h1>
<h2>Introduction</h2>
<p>Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.</p>
<p>This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.</p>
<h2>Example usage</h2>
<canvas id="polarArea" data-type="PolarArea" width="300" height="300"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).PolarArea(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="polarArea">var data = [
{
value : 30,
color: "#D97041"
},
{
value : 90,
color: "#C7604C"
},
{
value : 24,
color: "#21323D"
},
{
value : 58,
color: "#9D9B7F"
},
{
value : 82,
color: "#7D4F6D"
},
{
value : 8,
color: "#584A5E"
}
]</code></pre>
<p>As you can see, for the chart data you pass in an array of objects, with a value and a colour. The <code>value</code> attribute should be a number, while the <code>color</code> attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.</p>
<h2>Chart options</h2>
<p>These are the default chart options. By passing in an object with any of these attributes, Chart.js will merge these objects and the graph accordingly. Explanations of each option are commented in the code below.</p>
<pre data-type="javascript"><code>PolarArea.defaults = {
//Boolean - Whether we show the scale above or below the chart segments
scaleOverlay : true,
//Boolean - If we want to override with a hard coded scale
scaleOverride : false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
scaleSteps : null,
//Number - The value jump in the hard coded scale
scaleStepWidth : null,
//Number - The centre starting value
scaleStartValue : null,
//Boolean - Show line for each value in the scale
scaleShowLine : true,
//String - The colour of the scale line
scaleLineColor : "rgba(0,0,0,.1)",
//Number - The width of the line - in pixels
scaleLineWidth : 1,
//Boolean - whether we should show text labels
scaleShowLabels : true,
//Interpolated JS string - can access value
scaleLabel : "<%=value%>",
//String - Scale label font declaration for the scale label
scaleFontFamily : "'Arial'",
//Number - Scale label font size in pixels
scaleFontSize : 12,
//String - Scale label font weight style
scaleFontStyle : "normal",
//String - Scale label font colour
scaleFontColor : "#666",
//Boolean - Show a backdrop to the scale label
scaleShowLabelBackdrop : true,
//String - The colour of the label backdrop
scaleBackdropColor : "rgba(255,255,255,0.75)",
//Number - The backdrop padding above & below the label in pixels
scaleBackdropPaddingY : 2,
//Number - The backdrop padding to the side of the label in pixels
scaleBackdropPaddingX : 2,
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segement.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
segmentStrokeWidth : 2,
//Boolean - Whether to animate the chart or not
animation : true,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect.
animationEasing : "easeOutBounce",
//Boolean - Whether to animate the rotation of the chart
animateRotate : true,
//Boolean - Whether to animate scaling the chart from the centre
animateScale : false,
//Function - This will fire when the animation of the chart is complete.
onAnimationComplete : null
}</code></pre>
</article>
<article id="pieChart">
<h1>Pie chart</h1>
<h2>Introduction</h2>
<p>Pie charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows a the proportional value of each piece of data.</p>
<p>They are excellent at showing the relational proportions between data.</p>
<h2>Example usage</h2>
<canvas id="pie" data-type="Pie" width="400" height="400"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).Pie(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="pie">var data = [
{
value: 30,
color:"#F38630"
},
{
value : 50,
color : "#E0E4CC"
},
{
value : 100,
color : "#69D2E7"
}
]</code></pre>
<p>For a pie chart, you must pass in an array of objects with a <code>value</code> and a <code>color</code> property. The <code>value</code> attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The <code>color</code> attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.</p>
<h2>Chart options</h2>
<p>These are the default options for the Pie chart. Pass in an object with any of these attributes to override them.
<pre data-type="javascript"><code>Pie.defaults = {
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke : true,
//String - The colour of each segment stroke
segmentStrokeColor : "#fff",
//Number - The width of each segment stroke
segmentStrokeWidth : 2,
//Boolean - Whether we should animate the chart
animation : true,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect
animationEasing : "easeOutBounce",
//Boolean - Whether we animate the rotation of the Pie
animateRotate : true,
//Boolean - Whether we animate scaling the Pie from the centre
animateScale : false,
//Function - Will fire on animation completion.
onAnimationComplete : null
}</code></pre>
</article>
<article id="doughnutChart">
<h1>Doughnut chart</h1>
<h2>Introduction</h2>
<p>Doughnut charts are similar to pie charts, however they have the centre cut out, and are therefore shaped more like a doughnut than a pie!</p>
<p>They are aso excellent at showing the relational proportions between data.</p>
<h2>Example usage</h2>
<canvas id="doughnut" data-type="Doughnut" width="400" height="400"></canvas>
<pre data-type="javascript"><code>new Chart(ctx).Doughnut(data,options);</code></pre>
<h2>Data structure</h2>
<pre data-type="javascript"><code data-for="doughnut">var data = [
{
value: 30,
color:"#F7464A"
},
{
value : 50,
color : "#E2EAE9"
},
{
value : 100,
color : "#D4CCC5"
},
{
value : 40,
color : "#949FB1"
},
{
value : 120,
color : "#4D5360"
}
]</code></pre>
<p>For a doughnut chart, you must pass in an array of objects with a <code>value</code> and a <code>color</code> property. The <code>value</code> attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The <code>color</code> attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.</p>
<h2>Chart options</h2>
<p>These are the default options for the doughnut chart. Pass in an object with any of these attributes to override them.
<pre data-type="javascript"><code>Doughnut.defaults = {
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke : true,
//String - The colour of each segment stroke
segmentStrokeColor : "#fff",
//Number - The width of each segment stroke
segmentStrokeWidth : 2,
//The percentage of the chart that we cut out of the middle.
percentageInnerCutout : 50,
//Boolean - Whether we should animate the chart
animation : true,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect
animationEasing : "easeOutBounce",
//Boolean - Whether we animate the rotation of the Doughnut
animateRotate : true,
//Boolean - Whether we animate scaling the Doughnut from the centre
animateScale : false,
//Function - Will fire on animation completion.
onAnimationComplete : null
}</code></pre>
</article>
<article id="generalIssues">
<h1>General issues</h1>
<h2>Chart interactivity</h2>
<p>If you are looking to add interaction as a layer to charts, Chart.js is <strong>not the library for you</strong>. A better option would be using SVG, as this will let you attach event listeners to any of the elements in the chart, as these are all DOM nodes.</p>
<p>Chart.js uses the canvas element, which is a single DOM node, similar in characteristics to a static image. This does mean that it has a wider scope for compatibility, and less memory implications than SVG based charting solutions. The canvas element also allows for saving the contents as a base 64 string, allowing saving the chart as an image. </p>
<p>In SVG, all of the lines, data points and everything you see is a DOM node. As a result of this, complex charts with a lot of intricacies, or many charts on the page will often see dips in performance when scrolling or generating the chart, especially when there are multiple on the page. SVG also has relatively poor mobile support, with Android not supporting SVG at all before version 3.0, and iOS before 5.0. (<a href="http://caniuse.com/svg-html5" target="_blank">caniuse.com/svg-html5</a>).</p>
<h2>Browser support</h2>
<p>Browser support for the canvas element is available in all modern & major mobile browsers (<a href="http://caniuse.com/canvas" target="_blank">caniuse.com/canvas</a>).</p>
<p>For IE8 & below, I would recommend using the polyfill ExplorerCanvas - available at <a href="https://code.google.com/p/explorercanvas/" target="_blank">https://code.google.com/p/explorercanvas/</a>. It falls back to Internet explorer's format VML when canvas support is not available. Example use:</p>
<pre data-type="html"><code>&lt;head&gt;
&lt;!--[if lte IE 8]&gt;
&lt;script src=&quot;excanvas.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;
&lt;/head&gt;</code></pre>
<p>Usually I would recommend feature detection to choose whether or not to load a polyfill, rather than IE conditional comments, however in this case, VML is a Microsoft proprietary format, so it will only work in IE.</p>
<p>Some important points to note in my experience using ExplorerCanvas as a fallback.</p>
<ul>
{% for doc in site.collections[0].docs %}
<li id="link-{{ doc.anchor }}">
<a href="#{{ doc.anchor }}">{{ doc.title | escape }}</a>
</li>
{% endfor %}
<li>Initialise charts on load rather than DOMContentReady when using the library, as sometimes a race condition will occur, and it will result in an error when trying to get the 2d context of a canvas.</li>
<li>New VML DOM elements are being created for each animation frame and there is no hardware acceleration. As a result animation is usually slow and jerky, with flashing text. It is a good idea to dynamically turn off animation based on canvas support. I recommend using the excellent <a href="http://modernizr.com/" targer="_blank">Modernizr</a> to do this.</li>
<li>When declaring fonts, the library explorercanvas requires the font name to be in single quotes inside the string. For example, instead of your scaleFontFamily property being simply "Arial", explorercanvas support, use "'Arial'" instead. Chart.js does this for default values.</li>
</ul>
</nav>
</aside>
<section class="docs-container">
<article class="intro">
<h1>Chart.js V1 Documentation</h1>
<h3>Everything you need to know to build great looking charts using Chart.js</h3>
<h2>Bugs &amp; issues</h2>
<p>Please report these on the Github page - at <a href="https://github.com/nnnick/Chart.js" target="_blank">github.com/nnnick/Chart.js</a>.</p>
<p>New contributions to the library are welcome.</p>
<h2>License</h2>
<p>Chart.js is open source and available under the <a href="http://opensource.org/licenses/MIT" target="_blank">MIT license</a>.</p>
</article>
{% for doc in site.collections[0].docs %}
<article id="{{ doc.anchor }}">
<h2>{{ doc.title | escape }}</h2>
{{ doc.content }}
</article>
{% endfor %}
</section>
<script src="../assets/Chart.min.js"></script>
<script>!function(){var e=Chart.helpers;Chart.defaults.global.responsive=!0,Chart.defaults.global.animation=!1;var t=document.getElementById("js-toggle-menu");e.addEvent(t,"click",function(){document.body.className=-1!==document.body.className.indexOf("open-menu")?"closed-menu":"open-menu"});var n=document.getElementsByTagName("article");e.each(n,function(t){if(t.id){var n=t.getElementsByTagName("canvas"),a=t.getElementsByTagName("h3"),l=t.querySelectorAll(".javascript"),i=Array.prototype.slice.call(l,0,2);if(articleId=t.id,list=document.createElement("ul"),navigationItem=document.getElementById("link-"+articleId),list.className="subsection-navigation",e.each(a,function(e){var t=document.createElement("li");e.id=articleId+"-"+e.textContent.replace(/\s+/g,"-").toLowerCase(),t.innerHTML='<a href="#'+e.id+'">'+e.textContent+"</a>",list.appendChild(t)}),a.length>0&&navigationItem.appendChild(list),n.length>0){var o="",c=[];e.each(n,function(e){c.push(e.getContext("2d"))}),c=c.length>1?c:c[0];for(var d=i.length-1;d>=0;d--)o+=i[d].textContent;new Function("ctx","options",o)(c)}}})}();</script>
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-28909194-3', 'auto');
ga('send', 'pageview');</script>
</div>
</div>
</body>
<script>
$(document).ready(function(){
var $nav = $("nav dl");
$("article").each(function(){
var $el = $(this);
var $h1 = $el.find("h1");
var sectionTitle = $h1.html();
var articleId = $el.attr("id");
var $dt = $("<dt><a href=\"#"+articleId +"\">"+sectionTitle+"</a></dt>");
$dt.find("a").on("click",function(e){
e.preventDefault();
$('html,body').animate({scrollTop: $h1.offset().top},400);
});
$nav.append($dt);
var $subtitles = $el.find("h2");
$subtitles.each(function(){
var $h2 = $(this);
var title = $h2.text();
var newID = articleId + "-" +camelCase(title);
$h2.attr("id",newID);
var $dd = $("<dd><a href=\"#" +newID + "\">" + title + "</a></dd>");
$dd.find("a").on("click",function(e){
e.preventDefault();
$('html,body').animate({scrollTop: $h2.offset().top},400);
})
$nav.append($dd);
});
var $articles = $el.find("article");
});
$("canvas").each(function(){
var $canvas = $(this);
var ctx = this.getContext("2d");
eval($("code[data-for='" + $canvas.attr("id") + "']").text());
var evalString = "new Chart(ctx)." + $canvas.data("type") + "(data);";
eval(evalString);
});
prettyPrint();
function camelCase(str){
var splitString = str.split(" ");
var returnedCamel = splitString[0].toLowerCase();
for (var i=1; i<splitString.length; i++){
returnedCamel += splitString[i].charAt(0).toUpperCase() + splitString[i].substring(1).toLowerCase();
}
return returnedCamel;
}
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28909194-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</html>
+38
Ver Arquivo
@@ -0,0 +1,38 @@
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str, code .str { color: #65B042; } /* string - green */
pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
pre .typ, code .typ { color: #89bdff; } /* type - light blue */
pre .lit, code .lit { color: #3387CC; } /* literal - blue */
pre .pun, code .pun { color: #fff; } /* punctuation - white */
pre .pln, code .pln { color: #fff; } /* plaintext - white */
pre .tag, code .tag { color: #89bdff; } /* html/xml tag - light blue */
pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name - khaki */
pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
pre.prettyprint, code.prettyprint {
background-color: #000;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-o-border-radius: 8px;
-ms-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
}
pre.prettyprint {
width: 95%;
margin: 1em auto;
padding: 1em;
white-space: pre-wrap;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
+28
Ver Arquivo
@@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
+33
Ver Arquivo
@@ -0,0 +1,33 @@
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str{ color: #65B042; } /* string - green */
pre .kwd{ color: #E28964; } /* keyword - dark pink */
pre .com{ color: #AEAEAE; font-style: italic; } /* comment - gray */
pre .typ{ color: #89bdff; } /* type - light blue */
pre .lit{ color: #3387CC; } /* literal - blue */
pre .pun{ color: #fff; } /* punctuation - white */
pre .pln{ color: #fff; } /* plaintext - white */
pre .tag{ color: #89bdff; } /* html/xml tag - light blue */
pre .atn{ color: #bdb76b; } /* html/xml attribute name - khaki */
pre .atv{ color: #65B042; } /* html/xml attribute value - green */
pre .dec{ color: #3387CC; } /* decimal - blue */
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
@media print {
pre .str{ color: #060; }
pre .kwd{ color: #006; font-weight: bold; }
pre .com{ color: #600; font-style: italic; }
pre .typ{ color: #404; font-weight: bold; }
pre .lit{ color: #044; }
pre .pun{ color: #440; }
pre .pln{ color: #000; }
pre .tag{ color: #006; font-weight: bold; }
pre .atn{ color: #404; }
pre .atv{ color: #060; }
}
+263
Ver Arquivo
@@ -0,0 +1,263 @@
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str {
color: #65B042;
}
/* string - green */
pre .kwd {
color: #E28964;
}
/* keyword - dark pink */
pre .com {
color: #AEAEAE;
font-style: italic;
}
/* comment - gray */
pre .typ {
color: #89bdff;
}
/* type - light blue */
pre .lit {
color: #3387CC;
}
/* literal - blue */
pre .pun {
color: #fff;
}
/* punctuation - white */
pre .pln {
color: #fff;
}
/* plaintext - white */
pre .tag {
color: #89bdff;
}
/* html/xml tag - light blue */
pre .atn {
color: #bdb76b;
}
/* html/xml attribute name - khaki */
pre .atv {
color: #65B042;
}
/* html/xml attribute value - green */
pre .dec {
color: #3387CC;
}
/* decimal - blue */
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0;
color: #AEAEAE;
}
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {
list-style-type: none;
}
/* Alternate shading for lines */
@media print {
pre .str {
color: #060;
}
pre .kwd {
color: #006;
font-weight: bold;
}
pre .com {
color: #600;
font-style: italic;
}
pre .typ {
color: #404;
font-weight: bold;
}
pre .lit {
color: #044;
}
pre .pun {
color: #440;
}
pre .pln {
color: #000;
}
pre .tag {
color: #006;
font-weight: bold;
}
pre .atn {
color: #404;
}
pre .atv {
color: #060;
}
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
color: inherit;
text-rendering: optimizeLegibility;
}
body {
color: #282b36;
min-width: 768px;
}
.redBorder,
.greenBorder,
.yellowBorder {
border-top: 8px solid #282b36;
width: 33.33%;
float: left;
height: 16px;
position: relative;
z-index: 50;
}
.redBorder {
background-color: #f33e6f;
}
.greenBorder {
background-color: #46bfbd;
}
.yellowBorder {
background-color: #fdb45c;
}
h1 {
font-family: "proxima-nova";
font-weight: 600;
font-size: 32px;
}
h2 {
font-family: "proxima-nova";
font-weight: 600;
font-size: 22px;
line-height: 40px;
}
#mainHeader {
font-size: 55px;
}
#introText {
font-weight: 400;
margin-top: 20px;
font-size: 26px;
line-height: 40px;
margin-bottom: 40px;
}
#wrapper {
margin: 0 auto;
position: relative;
min-width: 768px;
}
#wrapper nav {
width: 20%;
padding-right: 20px;
position: fixed;
height: 100%;
overflow-y: scroll;
top: 0;
z-index: 0;
padding: 40px 20px;
font-family: "proxima-nova";
background-color: #ebebeb;
}
#wrapper nav dl {
color: #767c8d;
}
#wrapper nav dl dt {
list-style: none;
margin-top: 10px;
margin-bottom: 5px;
}
#wrapper nav dl dt a {
display: block;
padding: 2px 0;
border-bottom: 1px solid rgba(118, 124, 141, 0.2);
text-decoration: none;
}
#wrapper nav dl dd {
margin-bottom: 5px;
padding-left: 5px;
}
#wrapper nav dl dd:before {
content: "- ";
}
#wrapper nav dl dd a {
text-decoration: none;
font-size: 12px;
border-bottom: 1px solid transparent;
}
#wrapper nav dl a {
-webkit-transition: all 200ms ease-in-out;
-moz-transition: all 200ms ease-in-out;
-o-transition: all 200ms ease-in-out;
-ms-transition: all 200ms ease-in-out;
transition: all 200ms ease-in-out;
}
#wrapper nav dl a:hover {
color: #2d91ea;
border-bottom-color: #2d91ea;
}
#wrapper #contentWrapper {
width: 80%;
max-width: 1080px;
margin-left: 20%;
padding: 0px 40px;
padding-top: 72px;
}
article {
border-top: 1px solid #ebebeb;
padding: 40px 0;
}
article h2 {
margin-top: 20px;
}
p,
ul li {
font-family: "proxima-nova";
line-height: 20px;
font-size: 16px;
margin-top: 10px;
color: #767c8d;
}
p a,
ul li a {
text-decoration: none;
border-bottom: 1px solid #2d91ea;
color: #2d91ea;
}
canvas {
margin-top: 20px;
}
pre {
background-color: #292b36;
padding: 10px;
border-radius: 5px;
position: relative;
-webkit-font-smoothing: antialiased;
margin: 40px 0 20px 0;
}
pre code {
display: block;
}
pre:before {
content: attr(data-type);
position: absolute;
font-size: 12px;
top: -30px;
left: 0;
font-family: "proxima-nova";
font-weight: 400;
display: inline-block;
padding: 2px 5px;
border-radius: 5px;
background-color: #ebebeb;
}
+185
Ver Arquivo
@@ -0,0 +1,185 @@
@import "prettify";
@codeBackground : #292B36;
@primaryFont : "proxima-nova";
@textColour : #282B36;
@secondaryTextColour : #767c8d;
@borderPaleColour : #EBEBEB;
@pageBorderColour : @textColour;
@red : #F33E6F;
@green : #46BFBD;
@yellow : #FDB45C;
@blue : #2D91EA;
*{
padding:0;
margin:0;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
color:inherit;
text-rendering: optimizeLegibility;
}
body{
color: @textColour;
min-width: 768px;
}
.redBorder,.greenBorder,.yellowBorder{
border-top: 8px solid @pageBorderColour;
width: 33.33%;
float: left;
height: 16px;
position: relative;
z-index:50;
}
.redBorder{
background-color: @red;
}
.greenBorder{
background-color: @green;
}
.yellowBorder{
background-color: @yellow;
}
h1{
font-family: @primaryFont;
font-weight: 600;
font-size: 32px;
}
h2{
font-family: @primaryFont;
font-weight: 600;
font-size: 22px;
line-height: 40px;
}
#mainHeader{
font-size: 55px;
}
#introText{
font-weight: 400;
margin-top: 20px;
font-size: 26px;
line-height: 40px;
margin-bottom: 40px;
}
#wrapper{
margin: 0 auto;
position: relative;
min-width: 768px;
nav{
width: 20%;
padding-right: 20px;
position: fixed;
height: 100%;
overflow-y: scroll;
top: 0;
z-index: 0;
padding: 40px 20px;
font-family: @primaryFont;
background-color: @borderPaleColour;
dl{
color: @secondaryTextColour;
dt{
list-style: none;
margin-top: 10px;
margin-bottom: 5px;
a{
display: block;
padding: 2px 0;
border-bottom: 1px solid fade(@secondaryTextColour,20%);
text-decoration: none;
}
}
dd{
margin-bottom: 5px;
padding-left: 5px;
&:before{
content: "- ";
}
a{
text-decoration:none;
font-size: 12px;
border-bottom: 1px solid transparent;
}
}
a{
-webkit-transition: all 200ms ease-in-out;
-moz-transition: all 200ms ease-in-out;
-o-transition: all 200ms ease-in-out;
-ms-transition: all 200ms ease-in-out;
transition: all 200ms ease-in-out;
&:hover{
color: @blue;
border-bottom-color:@blue;
}
}
}
}
#contentWrapper{
width: 80%;
max-width: 1080px;
margin-left: 20%;
padding: 0px 40px;
padding-top: 72px;
}
}
article{
border-top: 1px solid @borderPaleColour;
padding: 40px 0;
h2{
margin-top: 20px;
}
}
p,ul li{
font-family: @primaryFont;
line-height: 20px;
font-size: 16px;
margin-top: 10px;
color: @secondaryTextColour;
a{
text-decoration: none;
border-bottom: 1px solid @blue;
color: @blue;
}
}
canvas{
margin-top: 20px;
}
pre{
background-color: @codeBackground;
padding: 10px;
border-radius: 5px;
position: relative;
-webkit-font-smoothing: antialiased;
margin: 40px 0 20px 0;
code{
display: block;
}
&:before{
content: attr(data-type);
position: absolute;
font-size: 12px;
top: -30px;
left: 0;
font-family: @primaryFont;
font-weight: 400;
display: inline-block;
padding: 2px 5px;
border-radius: 5px;
background-color: @borderPaleColour;
}
}
p{
}
-558
Ver Arquivo
@@ -1,558 +0,0 @@
---
---
<!doctype html>
<html>
<head>
<title>Chart.js | Open source HTML5 Charts for your website</title>
<meta name="description" content="Simple, clean and engaging HTML5 based JavaScript charts. Chart.js is an easy way to include animated, interactive graphs on your website for free."/>
<link rel="stylesheet" type="text/css" href="assets/styles.css">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimal-ui">
<script type="text/javascript" src="//use.typekit.net/dqv7hih.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
<body>
<div class="aspect-ratio">
<canvas width='1200' height='480' id="hero-bar"></canvas>
<header>
<h1>Chart.js</h1>
<h2>Simple, clean and engaging charts for designers and developers</h2>
<a class="btn red" href="https://github.com/nnnick/Chart.js">Download</a>
<div class="documentation-button-container">
<a class="btn blue" href="{{ site.baseurl }}/docs">V1 Documentation</a>
<a class="btn blue" href="{{ site.baseurl }}/docs-v2">V2 Documentation</a>
</div>
</header>
</div>
<div class="content-main">
<section class="features container">
<article>
<h3>Six chart types</h3>
<div id="js-carousel" class="canvas-holder hover-highlight carousel position-1"><canvas width="400" height="250" id="carousel-radar"></canvas><canvas width="400" height="250" id="carousel-polar-area"></canvas><canvas width="400" height="250" id="carousel-bar"></canvas><canvas width="400" height="250" id="carousel-doughnut"></canvas><canvas width="400" height="250" id="carousel-line"></canvas><canvas width="400" height="250" id="carousel-pie"></canvas></div>
<p>Visualize your data in 6 different ways. Each of them animated, with a load of customisation options and interactivity extensions.</p>
</article>
<article>
<h3>HTML5 based</h3>
<div id="js-mouse-bubbles" class="canvas-holder canvas-node-demo hover-highlight">
<code>
<span class="operator">&lt;</span><span class="node-name">canvas</span><span class="operator">&gt;</span>
</code>
<canvas width="400" height="250" class="aspect-spacer"></canvas>
</div>
<p>Chart.js uses the HTML5 canvas element. It's supported in all modern browsers, and polyfills support for IE7/8.</p>
</article>
<article>
<h3>Simple and flexible</h3>
<div class="canvas-holder hover-highlight">
<canvas width="400" height="250" id="micro-line"></canvas>
</div>
<p>Chart.js is dependency free and super lightweight. All six core chart types are only <strong>11.01kb</strong> when minified, concatenated and served gzipped.</p>
</article>
<article>
<h3>Responsive <span class="badge new">new</span></h3>
<div class="canvas-holder">
<img width="400" height="250" src="assets/responsive.svg"/>
</div>
<p>Chart.js will resize your chart if the browser changes size, along with providing the perfect scale granularity for that size</p>
</article>
<article>
<h3>Modular <span class="badge new">new</span></h3>
<div class="labeled-chart-container">
<div class="canvas-holder">
<canvas id="modular-doughnut" width="250" height="250">
</canvas>
</div>
</div>
<p>Chart.js is modular, and each of the chart types have been split up, so you can load only which chart types you need for your project</p>
</article>
<article>
<h3>Interactive <span class="badge new">new</span></h3>
<div class="canvas-holder half">
<canvas id="interactive-bar" width="400" height="250">
</canvas>
</div>
<p>Chart.js provides default simple support for canvas tooltips on hover/touch, but you can extend chart interactions to trigger events in your application</p>
</article>
</section>
</div>
<footer>
<div class="download-banner">
<h2><a href="https://github.com/nnnick/Chart.js">Download on GitHub</a><span> or </span><a href="/docs">Read detailed documentation</a></h2>
</div>
<div class="owner-notice">
A project by <a href="http://www.nickdownie.com">Nick Downie</a>
</div>
</footer>
<script src="assets/Chart.min.js"></script>
<script>(function(){
// Colour variables
var red = "#bf616a",
blue = "#5B90BF",
orange = "#d08770",
yellow = "#ebcb8b",
green = "#a3be8c",
teal = "#96b5b4",
pale_blue = "#8fa1b3",
purple = "#b48ead",
brown = "#ab7967";
var baseDataset = {
fill: 'rgba(222,225,232,0.4)',
stroke: 'rgba(222,225,232,1)',
highlight: 'rgba(222,225,232,0.8)',
highlightStroke: 'rgba(222,225,232,1)'
},
overlayDataset = {
fill: 'rgba(91,144,191,0.4)',
stroke: 'rgba(91,144,191,1)',
highlight: 'rgba(91,144,191,0.8)',
highlightStroke: 'rgba(91,144,191,1)'
};
var data = [],
barsCount = 50,
labels = new Array(barsCount),
updateDelayMax = 500,
$id = function(id){
return document.getElementById(id);
},
random = function(max){ return Math.round(Math.random()*100)},
helpers = Chart.helpers;
Chart.defaults.global.responsive = true;
for (var i = barsCount - 1; i >= 0; i--) {
data.push(Math.round(Math.random() * 100));
};
new Chart($id('hero-bar').getContext('2d')).Bar({
labels : labels,
datasets : [{
fillColor : '#2B303B',
data : data
}]
},{
showScale : false,
barShowStroke : false,
barValueSpacing: 1,
showTooltips : false,
onAnimationComplete : function(){
// Get scope of the hero chart during updates
var heroChart = this,
timeout;
// Stop this running every time the update is fired
this.options.onAnimationComplete = randomUpdate;
this.options.animationEasing = 'easeOutQuint';
randomUpdate();
function randomUpdate(){
heroChart.stop();
clearTimeout(timeout);
// Get a random bar
timeout = setTimeout(function(){
var randomNumberOfBars = Math.floor(Math.random() * barsCount),
i;
for (i = randomNumberOfBars - 1; i >= 0; i--) {
heroChart.datasets[0].bars[Math.floor(Math.random() * barsCount)].value = Math.round(Math.random() * 100);
};
heroChart.update();
},Math.random() * updateDelayMax);
};
}
});
//Run any of the smaller demo charts here.
// Six up carousel
(function(){
var contexts = {
polar : $id('carousel-polar-area').getContext('2d'),
radar : $id('carousel-radar').getContext('2d'),
line : $id('carousel-line').getContext('2d'),
bar : $id('carousel-bar').getContext('2d'),
doughnut : $id('carousel-doughnut').getContext('2d'),
pie : $id('carousel-pie').getContext('2d')
},
chartInstances = [];
var data = {
multiSets: {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: baseDataset.fill,
strokeColor: baseDataset.stroke,
pointColor: baseDataset.stroke,
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
highlightFill: baseDataset.highlight,
pointHighlightStroke: baseDataset.highlightStroke,
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: overlayDataset.fill,
strokeColor: overlayDataset.stroke,
pointColor: overlayDataset.stroke,
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: overlayDataset.highlightStroke,
highlightFill: overlayDataset.highlight,
data: [28, 48, 40, 19, 96, 27, 100]
}
]
},
segments : [
{
value : 25,
color : orange,
highlight : Colour(orange, 10),
label : "Orange"
},
{
value: 14,
color: blue,
highlight : Colour(blue, 10),
label : "Blue"
},
{
value: 6,
color: yellow,
highlight : Colour(yellow, 10),
label : "Yellow"
},
{
value : 28,
color : purple,
highlight : Colour(purple, 10),
label : "Purple"
},
{
value: 18,
color: teal,
highlight: Colour(teal, 10),
label: "Teal"
}
]
}
var config = {
animation: false,
onAnimationComplete: function(){
this.options.animation = true;
}
};
chartInstances.push(new Chart(contexts.radar).Radar(data.multiSets, config));
chartInstances.push(new Chart(contexts.polar).PolarArea(data.segments, config));
chartInstances.push(new Chart(contexts.bar).Bar(data.multiSets, config));
chartInstances.push(new Chart(contexts.doughnut).Doughnut(data.segments, config));
chartInstances.push(new Chart(contexts.line).Line(data.multiSets, config));
chartInstances.push(new Chart(contexts.pie).Pie(data.segments, config));
var iteratePosition = (function(){
var position = 1;
return function(){
position++;
return (position > chartInstances.length) ? position = 1 : position;
};
})();
var carousel = $id('js-carousel');
helpers.addEvent(carousel, 'click', function(){
var positionPrefix = 'position-',
carouselPosition = iteratePosition(),
chartToScrollTo = chartInstances[carouselPosition-1];
this.className = this.className.replace(new RegExp(positionPrefix+'[1-6]'), positionPrefix+carouselPosition);
chartToScrollTo.clear();
chartToScrollTo.render();
});
})();
// Canvas demo
(function(){
var mousetrap = $id('js-mouse-bubbles'),
canvas = mousetrap.getElementsByTagName('canvas')[0],
ctx = canvas.getContext('2d'),
colour = 'rgba(239,241,245, <%= alpha %>)',
maxSize = 50;
helpers.retinaScale({
canvas: canvas,
ctx: ctx
});
canvas.style.width = '100%';
canvas.style.height = 'auto';
helpers.addEvent(mousetrap, 'mousemove', drawTriangle);
helpers.addEvent(mousetrap, 'click', function(){
helpers.clear({
width: canvas.width,
height: canvas.height,
ctx: ctx
});
});
setInterval(function(){
setTimeout(drawTriangle, Math.random() * 400)
}, 150);
function drawTriangle(){
var x = Math.random() * canvas.width,
y = Math.random() * canvas.height,
width = Math.round((maxSize * Math.random() / 2)),
height = Math.sqrt(3) * width;
ctx.save();
ctx.translate(x, y);
ctx.rotate(Math.random() * (Math.PI * 2));
ctx.beginPath();
ctx.moveTo(-1 * width, 0);
ctx.lineTo(0, -1 * height);
ctx.lineTo(width, 0);
ctx.closePath();
ctx.fillStyle = colour.replace('<%= alpha %>', Math.random() + 0.2);
ctx.fill();
ctx.restore();
};
})();
// Simple & flexible
// Micro line chart
(function(){
var canvas = $id('micro-line'),
ctx = canvas.getContext('2d'),
lineChartData = [0, 6, 9, 10, 11, 14, 20];
var Line = new Chart(ctx).Line({
labels: new Array(lineChartData.length),
datasets: [{
strokeColor: overlayDataset.stroke,
pointColor: '#fff',
pointStrokeColor: overlayDataset.stroke,
data: lineChartData
}]
}, {
showScale: false,
showTooltips: false,
datasetStrokeWidth: 6,
datasetFill: false,
pointDotRadius : 9,
pointDotStrokeWidth: 4,
animation: false,
animationEasing: 'easeInOutQuint',
onAnimationComplete: function(){
this.options.animation = true;
}
});
helpers.addEvent(canvas, 'click', function(){
lineChartData.reverse();
Line.stop();
helpers.each(Line.datasets[0].points, function(point, index){
point.value = lineChartData[index];
});
Line.update();
})
})();
// Modular doughnut
(function(){
var canvas = $id('modular-doughnut'),
colours = {
"Core": blue,
"Line": orange,
"Bar": teal,
"Polar Area": purple,
"Radar": brown,
"Doughnut": green
};
var moduleData = [
{
value: 7.57,
color: colours["Core"],
highlight: Colour(colours["Core"], 10),
label: "Core"
},
{
value: 1.63,
color: colours["Bar"],
highlight: Colour(colours["Bar"], 10),
label: "Bar"
},
{
value: 1.09,
color: colours["Doughnut"],
highlight: Colour(colours["Doughnut"], 10),
label: "Doughnut"
},
{
value: 1.71,
color: colours["Radar"],
highlight: Colour(colours["Radar"], 10),
label: "Radar"
},
{
value: 1.64,
color: colours["Line"],
highlight: Colour(colours["Line"], 10),
label: "Line"
},
{
value: 1.37,
color: colours["Polar Area"],
highlight: Colour(colours["Polar Area"], 10),
label: "Polar Area"
}
];
//
{% raw %}
var moduleDoughnut = new Chart(canvas.getContext('2d')).Doughnut(moduleData, { tooltipTemplate : "<%if (label){%><%=label%>: <%}%><%= value %>kb", animation: false });
{% endraw %}
//
var legendHolder = document.createElement('div');
legendHolder.innerHTML = moduleDoughnut.generateLegend();
// Include a html legend template after the module doughnut itself
helpers.each(legendHolder.firstChild.childNodes, function(legendNode, index){
helpers.addEvent(legendNode, 'mouseover', function(){
var activeSegment = moduleDoughnut.segments[index];
activeSegment.save();
activeSegment.fillColor = activeSegment.highlightColor;
moduleDoughnut.showTooltip([activeSegment]);
activeSegment.restore();
});
});
helpers.addEvent(legendHolder.firstChild, 'mouseout', function(){
moduleDoughnut.draw();
});
canvas.parentNode.parentNode.appendChild(legendHolder.firstChild);
})();
// Interative micro bar chart
(function(){
var canvas = $id('interactive-bar'),
ctx = canvas.getContext('2d'),
microBar = new Chart(ctx).Bar({
labels: new Array(7),
datasets: [{
fillColor : "rgba(239,241,245,1)",
strokeColor : "rgba(0,0,0,0)",
highlightFill: "rgba(230,233,240,1)",
data: [random(), random(), random(), random(), random(), random(), random()]
}]
}, {
animation: false,
showScale: false,
barShowStroke: false,
tooltipXPadding: 10,
tooltipYPadding: 6,
tooltipFontSize: 18,
tooltipFontStyle: 'bold',
// Boolean - If we want to override with a hard coded scale
scaleOverride: true,
// ** Required if scaleOverride is true **
// Number - The number of steps in a hard coded scale
scaleSteps: 2,
// Number - The value jump in the hard coded scale
scaleStepWidth: 50,
// Number - The scale starting value
scaleStartValue: 0,
});
helpers.addEvent(canvas, 'mousemove', function(evt){
var bars =microBar.getBarsAtEvent(evt);
if (bars.length > 0){
canvas.style.cursor = "pointer";
}
else {
canvas.style.cursor = "default";
}
});
helpers.addEvent(canvas, 'click', function(evt){
microBar.options.animation = true;
microBar.options.onAnimationComplete = function(){
this.showTooltip(this.activeElements, true);
};
var bars = microBar.getBarsAtEvent(evt);
helpers.each(bars, function(bar){
bar.value = Math.max(random(), 5);
});
if (bars.length > 0){
microBar.update();
}
});
})();
function Colour(col, amt) {
var usePound = false;
if (col[0] == "#") {
col = col.slice(1);
usePound = true;
}
var num = parseInt(col,16);
var r = (num >> 16) + amt;
if (r > 255) r = 255;
else if (r < 0) r = 0;
var b = ((num >> 8) & 0x00FF) + amt;
if (b > 255) b = 255;
else if (b < 0) b = 0;
var g = (num & 0x0000FF) + amt;
if (g > 255) g = 255;
else if (g < 0) g = 0;
return (usePound?"#":"") + (g | (b << 8) | (r << 16)).toString(16);
}
})();
</script>
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-28909194-3', 'auto');
ga('send', 'pageview');</script>
</body>
</html>
+52
Ver Arquivo
@@ -0,0 +1,52 @@
Chart.js
=======
*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org)
Quick FYI
-------
I'm currently working on a big refactor of the library into a more object oriented structure.
It'll have an extendable class structure for adding community developed chart types. By opening up components into Chart.js into extendable classes, it'll allow for much easier community driven library extensions rather than tacking on new features as required. The refactor will also feature a generisized version of the interaction layer introduced by Regaddi in his tooltips branch - https://github.com/nnnick/Chart.js/pull/51. On top of this, it'll include utility methods on each chart object, for updating, clearing and redrawing charts etc.
I haven't quite got the bandwidth right now to be juggling both issues/requests in master while redesigning all of the core code in Chart.js. By focusing on the refactor, it'll get done WAY quicker.
Extensibility will absolutely be at the core of the refactor, allowing for the development of complex extension modules, but also keeping a lightweight set of core code.
Hang tight - it'll be worth it.
PS. If you're interested in reviewing some code or trying out writing extensions, shoot me an email.
###Update - 8th September
Just a quick update on the refactor.
Just wanted to let you guys know it's making really good progress, and it'll be well worth the wait.
The new version is being broken up into Chart type modules, with each of the current 6 chart types using documented and extendable classes and helper methods from the Chart.js core. This means the community will be able to build new chart types using existing components, or extend existing types to do something a bit different.
By splitting the different charts into modules will mean the ability to use AMD if appropriate, but I'll also be writing a simple web interface for concatenating chart types into a minified production ready custom build.
The syntax for creating charts **will not change**, so the upgrade should be a drop in replacement, but give you the ability to have a whole new level of interactivity and animated data updates.
Right now I've wrote 80% of the core, and refactored the Doughnut and Pie charts, and I'm a good way through the Line and Bar charts. I hope to have the new version ready to release with some new docs late September/early October.
I know PR and issues are racking up in the repo, and I'll do my best to sort them ASAP, but I think this update is really important for creating flexibility and extensibility to cater for these new features in an elegant way, rather than introducing scope creep into an architecture that wasn't designed to deliver this extra functionality.
Big thanks for all the support - it's been totally overwhelming.
###Another Quick Update - 16th October
First of all - my apologies, early October has drifted away from me and we're moving towards late October. This last month has been really unexpectedly busy, and I've had a lot of stuff going on, so I haven't quite managed to find as much time to work on Chart.js as I'd hoped.
In terms of an updated ETA, I'm really aiming for a pre-November release, and I'll be having some late nights and a few days off to try my best to make this happen.
Again, really appreciate the support and cheers for your patience for the new version.
Documentation
-------
You can find documentation at [chartjs.org/docs](http://www.chartjs.org/docs).
License
-------
Chart.js was taken down on the 19th March. It is now back online for good and IS available under MIT license.
Chart.js is available under the [MIT license] (http://opensource.org/licenses/MIT).
+39
Ver Arquivo
@@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>Bar Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="canvas" height="450" width="600"></canvas>
<script>
var barChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
data : [28,48,40,19,96,27,100]
}
]
}
var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Bar(barChartData);
</script>
</body>
</html>
+46
Ver Arquivo
@@ -0,0 +1,46 @@
<!doctype html>
<html>
<head>
<title>Doughnut Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="canvas" height="450" width="450"></canvas>
<script>
var doughnutData = [
{
value: 30,
color:"#F7464A"
},
{
value : 50,
color : "#46BFBD"
},
{
value : 100,
color : "#FDB45C"
},
{
value : 40,
color : "#949FB1"
},
{
value : 120,
color : "#4D5360"
}
];
var myDoughnut = new Chart(document.getElementById("canvas").getContext("2d")).Doughnut(doughnutData);
</script>
</body>
</html>
+43
Ver Arquivo
@@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="canvas" height="450" width="600"></canvas>
<script>
var lineChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
}
var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(lineChartData);
</script>
</body>
</html>
+38
Ver Arquivo
@@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<title>Radar Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="canvas" height="450" width="450"></canvas>
<script>
var pieData = [
{
value: 30,
color:"#F38630"
},
{
value : 50,
color : "#E0E4CC"
},
{
value : 100,
color : "#69D2E7"
}
];
var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);
</script>
</body>
</html>
Arquivo executável
+44
Ver Arquivo
@@ -0,0 +1,44 @@
<!doctype html>
<html>
<head>
<title>Polar Area Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
</style>
</head>
<body>
<canvas id="canvas" height="400" width="400"></canvas>
<script>
var chartData = [
{
value : Math.random(),
color: "#D97041"
},
{
value : Math.random(),
color: "#C7604C"
},
{
value : Math.random(),
color: "#21323D"
},
{
value : Math.random(),
color: "#9D9B7F"
},
{
value : Math.random(),
color: "#7D4F6D"
},
{
value : Math.random(),
color: "#584A5E"
}
];
var myPolarArea = new Chart(document.getElementById("canvas").getContext("2d")).PolarArea(chartData);
</script>
</body>
</html>
+43
Ver Arquivo
@@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<title>Radar Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="canvas" height="450" width="450"></canvas>
<script>
var radarChartData = {
labels : ["Eating","Drinking","Sleeping","Designing","Coding","Partying","Running"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
}
var myRadar = new Chart(document.getElementById("canvas").getContext("2d")).Radar(radarChartData,{scaleShowLabels : false, pointLabelFontSize : 10});
</script>
</body>
</html>
+155
Ver Arquivo
@@ -0,0 +1,155 @@
<!doctype html>
<html>
<head>
<title>Doughnut Chart</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
float: left;
}
</style>
</head>
<body>
<div style="width:600px;height:600px;">
<canvas id="doughnut" height="300" width="200"></canvas>
<canvas id="line" height="300" width="200"></canvas>
<canvas id="polarArea" height="300" width="200"></canvas>
<canvas id="bar" height="300" width="200"></canvas>
<canvas id="pie" height="300" width="200"></canvas>
<canvas id="radar" height="300" width="200"></canvas>
</div>
<script>
var doughnutData = [
{
value: 30,
color:"#F7464A"
},
{
value : 50,
color : "#46BFBD"
},
{
value : 100,
color : "#FDB45C"
},
{
value : 40,
color : "#949FB1"
},
{
value : 120,
color : "#4D5360"
}
];
var lineChartData = {
labels : ["","","","","","",""],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
};
var pieData = [
{
value: 30,
color:"#F38630"
},
{
value : 50,
color : "#E0E4CC"
},
{
value : 100,
color : "#69D2E7"
}
];
var barChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
data : [28,48,40,19,96,27,100]
}
]
};
var chartData = [
{
value : Math.random(),
color: "#D97041"
},
{
value : Math.random(),
color: "#C7604C"
},
{
value : Math.random(),
color: "#21323D"
},
{
value : Math.random(),
color: "#9D9B7F"
},
{
value : Math.random(),
color: "#7D4F6D"
},
{
value : Math.random(),
color: "#584A5E"
}
];
var radarChartData = {
labels : ["","","","","","",""],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
};
new Chart(document.getElementById("doughnut").getContext("2d")).Doughnut(doughnutData);
new Chart(document.getElementById("line").getContext("2d")).Line(lineChartData);
new Chart(document.getElementById("radar").getContext("2d")).Radar(radarChartData);
new Chart(document.getElementById("polarArea").getContext("2d")).PolarArea(chartData);
new Chart(document.getElementById("bar").getContext("2d")).Bar(barChartData);
new Chart(document.getElementById("pie").getContext("2d")).Pie(pieData);
</script>
</body>
</html>
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 78 KiB

externo Arquivo executável
+1443
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+320
Ver Arquivo
@@ -0,0 +1,320 @@
$(window).load(function() {
var lineChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
};
var barChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
data : [28,48,40,19,96,27,100]
}
]
};
var radarChartData = {
labels : ["A","B","C","D","E","F","G"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
};
var pieChartData = [
{
value: 30,
color:"#F38630"
},
{
value : 50,
color : "#E0E4CC"
},
{
value : 100,
color : "#69D2E7"
}
];
var polarAreaChartData = [
{
value : 62,
color: "#D97041"
},
{
value : 70,
color: "#C7604C"
},
{
value : 41,
color: "#21323D"
},
{
value : 24,
color: "#9D9B7F"
},
{
value : 55,
color: "#7D4F6D"
},
{
value : 18,
color: "#584A5E"
}
];
var doughnutChartData = [
{
value: 30,
color:"#F7464A"
},
{
value : 50,
color : "#46BFBD"
},
{
value : 100,
color : "#FDB45C"
},
{
value : 40,
color : "#949FB1"
},
{
value : 120,
color : "#4D5360"
}
];
var globalGraphSettings = {animation : Modernizr.canvas};
setIntroChart();
function setIntroChart(){
var ctx = document.getElementById("introChart").getContext("2d");
new Chart(ctx).Line(lineChartData,{animation: Modernizr.canvas, scaleShowLabels : false, scaleFontColor : "#767C8D"});
};
function showLineChart(){
var ctx = document.getElementById("lineChartCanvas").getContext("2d");
new Chart(ctx).Line(lineChartData,globalGraphSettings);
};
function showBarChart(){
var ctx = document.getElementById("barChartCanvas").getContext("2d");
new Chart(ctx).Bar(barChartData,globalGraphSettings);
};
function showRadarChart(){
var ctx = document.getElementById("radarChartCanvas").getContext("2d");
new Chart(ctx).Radar(radarChartData,globalGraphSettings);
}
function showPolarAreaChart(){
var ctx = document.getElementById("polarAreaChartCanvas").getContext("2d");
new Chart(ctx).PolarArea(polarAreaChartData,globalGraphSettings);
}
function showPieChart(){
var ctx = document.getElementById("pieChartCanvas").getContext("2d");
new Chart(ctx).Pie(pieChartData,globalGraphSettings);
};
function showDoughnutChart(){
var ctx = document.getElementById("doughnutChartCanvas").getContext("2d");
new Chart(ctx).Doughnut(doughnutChartData,globalGraphSettings);
};
var graphInitDelay = 300;
//Set up each of the inview events here.
$("#lineChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showLineChart,graphInitDelay);
});
$("#barChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showBarChart,graphInitDelay);
});
$("#radarChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showRadarChart,graphInitDelay);
});
$("#pieChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showPieChart,graphInitDelay);
});
$("#polarAreaChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showPolarAreaChart,graphInitDelay);
});
$("#doughnutChart").on("inview",function(){
var $this = $(this);
$this.removeClass("hidden").off("inview");
setTimeout(showDoughnutChart,graphInitDelay);
});
});
/**
* author Christopher Blum
* - based on the idea of Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/
* - forked from http://github.com/zuk/jquery.inview/
*/
(function ($) {
var inviewObjects = {}, viewportSize, viewportOffset,
d = document, w = window, documentElement = d.documentElement, expando = $.expando;
$.event.special.inview = {
add: function(data) {
inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) };
},
remove: function(data) {
try { delete inviewObjects[data.guid + "-" + this[expando]]; } catch(e) {}
}
};
function getViewportSize() {
var mode, domObject, size = { height: w.innerHeight, width: w.innerWidth };
// if this is correct then return it. iPad has compat Mode, so will
// go into check clientHeight/clientWidth (which has the wrong value).
if (!size.height) {
mode = d.compatMode;
if (mode || !$.support.boxModel) { // IE, Gecko
domObject = mode === 'CSS1Compat' ?
documentElement : // Standards
d.body; // Quirks
size = {
height: domObject.clientHeight,
width: domObject.clientWidth
};
}
}
return size;
}
function getViewportOffset() {
return {
top: w.pageYOffset || documentElement.scrollTop || d.body.scrollTop,
left: w.pageXOffset || documentElement.scrollLeft || d.body.scrollLeft
};
}
function checkInView() {
var $elements = $(), elementsLength, i = 0;
$.each(inviewObjects, function(i, inviewObject) {
var selector = inviewObject.data.selector,
$element = inviewObject.$element;
$elements = $elements.add(selector ? $element.find(selector) : $element);
});
elementsLength = $elements.length;
if (elementsLength) {
viewportSize = viewportSize || getViewportSize();
viewportOffset = viewportOffset || getViewportOffset();
for (; i<elementsLength; i++) {
// Ignore elements that are not in the DOM tree
if (!$.contains(documentElement, $elements[i])) {
continue;
}
var $element = $($elements[i]),
elementSize = { height: $element.height(), width: $element.width() },
elementOffset = $element.offset(),
inView = $element.data('inview'),
visiblePartX,
visiblePartY,
visiblePartsMerged;
// Don't ask me why because I haven't figured out yet:
// viewportOffset and viewportSize are sometimes suddenly null in Firefox 5.
// Even though it sounds weird:
// It seems that the execution of this function is interferred by the onresize/onscroll event
// where viewportOffset and viewportSize are unset
if (!viewportOffset || !viewportSize) {
return;
}
if (elementOffset.top + elementSize.height > viewportOffset.top &&
elementOffset.top < viewportOffset.top + viewportSize.height &&
elementOffset.left + elementSize.width > viewportOffset.left &&
elementOffset.left < viewportOffset.left + viewportSize.width) {
visiblePartX = (viewportOffset.left > elementOffset.left ?
'right' : (viewportOffset.left + viewportSize.width) < (elementOffset.left + elementSize.width) ?
'left' : 'both');
visiblePartY = (viewportOffset.top > elementOffset.top ?
'bottom' : (viewportOffset.top + viewportSize.height) < (elementOffset.top + elementSize.height) ?
'top' : 'both');
visiblePartsMerged = visiblePartX + "-" + visiblePartY;
if (!inView || inView !== visiblePartsMerged) {
$element.data('inview', visiblePartsMerged).trigger('inview', [true, visiblePartX, visiblePartY]);
}
} else if (inView) {
$element.data('inview', false).trigger('inview', [false]);
}
}
}
}
$(w).bind("scroll resize", function() {
viewportSize = viewportOffset = null;
});
// IE < 9 scrolls to focused elements without firing the "scroll" event
if (!documentElement.addEventListener && documentElement.attachEvent) {
documentElement.attachEvent("onfocusin", function() {
viewportOffset = null;
});
}
// Use setInterval in order to also make sure this captures elements within
// "overflow:scroll" elements or elements that appeared in the dom tree due to
// dom manipulation and reflow
// old: $(window).scroll(checkInView);
//
// By the way, iOS (iPad, iPhone, ...) seems to not execute, or at least delays
// intervals while the user scrolls. Therefore the inview event might fire a bit late there
setInterval(checkInView, 250);
})(jQuery);
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 82 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 47 KiB

+141
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+205
Ver Arquivo
@@ -0,0 +1,205 @@
* {
padding: 0;
margin: 0;
color: inherit;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
body {
color: #282b36;
border-top: 8px solid #282b36;
}
canvas {
font-family: "proxima-nova", sans-serif sans-serif;
}
.redBorder,
.greenBorder,
.yellowBorder {
width: 33.33%;
float: left;
height: 8px;
}
.redBorder {
background-color: #f33e6f;
}
.greenBorder {
background-color: #46bfbd;
}
.yellowBorder {
background-color: #fdb45c;
}
h1 {
font-family: "proxima-nova", sans-serif;
font-weight: 600;
font-size: 55px;
margin-top: 40px;
}
h2 {
font-family: "proxima-nova", sans-serif;
font-weight: 400;
margin-top: 20px;
font-size: 26px;
line-height: 40px;
}
h3 {
font-family: "proxima-nova", sans-serif;
font-weight: 600;
text-align: center;
margin: 20px 0;
}
h3 a {
color: #2d91ea;
text-decoration: none;
border-bottom: 1px solid #2d91ea;
}
p {
font-family: "proxima-nova", sans-serif;
line-height: 24px;
font-size: 18px;
color: #767c8d;
}
.btn {
display: inline-block;
padding: 20px;
font-family: "proxima-nova", sans-serif;
font-weight: 600;
color: #fff;
text-decoration: none;
border-radius: 5px;
text-align: center;
font-size: 18px;
-webkit-transition-property: background-color box-shadow;
-webkit-transition-duration: 200ms;
-webkit-transition-timing-function: ease-in-out;
-moz-transition-property: background-color box-shadow;
-moz-transition-duration: 200ms;
-moz-transition-timing-function: ease-in-out;
-ms-transition-property: background-color box-shadow;
-ms-transition-duration: 200ms;
-ms-transition-timing-function: ease-in-out;
-o-transition-property: background-color box-shadow;
-o-transition-duration: 200ms;
-o-transition-timing-function: ease-in-out;
transition-property: background-color box-shadow;
transition-duration: 200ms;
transition-timing-function: ease-in-out;
}
.btn:active {
box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.25);
}
.btn.red {
background-color: #f33e6f;
}
.btn.red:hover {
background-color: #f2265d;
}
.btn.blue {
background-color: #2d91ea;
}
.btn.blue:hover {
background-color: #1785e6;
}
header {
width: 978px;
margin: 20px auto;
display: block;
position: relative;
}
header hgroup {
width: 50%;
padding: 20px 0;
}
header #introChart {
position: absolute;
top: 60px;
right: 0;
}
header .btn {
margin-right: 10px;
width: 180px;
}
footer {
width: 100%;
text-align: center;
background-color: #ebebeb;
}
footer p {
color: #767c8d;
font-family: "proxima-nova", sans-serif;
font-size: 16px;
padding: 20px 0;
}
section {
width: 978px;
margin: 40px auto;
}
section:before {
content: '';
width: 600px;
margin: 0 auto;
border-top: 1px solid #ebebeb;
height: 20px;
display: block;
}
section:after {
content: "";
display: table;
clear: both;
}
*section {
zoom: 1;
}
#features article {
width: 33.33%;
float: left;
}
#features article p {
display: block;
width: 90%;
margin: 0 auto;
text-align: center;
}
#features article img {
width: 250px;
height: 250px;
margin: 0 auto;
display: block;
}
#examples article {
-webkit-transition: opacity 200ms ease-in-out;
-ms-transition: opacity 200ms ease-in-out;
-moz-transition: opacity 200ms ease-in-out;
-o-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
position: relative;
margin-top: 20px;
clear: both;
}
#examples article:after {
content: '';
width: 600px;
padding-top: 40px;
margin: 40px auto;
border-bottom: 1px solid #ebebeb;
height: 20px;
display: block;
clear: both;
}
#examples article p {
margin-top: 10px;
}
#examples article .half {
width: 50%;
float: left;
}
#examples article .canvasWrapper {
float: left;
width: 449px;
padding: 0 20px;
}
#examples h3 {
clear: both;
}
#examples .hidden {
opacity: 0;
}