Creating a pie chart
The steps to create a pie chart are relatively easy and short. Pie charts are ideal for showcasing a closed amount of data that we want to easily compare between data fields such as, in our example, dividing the number of people in the world into groups based on their region:
Getting ready
The first step will be to update our canvas size in the HTML area to be a rectangular area. In our sample, we will update the values to 400 x 400. That's about it; let's start building it.
How to do it...
In the following steps we will create our first pie chart. Let's get started:
Set up our data source and our global variables:
var data= [ {label:"Asia", value:3518000000,style:"#B1DDF3"}, {label:"Africa", value:839000000,style:"#FFDE89"}, {label:"Europe", value:803000000,style:"#E3675C"}, {label:"Latin America and Caribbean", value: 539000000,style:"#C2D985"}, {label:"North America", value:320000000,style:"#eeeeee"}, {label:"Near East", value:179000000,style:"#aaaaaa"}, {label...