# Donut Charts

The Telerik UI Donut Chart HtmlHelper for ASP.NET MVC is a server-side wrapper for the Kendo UI Donut Chart widget.

The Donut Charts are a Pie chart variation with the ability to display data as single-series sectors from a two-dimensional circle.

* [Demo page for the Donut Chart HtmlHelper](https://demos.telerik.com/aspnet-mvc/donut-charts/index)

## Getting Started

Donut Charts are suitable for showing the proportions of categorical data, with the size of each piece representing the proportion of each category. In comparison to its [Pie Chart](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/chart-types/pie-charts) predecessor, it helps avoid confusion around the area parameter that often trips people up in a Pie Chart.

To create Donut series in the Chart component, use the `Donut` configuration method within the `Series` configuration.

* [Creating the Donut Chart](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/chart-types/donut-charts#creating-the-donut-chart)
* [Configuring the labels visibility](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/chart-types/donut-charts#configuring-the-labels-visibility)
* [Configuring the labels alignment](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/chart-types/donut-charts#configuring-the-labels-alignment)
* [Configuring the effects overlay](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/chart-types/donut-charts#configuring-the-effects-overlay)

Also, you can configure the Donut Chart for `Inline`, `Local`, and `Remote` data binding.

* [Charts Data Binding](https://docs.telerik.com/aspnet-mvc/html-helpers/charts/data-binding)

## Creating the Donut Chart

The following example demonstrates how to define a Donut Chart with a single series.

```Razor HtmlHelper
    @(Html.Kendo().Chart()
        .Name("chart")
        .Title("What is you favourite sport?")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Top)
        )
        .Series(series => {
            series.Donut(new dynamic[] {
                new {category = "Football",value = 35},
                new {category = "Basketball",value = 25},
                new {category = "Volleyball",value = 20},
                new {category = "Rugby",value = 10},
                new {category = "Tennis",value = 10}
            })
            .Labels(labels => labels
                .Visible(true)
                .Position(ChartPieLabelsPosition.OutsideEnd)
                .Template("#= category # - #= kendo.format('{0:P}', percentage)#")
                .Background("transparent")
            );
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= category # - #= kendo.format('{0:P}', percentage) #")
        )
    )
```

![UI for ASP.NET MVC A sample Donut Chart](https://www.telerik.com/aspnet-mvc/documentation/assets/822f7e99b9161377c1e4ca8adb51e016/donut-chart-labels-circle.png)

## Configuring the Labels Visibility

You can show or hide the Donut Chart labels through the `Visible()` configuration method for the given series.

```Razor HtmlHelper
    .Series(series =>
    {
        series.Donut(new dynamic[] {})
    		.Labels(labels => labels
    			.Visible(true)
    	);
    })
```

## Configuring the Labels Alignment

The Donut Chart allows you to configure the label alignment for the series through the `Align()` method.

```Razor HtmlHelper
    .Series(series =>
    {
        series.Donut(new dynamic[] {})
    		.Labels(labels => labels
    			.Align(ChartSeriesLabelsAlign.Circle)
    		);
    })
```

The Donut Chart supports two modes of label alignment:

* `Circle`(default)—The labels are positioned in a circle around the Chart.

  ![UI for ASP.NET MVC A Donut Chart with circle aligned labels](https://www.telerik.com/aspnet-mvc/documentation/assets/822f7e99b9161377c1e4ca8adb51e016/donut-chart-labels-circle.png)
* `Column`—The labels are positioned in columns to the left and right of the Chart.

  ![UI for ASP.NET MVC A Donut Chart with column aligned labels](https://www.telerik.com/aspnet-mvc/documentation/assets/a389465b079f58a52dccb8728757e818/donut-chart-labels-column.png)

## Configuring the Effects Overlay

Each segment has a transparent effect overlay that adds depth to the two-dimensional shape. The overlay transparent gradient is configurable through the `Overlay()` option.

```Razor HtmlHelper
    .Series(series =>
    {
       series.Donut(new dynamic[] {})
       .Overlay(o => o.Gradient(ChartSeriesGradient.None));
    })
```

The Donut Chart supports the following `ChartSeriesGradient` options:

* (Default) `RoundedBevel`

  ![UI for ASP.NET MVC A Donut Chart with roundedBevel overlay](https://www.telerik.com/aspnet-mvc/documentation/assets/38ee1c17a288c4971f4696a0a0a829d4/donut-chart-roundedbevel.png)

* `SharpBevel`

  ![UI for ASP.NET MVC A Donut Chart with sharpBevel overlay](https://www.telerik.com/aspnet-mvc/documentation/assets/1d23508a359fdf6ef8ecae905a7e7a82/donut-chart-overlay-sharpbevel.png)

* `None`

  ![UI for ASP.NET MVC A Donut Chart with no overlay](https://www.telerik.com/aspnet-mvc/documentation/assets/6d8b8cf5c70b5b4d5f580fd2a321e219/donut-chart-overlay-none.png)

## See Also

* [Basic Usage of the Donut Chart HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/donut-charts/index)
* [Data Binding Options for the Telerik UI for ASP.NET MVC Charts](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/charts/data-binding)
* [Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/chart)
