Back to Devexpress

TreemapItem Class

dashboard-js-devexpress-dot-dashboard-dot-model-10542b64.md

latest9.9 KB
Original Source

TreemapItem Class

A Treemap dashboard item that allows you to display large amounts of hierarchically structured (tree-structured) data.

Declaration

ts
export class TreemapItem extends DataDashboardItem

Remarks

The Treemap dashboard item can be used to visualize data in nested rectangles that are called tiles.

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

Example

The following example shows how to create the Treemap 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 createTreemapItem() { 
    // Create data items for the Treemap dashboard item.
    var treemapCategoryName = new Model.Dimension();
    treemapCategoryName.dataMember("CategoryName");
    var treemapProductName = new Model.Dimension();
    treemapProductName.dataMember("ProductName");
    var treemapUnitPrice = new Model.Measure();
    treemapUnitPrice.dataMember("UnitPrice");

    // Create the Treemap dashboard item and bind it to data.
    var treemapItem = new Model.TreemapItem();
    treemapItem.name('treemap');
    treemapItem.dataSource(sqlDataSource.componentName());
    treemapItem.dataMember(sqlDataSource.queries()[0].name());

    treemapItem.arguments.push(treemapCategoryName, treemapProductName);
    treemapItem.values.push(treemapUnitPrice);

    treemapItem.interactivityOptions.isDrillDownEnabled(true);

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

Inherited Members

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 TreemapItem

constructor

Initializes a new instance of the TreemapItem class.

Declaration

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

Parameters

NameTypeDescription
modelJsonany

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

arguments Property

Declaration

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

Property Value

Type
ObservableArray<Dimension>

coloringOptions Property

Declaration

ts
coloringOptions: DevExpress.Dashboard.Model.DashboardItemColoringOptions

Property Value

Type
DashboardItemColoringOptions

colorScheme Property

Declaration

ts
colorScheme: ko.ObservableArray<DevExpress.Dashboard.Model.ColorSchemeEntry>

Property Value

Type
ObservableArray<ColorSchemeEntry>

groupsLabelContentType Property

Declaration

ts
groupsLabelContentType: ko.Observable<DevExpress.Dashboard.Model.TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

groupsTooltipContentType Property

Declaration

ts
groupsTooltipContentType: ko.Observable<DevExpress.Dashboard.Model.TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

interactivityOptions Property

Declaration

ts
interactivityOptions: DevExpress.Dashboard.Model.DashboardItemInteractivityOptions

Property Value

Type
DashboardItemInteractivityOptions

layoutAlgorithm Property

Declaration

ts
layoutAlgorithm: ko.Observable<DevExpress.Dashboard.Model.DashboardTreemapLayoutAlgorithm>

Property Value

Type
Observable<DashboardTreemapLayoutAlgorithm>

layoutDirection Property

Declaration

ts
layoutDirection: ko.Observable<DevExpress.Dashboard.Model.DashboardTreemapLayoutDirection>

Property Value

Type
Observable<DashboardTreemapLayoutDirection>

tilesLabelContentType Property

Declaration

ts
tilesLabelContentType: ko.Observable<DevExpress.Dashboard.Model.TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

tilesTooltipContentType Property

Declaration

ts
tilesTooltipContentType: ko.Observable<DevExpress.Dashboard.Model.TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

values Property

Declaration

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

Property Value

Type
ObservableArray<Measure>