|
Maxious
|
1 |
Flotr2 |
|
|
2 |
====== |
|
|
3 |
|
|
|
4 |
The Canvas graphing library. |
|
|
5 |
|
|
|
6 |
![Google Groups](http://groups.google.com/intl/en/images/logos/groups_logo_sm.gif) |
|
|
7 |
|
|
|
8 |
http://groups.google.com/group/flotr2/ |
|
|
9 |
|
|
|
10 |
Please fork http://jsfiddle.net/cesutherland/ZFBj5/ with your question or bug reproduction case. |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
API |
|
|
14 |
--- |
|
|
15 |
|
|
|
16 |
The API consists of a primary draw method which accepts a configuration object, helper methods, and several microlibs. |
|
|
17 |
|
|
|
18 |
### Example |
|
|
19 |
|
|
|
20 |
```javascript |
|
|
21 |
var |
|
|
22 |
// Container div: |
|
|
23 |
container = document.getElementById("flotr-example-graph"), |
|
|
24 |
// First data series: |
|
|
25 |
d1 = [[0, 3], [4, 8], [8, 5], [9, 13]], |
|
|
26 |
// Second data series: |
|
|
27 |
d2 = [], |
|
|
28 |
// A couple flotr configuration options: |
|
|
29 |
options = { |
|
|
30 |
xaxis: { |
|
|
31 |
minorTickFreq: 4 |
|
|
32 |
}, |
|
|
33 |
grid: { |
|
|
34 |
minorVerticalLines: true |
|
|
35 |
} |
|
|
36 |
}, |
|
|
37 |
i, graph; |
|
|
38 |
|
|
|
39 |
// Generated second data set: |
|
|
40 |
for (i = 0; i < 14; i += 0.5) { |
|
|
41 |
d2.push([i, Math.sin(i)]); |
|
|
42 |
} |
|
|
43 |
|
|
|
44 |
// Draw the graph: |
|
|
45 |
graph = Flotr.draw( |
|
|
46 |
container, // Container element |
|
|
47 |
[ d1, d2 ], // Array of data series |
|
|
48 |
options // Configuration options |
|
|
49 |
); |
|
|
50 |
``` |
|
|
51 |
|
|
|
52 |
### Microlibs |
|
|
53 |
|
|
|
54 |
* [underscore.js](http://documentcloud.github.com/underscore/) |
|
|
55 |
* [bean.js](https://github.com/fat/bean) |
|
|
56 |
|
|
|
57 |
Extending |
|
|
58 |
--------- |
|
|
59 |
|
|
|
60 |
Flotr may be extended by adding new plugins and graph types. |
|
|
61 |
|
|
|
62 |
### Graph Types |
|
|
63 |
|
|
|
64 |
Graph types define how a particular chart is rendered. Examples include line, bar, pie. |
|
|
65 |
|
|
|
66 |
Existing graph types are found in `js/types/`. |
|
|
67 |
|
|
|
68 |
### Plugins |
|
|
69 |
|
|
|
70 |
Plugins extend the core of flotr with new functionality. They can add interactions, new decorations, etc. Examples |
|
|
71 |
include titles, labels and selection. |
|
|
72 |
|
|
|
73 |
The plugins included are found in `js/plugins/`. |
|
|
74 |
|
|
|
75 |
Development |
|
|
76 |
----------- |
|
|
77 |
|
|
|
78 |
This project uses [smoosh](https://github.com/fat/smoosh) to build and [jasmine](http://pivotal.github.com/jasmine/) |
|
|
79 |
with [js-imagediff](https://github.com/HumbleSoftware/js-imagediff) to test. Tests may be executed by |
|
|
80 |
[jasmine-headless-webkit](http://johnbintz.github.com/jasmine-headless-webkit/) with |
|
|
81 |
`cd spec; jasmine-headless-webkit -j jasmine.yml -c` or by a browser by navigating to |
|
|
82 |
`flotr2/spec/SpecRunner.html`. |
|
|
83 |
|
|
|
84 |
Shoutouts |
|
|
85 |
--------- |
|
|
86 |
|
|
|
87 |
Thanks to Bas Wenneker, Fabien Ménager and others for all the work on the original Flotr. |
|
|
88 |
Thanks to Jochen Berger and Jordan Santell for their contributions to Flotr2. |
|
|
89 |
|
|
|
90 |
|