Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 91 lines (61 sloc) 3.116 kb
87390ae Added first version
olau@iola.dk authored
1 About
2 -----
3
4 Flot is a Javascript plotting library for jQuery. Read more at the
5 website:
6
7 http://code.google.com/p/flot/
8
9 Take a look at the examples linked from above, they should give a good
40b53d9 Clarify that it's a good idea to read the example source code
olau@iola.dk authored
10 impression of what Flot can do and the source code of the examples is
11 probably the fastest way to learn how to use Flot.
87390ae Added first version
olau@iola.dk authored
12
13
14 Installation
15 ------------
16
0c08a9a Fixed formulation
olau@iola.dk authored
17 Just include the Javascript file after you've included jQuery.
87390ae Added first version
olau@iola.dk authored
18
df74547 Add compatibility with Flashcanvas (issue 368) and remove dubious octx.s...
olau@iola.dk authored
19 Generally, all browsers that support the HTML5 canvas tag are
20 supported.
21
22 For support for Internet Explorer < 9, you can use Excanvas, a canvas
23 emulator; this is used in the examples bundled with Flot. You just
0c08a9a Fixed formulation
olau@iola.dk authored
24 include the excanvas script like this:
87390ae Added first version
olau@iola.dk authored
25
d8e20bf Skip loading excanvas in IE 9 in examples (thanks to Ryley Breiddal), ad...
olau@iola.dk authored
26 <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
87390ae Added first version
olau@iola.dk authored
27
084fe2a Added note about possible IE 6.0 problems
olau@iola.dk authored
28 If it's not working on your development IE 6.0, check that it has
df74547 Add compatibility with Flashcanvas (issue 368) and remove dubious octx.s...
olau@iola.dk authored
29 support for VML which Excanvas is relying on. It appears that some
084fe2a Added note about possible IE 6.0 problems
olau@iola.dk authored
30 stripped down versions used for test environments on virtual machines
31 lack the VML support.
df74547 Add compatibility with Flashcanvas (issue 368) and remove dubious octx.s...
olau@iola.dk authored
32
d8e20bf Skip loading excanvas in IE 9 in examples (thanks to Ryley Breiddal), ad...
olau@iola.dk authored
33 You can also try using Flashcanvas (see
34 http://code.google.com/p/flashcanvas/), which uses Flash to do the
35 emulation. Although Flash can be a bit slower to load than VML, if
36 you've got a lot of points, the Flash version can be much faster
37 overall. Flot contains some wrapper code for activating Excanvas which
df74547 Add compatibility with Flashcanvas (issue 368) and remove dubious octx.s...
olau@iola.dk authored
38 Flashcanvas is compatible with.
39
40 You need at least jQuery 1.2.6, but try at least 1.3.2 for interactive
41 charts because of performance improvements in event handling.
87390ae Added first version
olau@iola.dk authored
42
43
44 Basic usage
45 -----------
46
47 Create a placeholder div to put the graph in:
48
49 <div id="placeholder"></div>
50
51 You need to set the width and height of this div, otherwise the plot
cf12db4 Clarify how to set the dimensions
olau@iola.dk authored
52 library doesn't know how to scale the graph. You can do it inline like
53 this:
54
55 <div id="placeholder" style="width:600px;height:300px"></div>
56
2d6aa6e Add warnings about display:none and placeholder readiness to the README
olau@iola.dk authored
57 You can also do it with an external stylesheet. Make sure that the
58 placeholder isn't within something with a display:none CSS property -
59 in that case, Flot has trouble measuring label dimensions which
60 results in garbled looks and might have trouble measuring the
61 placeholder dimensions which is fatal (it'll throw an exception).
87390ae Added first version
olau@iola.dk authored
62
2d6aa6e Add warnings about display:none and placeholder readiness to the README
olau@iola.dk authored
63 Then when the div is ready in the DOM, which is usually on document
64 ready, run the plot function:
87390ae Added first version
olau@iola.dk authored
65
66 $.plot($("#placeholder"), data, options);
67
68 Here, data is an array of data series and options is an object with
69 settings if you want to customize the plot. Take a look at the
70 examples for some ideas of what to put in or look at the reference
2d6aa6e Add warnings about display:none and placeholder readiness to the README
olau@iola.dk authored
71 in the file "API.txt". Here's a quick example that'll draw a line from
72 (0, 0) to (1, 1):
73
74 $.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });
87390ae Added first version
olau@iola.dk authored
75
b2f05b8 Some small formulation changes
olau@iola.dk authored
76 The plot function immediately draws the chart and then returns a plot
87390ae Added first version
olau@iola.dk authored
77 object with a couple of methods.
78
79
80 What's with the name?
81 ---------------------
82
d7d7cfe Clarify the name issue
olau@iola.dk authored
83 First: it's pronounced with a short o, like "plot". Not like "flawed".
84
b2f05b8 Some small formulation changes
olau@iola.dk authored
85 So "Flot" rhymes with "plot".
87390ae Added first version
olau@iola.dk authored
86
87 And if you look up "flot" in a Danish-to-English dictionary, some up
88 the words that come up are "good-looking", "attractive", "stylish",
89 "smart", "impressive", "extravagant". One of the main goals with Flot
b2f05b8 Some small formulation changes
olau@iola.dk authored
90 is pretty looks.
Something went wrong with that request. Please try again.