PieChart

A circular chart widget for web applications.

Included in: dx.chartjs.js, dx.all.js

The dxPieChart widget is used to embed circular charts (such as pie or doughnut charts) into web applications.

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

  • jQuery
    Use the dxPieChart jQuery plug-in.

    HTML
    <div id="chartContainer"></div>
    JavaScript
    $("#chartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: "country",
            valueField: "area"
        }
    });
  • Knockout
    Add a div element and apply the dxPieChart binding to this element.

    HTML
    <div data-bind="dxPieChart: {
        dataSource: dataSource,
        series: {
            argumentField: 'country',
            valueField: 'area'
        }
    }"></div>
  • Angular
    Add a div element and apply the dx-pie-chart directive to this element.

    HTML
    <div dx-pie-chart="{
        dataSource: dataSource,
        series: {
            argumentField: 'country',
            valueField: 'area'
        }
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

To learn more about dxPieChart's visual elements, refer to the PieChart Elements help article. To learn how to provide data for the dxPieChart widget, refer to the Data Binding article.

View Demo Watch Video

See Also

To learn the widget's concepts and overview features, refer to the Charts section within the Data Visualization Guides.

Configuration

An object that defines configuration options for the dxPieChart widget.

Name Description
adaptiveLayout

Specifies adaptive layout options.

animation

Specifies animation options.

customizeLabel

Specifies a callback function that returns an object with options for a specific point label.

customizePoint

Specifies a callback function that returns an object with options for a specific point.

dataSource

Specifies a data source for the chart.

diameter

Specifies the diameter of the pie.

legend

Specifies dxPieChart legend options.

loadingIndicator

Specifies the appearance of the loading indicator.

margin

Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels.

onDisposing

A handler for the disposing event.

onDone

A handler for the done event.

onDrawn

A handler for the drawn event.

onIncidentOccurred

A handler for the incidentOccurred event.

onInitialized

A handler for the initialized event.

onLegendClick

A handler for the legendClick event.

onOptionChanged

A handler for the optionChanged event.

onPointClick

A handler for the pointClick event.

onPointHoverChanged

A handler for the pointHoverChanged event.

onPointSelectionChanged

A handler for the pointSelectionChanged event.

onTooltipHidden

A handler for the tooltipHidden event.

onTooltipShown

A handler for the tooltipShown event.

palette

Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart.

pathModified

Notifies a widget that it is embedded into an HTML page that uses a path modifier.

pointSelectionMode

Specifies whether a single point or multiple points can be selected in the chart.

redrawOnResize

Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates.

resolveLabelOverlapping

Specifies how a chart must behave when series point labels overlap.

rtlEnabled

Specifies whether or not the widget supports right-to-left representation.

series

Specifies options for the series of the dxPieChart widget.

size

Specifies the size of the widget in pixels.

theme

Sets the name of the theme to be used in the widget.

title

Specifies a title for the chart.

tooltip

Specifies tooltip options.

Methods

This section describes the methods that can be used in code to manipulate the dxPieChart object.

Name Description
beginUpdate()

Prevents the component from refreshing until the endUpdate method is called.

clearSelection()

Deselects the chart's selected series. The series is displayed in an initial style.

element()

Returns the root HTML element of the widget.

endUpdate()

Enables the component to refresh after the beginUpdate method call.

getSeries()

Provides access to the dxPieChart series.

getSize()

Gets the current size of the widget.

hideLoadingIndicator()

Conceals the loading indicator.

hideTooltip()

Hides all widget tooltips.

instance()

Returns an instance of this component class.

off(eventName)

Detaches all event handlers from the specified event.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

on(eventName, eventHandler)

Subscribes to a specified event.

on(events)

Subscribes to the specified events.

option()

Returns the configuration options of this component.

option(optionName)

Gets the value of the specified configuration option of this component.

option(optionName, optionValue)

Sets a value to the specified configuration option of this component.

option(options)

Sets one or more options of this component.

render(renderOptions)

Redraws a widget.

showLoadingIndicator()

Displays the loading indicator.

svg()

Returns the widget's SVG markup.

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

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

Events

This section describes events exposed by this widget.

Name Description
disposing

Fires when the widget is being removed.

done

Fires when the Series and Point chart elements are ready to be accessed.

drawn

Fires when the widget has finished drawing itself.

incidentOccurred

Fires when an error or warning appears in a widget.

initialized

Fires when the widget is initialized.

legendClick

Fires when an item on the chart legend is clicked.

optionChanged

Fires after an option of the component is changed.

pointClick

Fires when a user clicks a series point.

pointHoverChanged

Fires when the hover state of a series point has been changed.

pointSelectionChanged

Fires when the selection state of a series point has been changed.

tooltipHidden

Fires when a point's tooltip becomes hidden.

tooltipShown

Fires when a point's tooltip appears.

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 dxPieChart elements.