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

Slicing off a pie chart


Slicing off a pie chart can be useful if we need to distinguish a particular category from the rest. The sliced-off category displays a little outwards from the main chart.

In the following example, we will take a look at how we can slice off a particular category in pie charts. So modify the code from the previous example to slice off the MacOSX category:

series: [{
  name: 'Operating Systems',
  data: [
    ['Windows', 88.19],
    {
      name: 'MacOSX',
      y: 9.22,
      sliced: true
    },
    ['Linux', 1.58],
    ['Others', 1.01]
  ]
}]

We replaced the array containing the category name and the value with an object in which we have explicitly defined these properties along with the sliced property. By enabling the sliced property, the category will be sliced off from the main chart.

The preceding snippet also shows the simplicity and flexibility of the Highcharts API. In most cases, where slicing is not required, we can define categories as an array containing...