README.txt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. About
  2. -----
  3. Flot is a Javascript plotting library for jQuery. Read more at the
  4. website:
  5. http://code.google.com/p/flot/
  6. Take a look at the examples linked from above, they should give a good
  7. impression of what Flot can do and the source code of the examples is
  8. probably the fastest way to learn how to use Flot.
  9. Installation
  10. ------------
  11. Just include the Javascript file after you've included jQuery.
  12. Generally, all browsers that support the HTML5 canvas tag are
  13. supported.
  14. For support for Internet Explorer < 9, you can use Excanvas, a canvas
  15. emulator; this is used in the examples bundled with Flot. You just
  16. include the excanvas script like this:
  17. <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
  18. If it's not working on your development IE 6.0, check that it has
  19. support for VML which Excanvas is relying on. It appears that some
  20. stripped down versions used for test environments on virtual machines
  21. lack the VML support.
  22. You can also try using Flashcanvas (see
  23. http://code.google.com/p/flashcanvas/), which uses Flash to do the
  24. emulation. Although Flash can be a bit slower to load than VML, if
  25. you've got a lot of points, the Flash version can be much faster
  26. overall. Flot contains some wrapper code for activating Excanvas which
  27. Flashcanvas is compatible with.
  28. You need at least jQuery 1.2.6, but try at least 1.3.2 for interactive
  29. charts because of performance improvements in event handling.
  30. Basic usage
  31. -----------
  32. Create a placeholder div to put the graph in:
  33. <div id="placeholder"></div>
  34. You need to set the width and height of this div, otherwise the plot
  35. library doesn't know how to scale the graph. You can do it inline like
  36. this:
  37. <div id="placeholder" style="width:600px;height:300px"></div>
  38. You can also do it with an external stylesheet. Make sure that the
  39. placeholder isn't within something with a display:none CSS property -
  40. in that case, Flot has trouble measuring label dimensions which
  41. results in garbled looks and might have trouble measuring the
  42. placeholder dimensions which is fatal (it'll throw an exception).
  43. Then when the div is ready in the DOM, which is usually on document
  44. ready, run the plot function:
  45. $.plot($("#placeholder"), data, options);
  46. Here, data is an array of data series and options is an object with
  47. settings if you want to customize the plot. Take a look at the
  48. examples for some ideas of what to put in or look at the reference
  49. in the file "API.txt". Here's a quick example that'll draw a line from
  50. (0, 0) to (1, 1):
  51. $.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });
  52. The plot function immediately draws the chart and then returns a plot
  53. object with a couple of methods.
  54. What's with the name?
  55. ---------------------
  56. First: it's pronounced with a short o, like "plot". Not like "flawed".
  57. So "Flot" rhymes with "plot".
  58. And if you look up "flot" in a Danish-to-English dictionary, some up
  59. the words that come up are "good-looking", "attractive", "stylish",
  60. "smart", "impressive", "extravagant". One of the main goals with Flot
  61. is pretty looks.