Skip to content

Instantly share code, notes, and snippets.

@mbecica
Created February 2, 2012 11:06
Show Gist options
  • Save mbecica/1722917 to your computer and use it in GitHub Desktop.
Save mbecica/1722917 to your computer and use it in GitHub Desktop.
// Define the size of the grid
var rX = 35,
rY = 45;
// Draw the canvas
var canvas = document.getElementById("chart"),
ctx = canvas.getContext('2d');
_(data).each(function(d, i) {
// For every column
_(d).each(function(c, e) {
// For every row
ctx.beginPath();
ctx.fillStyle = 'rgba(56,74,114, .8)';
// Draw the circle
// Syntax: arc(x, y, radius, start degree, end degree, clockwise)
ctx.arc(rX+i*rX, rX+e*rY, rX*Math.pow(c)/max, 1/4), 0, 2*Math.PI, true);
ctx.fill();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment