Skip to content

Polar Area Chart

Reference

Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value. This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.

1
2
3
4
5
6
7
8
9
@(Html.Chart("canvasId")
.Data(d => d
    .Labels("Red", "Green", "Yellow", "Grey", "Blue")
    .Datasets(ds => ds
        .PolarArea()
        .Label("Polar Area Dataset")
        .Data(11, 16, 7, 3, 14)
        .BackgroundColors("rgb(255, 99, 132)", "rgb(75, 192, 192)", "rgb(255, 205, 86)", "rgb(201, 203, 207)", "rgb(54, 162, 235)")))
.Render())
new Chart(document.getElementById('canvasId'),
{
  "data": {
    "labels": [
      "Red",
      "Green",
      "Yellow",
      "Grey",
      "Blue"
    ],
    "datasets": [
      {
        "data": [
          11,
          16,
          7,
          3,
          14
        ],
        "label": "Polar Area Dataset",
        "type": "polarArea",
        "backgroundColor": [
          "rgb(255, 99, 132)",
          "rgb(75, 192, 192)",
          "rgb(255, 205, 86)",
          "rgb(201, 203, 207)",
          "rgb(54, 162, 235)"
        ]
      }
    ]
  }
});

Common Dataset Options

These options are common to all datasets.

BackgroundColor

The line fill color.

.BackgroundColor("green")

BorderColor

The line color.

.BorderColor("grey")

BorderWidth

The line width (in pixels).

.BorderWidth(1)

Clip

How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. 0 = clip at chartArea.

.Clip(3)
Is clip enabled?
.Clip(false)
Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}
.Clip(c => c.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.

.Hidden(true)

HoverBackgroundColor

Background color when hovered.

.HoverBackgroundColor("blue")

HoverBorderColor

Border color when hovered.

.HoverBorderColor("grey")

HoverBorderWidth

The line width (in pixels) when hovered.

.HoverBorderWidth(3)

Label

The label for the dataset which appears in the legend and tooltips.

.Label("First Bar Dataset")

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(true)
Parsing with key.
.Parsing("key")
Parsing with x and y axis keys.
.Parsing("xKey", "yKey")

Arc Dataset Options

BackgroundColors

Set backgrounds colors.

.BackgroundColors("green", "yellow", "blue")

BorderAlign

Default 'center'

.BorderAlign(BorderAlign.Inner)

BorderDash

Arc border length and spacing of dashes.

.BorderDash(15, 3, 3, 3)

BorderDashOffset

Arc border offset for line dashes. Default 0.0

.BorderDashOffset(0.1)

BorderJoinStyle

Arc border join style.

.BorderJoinStyle(JoinStyle.Bevel)

Data

Set Data for arc chart.

.Data(3, 5, 2, 4)

HoverBorderDash

Arc border length and spacing of dashes when hovered.

.HoverBorderDash(15, 3, 3, 3)

HoverBorderDashOffset

Arc border offset for line dashes when hovered.

.HoverBorderDashOffset(0.1)

HoverBorderJoinStyle

Arc border join style when hovered.

.HoverBorderJoinStyle(JoinStyle.Bevel)

Polar Area Dataset Options

Circular

By default the Arc is curved. If circular: false the Arc will be flat.

.Circular(true)