Your search did not match any results.

Charts - Pie

This example demonstrates the PieChart component that visualizes data as a circle divided into points (slices) to illustrate data proportions.

To get started with the DevExtreme PieChart component, refer to the following tutorial for step-by-step instructions: Getting Started with PieChart.

www.wikipedia.org
Backend API
@(Html.DevExtreme().PieChart() .ID("pie") .Size(s => s.Width(500)) .Palette(VizPalette.Bright) .Series(s => s .Add() .ArgumentField("Country") .ValueField("Area") .Label(l => l .Visible(true) .Connector(c => c .Visible(true) .Width(1) ) ) ) .Title("Area of Countries") .Export(e => e.Enabled(true)) .OnPointClick(@<text> function (e) { var point = e.target; toggleVisibility(point); } </text>) .OnLegendClick(@<text> function (e) { var arg = e.target; toggleVisibility(this.getAllSeries()[0].getPointsByArg(arg)[0]); } </text>) .DataSource(new[] { new { Country = "Russia", Area = 12 }, new { Country = "Canada", Area = 7 }, new { Country = "USA", Area = 7 }, new { Country = "China", Area = 7 }, new { Country = "Brazil", Area = 6 }, new { Country = "Australia", Area = 5 }, new { Country = "India", Area = 2 }, new { Country = "Others", Area = 55 } }) ) <script> function toggleVisibility(item) { if(item.isVisible()) { item.hide(); } else { item.show(); } } </script>
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.NETCore.Demos.Models; using DevExtreme.NETCore.Demos.Models.SampleData; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; namespace DevExtreme.NETCore.Demos.Controllers { public class ChartsController : Controller { public ActionResult Pie() { return View(); } } }
#pie { height: 440px; } #pie * { margin: 0 auto; }

Bind PieChart to Data

This demo uses an array as a PieChart data source. To bind the PieChart to data, pass the array to the PieChart's dataSource property.

To display data, specify the series nested options - argumentField and valueField - with the corresponding object fields (arguments and values) in the array.

Specify Title and Labels

Use the title property to specify and configure the PieChart's title.

You can accompany each series point with a label that displays the point's value or custom data. To make point labels visible, assign true to the series.label.visible property. With this configuration, the component displays point labels detached from their respective series points. To make the connection between labels and points visible, set the label.connector.visible property to true.

Process Point and Legend Clicks

To process point and legend clicks, use the onPointClick and onLegendClick functions. This demo uses these event handlers to toggle point visibility.

Enable PieChart Export

Assign true to the export.enabled property to enable PieChart export.

NOTE

Use our DevExpress BI Dashboard to embed interactive business intelligence into your next web app.

The Web Dashboard is a data analysis UI component that you can embed into your ASP.NET Core or Angular, React, and Vue applications with .NET backend. Dashboards allow you to display multiple inter-connected data analysis elements such as grids, charts, maps, gauges, and others: all within an automatically-arranged layout.

The set of components allows you to deploy an all-in-one solution and switch between Viewer and Designer modes directly on the web client (includes adaptive layouts for tablet & mobile).

The Web Dashboard is available as a part of a Universal subscription.

Get Started with DevExpress BI Dashboard | Explore Demos