Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

9. <canvas> > 9.11. Drawing Graphs with <canvas>

9.11. Drawing Graphs with <canvas>

Problem

You have some data that you want to plot in a graph using a canvas element.

Solution

All of the canvas API commands discussed in this chapter, plus other advanced commands (for complex curves, etc.), can be combined to create very nice-looking graphs that visualize data, either as line, pie, or other types of charts.

As you can probably imagine, the complexity of such a task is quite high. So, we will not discuss specifically how to draw your own graphs, but will instead show how to use a simple, free graphing library (which does the hard work for you!) called flot.

The flot library uses jQuery, so you need to load a recent version of jQuery first, and then the latest release of the flot library:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint