Easy Tutorial
❮ Home Chartjs Pie ❯

Polar Area Chart in Chart.js

A polar area chart is similar to a pie chart, but each dataset has the same angle, and the radius of the lines varies according to the provided values.

The type attribute for a mixed chart is polarArea.

const config = {
  type: 'polarArea',
  data: data,
  options: {}
};

Next, we will 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, // Set the chart to be responsive, changing according to the screen window
    maintainAspectRatio: false, // Maintain the original aspect ratio of the chart
  }
};
const myChart = new Chart(ctx, config);

The above example outputs the following result:

❮ Home Chartjs Pie ❯