Radial Axes

Radial axes are used specifically for the radar and polar area chart types. These axes overlay the chart area, rather than being positioned on one of the edges. One radial axis is included by default in Chart.js.

Visual Components

A radial axis is composed of visual components that can be individually configured. These components are:

Angle Lines

The grid lines for an axis are drawn on the chart area. They stretch out from the center towards the edge of the canvas. In the example below, they are red.

Radial Axes - 图1

config setup

  1. const config = {
  2. type: 'radar',
  3. data,
  4. options: {
  5. scales: {
  6. r: {
  7. angleLines: {
  8. color: 'red'
  9. }
  10. }
  11. }
  12. }
  13. };
  1. const labels = Utils.months({count: 7});
  2. const data = {
  3. labels: labels,
  4. datasets: [{
  5. label: 'My First dataset',
  6. backgroundColor: 'rgba(54, 162, 235, 0.5)',
  7. borderColor: 'rgb(54, 162, 235)',
  8. borderWidth: 1,
  9. data: [10, 20, 30, 40, 50, 0, 5],
  10. }]
  11. };

Grid Lines

The grid lines for an axis are drawn on the chart area. In the example below, they are red.

Radial Axes - 图2

config setup

  1. const config = {
  2. type: 'radar',
  3. data,
  4. options: {
  5. scales: {
  6. r: {
  7. grid: {
  8. color: 'red'
  9. }
  10. }
  11. }
  12. }
  13. };
  1. const labels = Utils.months({count: 7});
  2. const data = {
  3. labels: labels,
  4. datasets: [{
  5. label: 'My First dataset',
  6. backgroundColor: 'rgba(54, 162, 235, 0.5)',
  7. borderColor: 'rgb(54, 162, 235)',
  8. borderWidth: 1,
  9. data: [10, 20, 30, 40, 50, 0, 5],
  10. }]
  11. };

Point Labels

The point labels indicate the value for each angle line. In the example below, they are red.

Radial Axes - 图3

config setup

  1. const config = {
  2. type: 'radar',
  3. data,
  4. options: {
  5. scales: {
  6. r: {
  7. pointLabels: {
  8. color: 'red'
  9. }
  10. }
  11. }
  12. }
  13. };
  1. const labels = Utils.months({count: 7});
  2. const data = {
  3. labels: labels,
  4. datasets: [{
  5. label: 'My First dataset',
  6. backgroundColor: 'rgba(54, 162, 235, 0.5)',
  7. borderColor: 'rgb(54, 162, 235)',
  8. borderWidth: 1,
  9. data: [10, 20, 30, 40, 50, 0, 5],
  10. }]
  11. };

Ticks

The ticks are used to label values based on how far they are from the center of the axis. In the example below, they are red.

Radial Axes - 图4

config setup

  1. const config = {
  2. type: 'radar',
  3. data,
  4. options: {
  5. scales: {
  6. r: {
  7. ticks: {
  8. color: 'red'
  9. }
  10. }
  11. }
  12. }
  13. };
  1. const labels = Utils.months({count: 7});
  2. const data = {
  3. labels: labels,
  4. datasets: [{
  5. label: 'My First dataset',
  6. backgroundColor: 'rgba(54, 162, 235, 0.5)',
  7. borderColor: 'rgb(54, 162, 235)',
  8. borderWidth: 1,
  9. data: [10, 20, 30, 40, 50, 0, 5],
  10. }]
  11. };