在JavaScript中漂亮图表:Bluff
jopen
11年前
Bluff是 Gruff graphing library for Ruby的一个JavaScript移植。它设计成支持所有Gruff的所有主要特性。用的第三方脚本 JS.Class (2.6kB gzipped) 和Google的 ExCanvas 用来在IE浏览器中支持Canvas
。这两个脚本在 Bluff 中都有下载。Bluff 自身压缩后大小大概有 11KB 。
<canvas id="example" width="400" height="300"></canvas> <script type="text/javascript"> var g = new Bluff.Line('example', '400x300'); g.title = 'My Graph'; g.tooltips = true; g.theme_37signals(); 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>
