ASP.NET MVC Donut Chart is like a Pie chart, except for the space at the center, this chart is also referred as ASP.NET MVC Doughnut Chart. This Chart is useful when you want to compare the contribution of each data with the total.
You can customize the inner radius of the chart to make it pleasing. Making inner radius to 0 will change the doughnut to pie chart. You can customize both the radius and inner radius of the doughnut.
Legends are used to show the information about each point to know about its contribution towards the total sum. You can collapse the point using legend click.
Customize the start and end angle of the chart to achieve the semi-pie.
Data labels display information about data points. Add a template to display data labels with HTML elements such as images, DIV, and spans for more informative data labels. You can rotate a data label by its given angle.
Arranges data labels smartly to avoid overlapping when the data point values fall in close range.
Group the points in pie chart based on some condition. The grouped slices can be split into individual points by clicking the slice.
Focus-in on the data within the data using drilldown operation.
Customize the radius of individual slice using built-in APIs.
Move the center of the donut relative to the plot area.
Place a label at the center of the donut chart. Also, when the mouse pointer hovers over a donut slice, the relevant data is displayed at the center of the donut chart.
Customize the look and feel of the doughnut using built-in APIs.
Easily get started with ASP.NET MVC Donut Chart using a few simple lines of C# code example as demonstrated below. Also explore our ASP.NET MVC Donut Chart Example that shows you how to render and configure the chart.
@(Html.EJS().AccumulationChart("container").Series(series =>
{
series.InnerRadius("70%").DataSource(ViewBag.dataSource).XName("xValue").YName("yValue")
.Type(Syncfusion.EJ2.Charts.AccumulationType.Pie).Add();
}).Render()
);
public class HomeController : Controller
{
public ActionResult Index()
{
List<PieChartData> chartData = new List<PieChartData>
{
new PieChartData { xValue = "Chrome", yValue = 37 },
new PieChartData { xValue = "UC Browser", yValue = 17 },
new PieChartData { xValue = "iPhone", yValue = 19 },
new PieChartData { xValue = "Others", yValue = 4 },
new PieChartData { xValue = "Opera", yValue = 11 },
new PieChartData { xValue = "Android", yValue = 12 },
};
ViewBag.dataSource = chartData;
return View();
}
}
public class PieChartData
{
public string xValue;
public double yValue;
}
Learn the available options to customize the ASP.NET MVC Doughnut Chart.
Explore the ASP.NET MVC Doughnut Chart APIs.