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

    HTML
    <div id="pieChart"></div>
    JavaScript
    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" }
            ]
        });
    });
  • AngularJS

    HTML
    <div ng-controller="DemoController">
        <div dx-pie-chart="{
            dataSource: fruits,
            commonSeriesSettings: {
                argumentField: 'fruit'
            },
            series: [
                { valueField: 'yield' },
                { valueField: 'consumed' }
            ]
        }"></div>
    </div>
    JavaScript
    angular.module('DemoApp', ['dx'])
        .controller("DemoController", function ($scope) {
            $scope.fruits = [
                // ...   
            ];
        });
  • Knockout

    HTML
    <div data-bind="dxPieChart: {
        dataSource: fruits,
        commonSeriesSettings: {
            argumentField: 'fruit'
        },
        series: [
            { valueField: 'yield' },
            { valueField: 'consumed' }
        ]
    }"></div>
    JavaScript
    var viewModel = {
        fruits: [
            // ...
        ]
    };
    ko.applyBindings(viewModel);
  • ASP.NET MVC Wrappers

    @(Html.DevExtreme().PieChart()
        .ID("pieChart")
        .DataSource(Fruits)
        .CommonSeriesSettings(c => c
            .ArgumentField("fruit")
        )
        .Series(series => {
            series.Add().ValueField("yield");
            series.Add().ValueField("consumed");
        })
    )

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.

Series Types

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

Chart Elements

This section lists the methods and fields of the PieChart elements.