Skip to main content

PieItem Class

A Pie dashboard item that displays a series of pies or donuts.

Declaration

export class PieItem extends ChartItemBase

Remarks

The Pie dashboard item displays a series of pies or donuts that represent the contribution of each value to the total.

wdd-dashboard-items-pies

The following documentation is available: Web Dashboard - Creating Pies.

Example

The following example shows how to create the Pie dashboard item, bind it to data and add to the existing dashboard.

Create data items (measures and dimensions) and use the DataItem.dataMember property to bind them to the existing data source’s columns. Then use the created measures and dimensions in the dashboard item to bind it to data.

After you add the created dashboard item to the Dashboard.items collection, call the Dashboard.rebuildLayout method to rebuild the dashboard layout and display changes.

// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;

// ...
public createPieItem() { 
    // Create data items for the Pie dashboard item.
    var pieCategoryName = new Model.Dimension();
    pieCategoryName.dataMember("CategoryName");
    var pieProductName = new Model.Dimension();
    pieProductName.dataMember("ProductName");
    var pieCountry = new Model.Dimension();
    pieCountry.dataMember("Country");
    var pieUnitPrice = new Model.Measure();
    pieUnitPrice.dataMember("UnitPrice");

    // Create the Pie dashboard item and bind it to data.
    var pieItem = new Model.PieItem();
    pieItem.name('pies');
    pieItem.dataSource(sqlDataSource.componentName());
    pieItem.dataMember(sqlDataSource.queries()[0].name());

    pieItem.arguments.push(pieCategoryName, pieProductName);
    pieItem.values.push(pieUnitPrice);
    pieItem.seriesDimensions.push(pieCountry);

    pieItem.interactivityOptions.isDrillDownEnabled(true);

    control.dashboard().items.push(pieItem);
    // ...
    control.dashboard().rebuildLayout();

}

constructor

Initializes a new instance of the PieItem class.

Declaration

constructor(
    dashboardItemJSON?: any,
    serializer?: DevExpress.Analytics.Utils.ModelSerializer
)

Parameters

Name Type Description
dashboardItemJSON any

A JSON object used for dashboard deserialization. Do not pass this parameter directly.

serializer ModelSerializer

An object used for dashboard deserialization. Do not pass this parameter directly.

Properties

labelContentType Property

Declaration

labelContentType: ko.Observable<DevExpress.Dashboard.Model.PieValueType>

Property Value

Type
Observable<PieValueType>

labelPosition Property

Specifies the position of data labels.

Declaration

labelPosition: ko.Observable<DevExpress.Dashboard.Model.PointLabelPosition>

Property Value

Type Description
Observable<PointLabelPosition>

A PointLabelPosition value that specifies the position of data labels.

pieType Property

Declaration

pieType: ko.Observable<string>

Property Value

Type
Observable<string>

showPieCaptions Property

Declaration

showPieCaptions: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

tooltipContentType Property

Declaration

tooltipContentType: ko.Observable<DevExpress.Dashboard.Model.PieValueType>

Property Value

Type
Observable<PieValueType>

values Property

Declaration

values: ko.ObservableArray<DevExpress.Dashboard.Model.Measure>

Property Value

Type
ObservableArray<Measure>