Book Image

Highcharts Essentials

By : Bilal Shahid
Book Image

Highcharts Essentials

By: Bilal Shahid

Overview of this book

Table of Contents (16 chapters)
Highcharts Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a donut chart


In a previous example, we created a pie chart with a drilldown feature; that is, when a user clicks on the parent category, he is taken to another chart showing the breakdown of that parent category in more detail. If we want to show this detailed breakdown of data right in the main chart, we will need to use a donut chart. This is where donut charts are most useful, as they display the breakdown of the parent category without the need for the drilldown feature.

Consider the example of the top three car manufacturers (by sales) in the United States. Their sales for December 2013 to December 2014 for their best-seller models are as follows:

  • 154,491 Ford cars

  • 90,080 Honda cars

  • 93,460 Chevy cars

We can visualize this data with the help of a pie chart using the following code:

(function() {
  $( '#chart_container' ).highcharts({
    chart: {
      type: 'pie'
    },
    title: {
      text: 'Car Sales for December 2013 - 2014'
    },
    subtitle: {
      text: 'Source: &lt...