Chart.js Polar Area Chart
A polar area chart is similar to a pie chart, but each dataset has the same angle, while the radius of the segments varies according to the provided values.
Mixed Chart type The attribute is polarArea.
const config = {
type: 'polarArea',
data: data,
options: {}
};
Next, let's create a simple polar area chart:
Example
const
ctx
=
document.
getElementById
(
'myChart'
)
;
const
data
=
{
labels
:
[
'Red'
,
'Green'
,
'Yellow'
,
'Grey'
,
'Blue'
]
,
datasets
:
[
{
label
:
'Polar Area Chart Example'
,
data
:
[
11
,
16
,
7
,
3
,
14
]
,
backgroundColor
:
[
'rgb(255, 99, 132)'
,
'rgb(75, 192, 192)'
,
'rgb(255, 205, 86)'
,
'rgb(201, 203, 207)'
,
'rgb(54, 162, 235)'
]
}
]
}
;
const
config
=
{
type
:
'polarArea'
,
data
:
data
,
options
:
{
responsive
:
true
,
// Make the chart responsive, adapting to window size changes
maintainAspectRatio
:
false
,
// Maintain the chart's original aspect ratio
}
}
;
const
myChart
=
new
Chart
(
ctx
,
config
)
;
Try it »
The output of the above example is: