Back to Devexpress

PivotItem Class

dashboard-js-devexpress-dot-dashboard-dot-model-5dc0aa15.md

latest10.6 KB
Original Source

PivotItem Class

A Pivot dashboard item that displays cross-tabular reports.

Declaration

ts
export class PivotItem extends DataDashboardItem

Remarks

The Pivot dashboard item presents data using cross-tabular reports.

The following documentation is available: Web Dashboard - Creating a Pivot.

Example

The following example shows how to create the Pivot 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.

javascript
// 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 createPivotItem() { 
    // Create data items for the Pivot dashboard item.
    var pivotCategoryName = new Model.Dimension();
    pivotCategoryName.dataMember("CategoryName");
    var pivotProductName = new Model.Dimension();
    pivotProductName.dataMember("ProductName");
    var pivotCountry = new Model.Dimension();
    pivotCountry.dataMember("Country");
    var pivotFullName = new Model.Dimension();
    pivotFullName.dataMember("FullName");
    var pivotExtendedPrice = new Model.Measure();
    pivotExtendedPrice.dataMember("ExtendedPrice");

    // Create the Pivot dashboard item and bind it to data.
    var pivotItem = new Model.PivotItem();
    pivotItem.name('pivot');
    pivotItem.dataSource(sqlDataSource.componentName());
    pivotItem.dataMember(sqlDataSource.queries()[0].name());

    pivotItem.columns.push(pivotCountry, pivotFullName);
    pivotItem.rows.push(pivotCategoryName, pivotProductName); 
    pivotItem.values.push(pivotExtendedPrice);

    control.dashboard().items.push(pivotItem);
    // ...
    control.dashboard().rebuildLayout();
}

Inherited Members

colorScheme

coloringOptions

componentName

customProperties

dataItems

dataMember

dataSource

disposed

filterString

formatRules

hiddenDimensions

hiddenMeasures

isDisposed

isMasterFilterCrossDataSource

itemType

name

parentContainer

showCaption

visibleDataFilterString

dispose

getInfo

getUniqueNamePrefix

Inheritance

SerializableModel TypedSerializableModel DashboardItem DataDashboardItem PivotItem

constructor

Initializes a new instance of the PivotItem class.

Declaration

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

Parameters

NameTypeDescription
dashboardItemJSONany

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

autoExpandColumnGroups Property

Declaration

ts
autoExpandColumnGroups: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

autoExpandRowGroups Property

Declaration

ts
autoExpandRowGroups: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

columns Property

Declaration

ts
columns: ko.ObservableArray<DevExpress.Dashboard.Model.Dimension>

Property Value

Type
ObservableArray<Dimension>

columnTotalsLocation Property

Declaration

ts
columnTotalsLocation: ko.Observable<DevExpress.Dashboard.Model.PivotColumnTotalsPosition>

Property Value

Type
Observable<PivotColumnTotalsPosition>

interactivityOptions Property

Declaration

ts
interactivityOptions: DevExpress.Dashboard.Model.FilterableDashboardItemInteractivityOptions

Property Value

Type
FilterableDashboardItemInteractivityOptions

layoutType Property

Declaration

ts
layoutType: ko.Observable<DevExpress.Dashboard.Model.PivotLayoutType>

Property Value

Type
Observable<PivotLayoutType>

rows Property

Declaration

ts
rows: ko.ObservableArray<DevExpress.Dashboard.Model.Dimension>

Property Value

Type
ObservableArray<Dimension>

rowTotalsLocation Property

Declaration

ts
rowTotalsLocation: ko.Observable<DevExpress.Dashboard.Model.PivotRowTotalsPosition>

Property Value

Type
Observable<PivotRowTotalsPosition>

showColumnGrandTotals Property

Declaration

ts
showColumnGrandTotals: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

showColumnTotals Property

Declaration

ts
showColumnTotals: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

showRowGrandTotals Property

Declaration

ts
showRowGrandTotals: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

showRowTotals Property

Declaration

ts
showRowTotals: ko.Observable<boolean>

Property Value

Type
Observable<boolean>

values Property

Declaration

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

Property Value

Type
ObservableArray<Measure>

valuesPosition Property

Declaration

ts
valuesPosition: ko.Observable<DevExpress.Dashboard.Model.PivotValuesPosition>

Property Value

Type
Observable<PivotValuesPosition>