Doughnut and Pie Charts
Pie and doughnut charts are probably the most commonly used charts. 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 cutout. This equates to what portion of the inner should be cut out.
This defaults to 0
for pie charts, and '50%'
for doughnuts.
They are also registered under two aliases in the Chart core. Other than their different default value, and different alias, they are exactly the same.
Common Dataset Options¶
These options are common to all datasets.
BackgroundColor¶
The line fill color.
BorderColor¶
The line color.
BorderWidth¶
The line width (in pixels).
Clip¶
How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. 0 = clip at chartArea.
Is clip enabled? Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}Hidden¶
Configure the visibility of the dataset. Using hidden: true will hide the dataset from being rendered in the Chart.
HoverBackgroundColor¶
Background color when hovered.
HoverBorderColor¶
Border color when hovered.
HoverBorderWidth¶
The line width (in pixels) when hovered.
Label¶
The label for the dataset which appears in the legend and tooltips.
Parsing¶
How to parse the dataset. The parsing can be disabled by specifying parsing: false at chart options or dataset. If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally.
Parsing with key. Parsing with x and y axis keys.Arc Dataset Options¶
BackgroundColors¶
Set backgrounds colors.
BorderAlign¶
Default 'center'
BorderDash¶
Arc border length and spacing of dashes.
BorderDashOffset¶
Arc border offset for line dashes. Default 0.0
BorderJoinStyle¶
Data¶
Set Data for arc chart.
HoverBorderDash¶
Arc border length and spacing of dashes when hovered.
HoverBorderDashOffset¶
Arc border offset for line dashes when hovered.
HoverBorderJoinStyle¶
Arc border join style when hovered.
Dougnut&Pie Dataset Options¶
Circumference¶
Per-dataset override for the sweep that the arcs cover.
HoverOffset¶
Arc offset when hovered (in pixels). Default 0
Offset¶
Arc offset (in pixels). Default 0
Rotation¶
Per-dataset override for the starting angle to draw arcs from.
Spacing¶
Fixed arc offset (in pixels). Similar to offset but applies to all arcs. Default 0
Weight¶
The relative thickness of the dataset. Providing a value for weight will cause the pie or doughnut dataset to be drawn with
a thickness relative to the sum of all the dataset weight values. Default 1