More Related Content
Similar to Bluff Beautiful Graphs In ..
Similar to Bluff Beautiful Graphs In .. (20)
Bluff Beautiful Graphs In ..
- 1. Bluff: Beautiful graphs in JavaScript http://bluff.jcoglan.com/
Bluff
Beautiful graphs in JavaScript
Download v0.3.4
API reference
Bluff is a JavaScript port of the Gruff graphing library for Ruby. It is designed to support all the
features of Gruff with minimal dependencies; the only third-party scripts you need to run it are a copy
of JS.Class (about 2kb gzipped) and a copy of Google’s ExCanvas to support canvas in Internet
Explorer. Both these scripts are supplied with the Bluff download. Bluff itself is around 8kb gzipped.
To draw a graph, you create a new Bluff graph object using the id of a canvas element on the page,
set some options, add the data and labels, then tell the graph to draw. A basic example:
My Graph
Apples Oranges Watermelon Peaches
10
7
4
1
2003 2004 2005
<canvas id=quot;examplequot;></canvas>
<script type=quot;text/javascriptquot;>
var g = new Bluff.Line('example', 400);
g.theme_37signals();
g.title = 'My Graph';
g.data('Apples', [1, 2, 3, 4, 4, 3]);
g.data('Oranges', [4, 8, 7, 9, 8, 9]);
g.data('Watermelon', [2, 3, 1, 5, 6, 8]);
g.data('Peaches', [9, 9, 10, 8, 7, 9]);
g.labels = {0: '2003', 2: '2004', 4: '2005'};
g.draw();
</script>
Bluff, © 2008 James Coglan. Released under the MIT license.
1 of 1 20/09/2008 23:30