PieChart

The PieChart is a widget that visualizes data as a circle divided into sectors that each represents a portion of the whole.

Included in: dx.viz.js, dx.viz-web.js, dx.all.js
Module: viz/pie_chart
Export: default
PieChart interactive configuration
Copy Code
Copy to Codepen
$("#piechart").dxPieChart({
});

You can create the widget using one of the following approaches.

jQuery
JavaScript
HTML
var fruits = [
    { fruit: 'Oranges', yield: 10, consumed: 7 },
    { fruit: 'Apples', yield: 15, consumed: 14 },
    { fruit: 'Bananas', yield: 9, consumed: 9 }
];
$(function() {
    $("#pieChart").dxPieChart({
        dataSource: fruits,
        commonSeriesSettings: {
            argumentField: "fruit"
        },
        series: [
            { valueField: "yield" },
            { valueField: "consumed" }
        ]
    });
});
<div id="pieChart"></div>
Angular
HTML
TypeScript
<dx-pie-chart [dataSource]="fruits">
    <dxo-common-series-settings argumentField="fruit"></dxo-common-series-settings>
    <dxi-series valueField="yield"></dxi-series>
    <dxi-series valueField="consumed"></dxi-series>
</dx-pie-chart>
export class AppComponent {
    fruits = [
        // ...   
    ];
}
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-pie-chart="{
        dataSource: fruits,
        commonSeriesSettings: {
            argumentField: 'fruit'
        },
        series: [
            { valueField: 'yield' },
            { valueField: 'consumed' }
        ]
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.fruits = [
            { fruit: 'Oranges', yield: 10, consumed: 7 },
            { fruit: 'Apples', yield: 15, consumed: 14 },
            { fruit: 'Bananas', yield: 9, consumed: 9 }   
        ];
    });
Knockout
HTML
JavaScript
<div data-bind="dxPieChart: {
    dataSource: fruits,
    commonSeriesSettings: {
        argumentField: 'fruit'
    },
    series: [
        { valueField: 'yield' },
        { valueField: 'consumed' }
    ]
}"></div>
var viewModel = {
    fruits: [
        { fruit: 'Oranges', yield: 10, consumed: 7 },
        { fruit: 'Apples', yield: 15, consumed: 14 },
        { fruit: 'Bananas', yield: 9, consumed: 9 }
    ]
};
ko.applyBindings(viewModel);
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().PieChart()
    .ID("pieChart")
    .DataSource(Fruits)
    .CommonSeriesSettings(c => c
        .ArgumentField("fruit")
    )
    .Series(series => {
        series.Add().ValueField("yield");
        series.Add().ValueField("consumed");
    })
)
@(Html.DevExtreme().PieChart() _
    .ID("pieChart") _
    .DataSource(Fruits) _
    .CommonSeriesSettings(Sub(c)
        c.ArgumentField("fruit")
    End Sub) _
    .Series(Sub(series)
        series.Add().ValueField("yield")
        series.Add().ValueField("consumed")
    End Sub)

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

Start Tutorial View Demo Watch Video

See Also

Configuration

An object that defines configuration options for the PieChart widget.

Methods

This section describes the methods that can be used in code to manipulate the PieChart widget.

Use the dxPieChart registered method to access the PieChart widget, as demonstrated in the code below.

var pieChart = $("#pieChartContainer").dxPieChart("instance");

Events

This section describes events fired by this widget.

See Also

Series Types

This section lists the objects that define options to be used to configure series of particular types.

Chart Elements

This section describes chart elements.