Creating a pie chart

When visualizing proportions or percentages as a whole, we usually use pie charts. Pie charts are simple enough to draw on our own; however, to get more flexibility and aesthetically pleasing results, we're going to use the Flot charting library with its pie plugin.

Flot's pie plugin can show a pie with or without a legend, and has extensive options for controlling the position of the labels. It's also capable of rendering tilted pies and donuts. Support for interactive pies is also included.

In this recipe, we're going to make a pie chart of our visitor's browsers.

Getting ready

We'll need to download Flot from the official website at http://www.flotcharts.org/ and extract the contents to a separate folder named flot.

How to do ...

Get HTML5 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.