Your search did not match any results.

Charts - Doughnut

The doughnut chart is a variation of the pie chart. It displays data as a circle divided into portions (slices) with a space in the center. To create a doughnut chart, use the DevExtreme PieChart component. In this demo, you can see how to initialize and configure it.

www.wikipedia.org
Backend API
@model IEnumerable<object> @(Html.DevExtreme().PieChart() .ID("pie") .Palette(VizPalette.SoftPastel) .Type(PieChartType.Doughnut) .Title("The Population of Continents and Regions") .Tooltip(t => t .Enabled(true) .Format(Format.Millions) .CustomizeTooltip(@<text> function(arg) { return { text: arg.valueText + " - " + (arg.percent * 100).toFixed(2) + "%" }; } </text>) ) .Legend(l => l .HorizontalAlignment(HorizontalAlignment.Right) .VerticalAlignment(VerticalEdge.Top) .Margin(0) ) .Export(e => e.Enabled(true)) .Series(s => s .Add() .ArgumentField("Region") .ValueField("Val") .Label(l => l .Visible(true) .Format(Format.Millions) .Connector(c => c.Visible(true)) ) ) .DataSource(Model) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class ChartsController : Controller { public ActionResult Doughnut() { return View(SampleData.PopulationData); } } }
#pie { height: 440px; }

Bind to Data

You can bind the component to one of the following data sources:

In this demo, the PieChart is populated with data taken from a local JavaScript array.

Configure Series

A series defines the look of your chart. The PieChart component includes the Pie and Doughnut series types. To use the Doughnut type, set the type property to "doughnut".

You need to bind the series to data. Set the argumentField and valueField properties to data fields that contain arguments and values for your series. You can specify these properties in an object in the series array or include it in the commonSeriesSettings object. In the latter case, your setting applies to all chart series.

Series points can have labels that display point values. Use the label object to configure them. Enable the label.visible property to show the labels. If you want to format values that labels display, specify the label.format property. You can also connect labels with their series points. To do this, enable the label.connector.visible property. As with the argumentField and valueField properties, you can specify label settings for an individual series (in the series array) or for all series (in the commonSeriesSettings object).

Enable Tooltips

When you hover the mouse pointer over a series point or its label, you can see a tooltip with information about the series point.

To configure a tooltip, you need to specify its properties in the tooltip object. For example, to enable tooltips, assign true to the enabled property of this object.

A tooltip displays information stored in the point value. If you want to customize a specific tooltip, assign a function to the tooltip.customizeTooltip property.

You can also specify the format of the tooltip values to be displayed. To do this, assign the format you need to the tooltip.format property.

Export Chart to Image

To allow a user to print the chart or export it to a PNG, JPEG, or SVG file, set the export.enabled property to true. This setting adds a button that opens a drop-down menu with export and print commands. In this demo, you can find this button in the upper-right corner.