Recommend this page to a friend! |
Classes of Jorge Castro | Gentelella BladeOne | vendors/chart.js/docs/07-Pie-Doughnut-Chart.md | Download |
|
Downloadtitle: Pie & Doughnut Charts anchor: doughnut-pie-chartIntroductionPie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data. They are excellent at showing the relational proportions between data. Pie and doughnut charts are effectively the same class in Chart.js, but have one different default value - their They are also registered under two aliases in the <div class="canvas-holder half">
</div> <div class="canvas-holder half">
</div> <br> Example Usage
Data StructureProperty | Type | Usage
--- | --- | ---
data | An example data object using these attributes is shown below.
For a pie chart, datasets need to contain an array of data points. The data points should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. You can also add an array of background colors. The color attributes should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL. Chart OptionsThese are the customisation options specific to Pie & Doughnut charts. These options are merged with the global chart configuration options, and form the options of the chart. Name | Type | Default | Description
--- | --- | --- | ---
cutoutPercentage | Number | 50 - for doughnut, 0 - for pie | The percentage of the chart that is cut out of the middle.
rotation | Number | -0.5 * Math.PI | Starting angle to draw arcs from
circumference | Number | 2 * Math.PI | Sweep to allow arcs to cover
animation.animateRotate | Boolean |true | If true, will animate the rotation of the chart.
animation.animateScale | Boolean | false | If true, will animate scaling the Doughnut from the centre.
legend.labels.generateLabels | Function | You can override these for your For example, we could have a doughnut chart that animates by scaling out from the centre like so:
We can also change these default values for each Doughnut type that is created, this object is available at |