Skip to main content
A newer version of this page is available. .

TreemapItem Class

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

Declaration

export class TreemapItem extends DataDashboardItem

Remarks

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

wdd-treemap-grouped

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.

// 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

DevExpress.Dashboard.Model.DataDashboardItem.componentName
DevExpress.Dashboard.Model.DataDashboardItem.name
DevExpress.Dashboard.Model.DataDashboardItem.parentContainer
DevExpress.Dashboard.Model.DataDashboardItem.showCaption
DevExpress.Dashboard.Model.DataDashboardItem.getUniqueNamePrefix

Inheritance

constructor

Initializes a new instance of the TreemapItem class.

Declaration

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

Parameters

Name Type Description
modelJson any

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

serializer DxDesigner.Analytics.Utils.ModelSerializer

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

Properties

arguments Property

Declaration

arguments: ko.ObservableArray<Dimension>

Property Value

Type
ObservableArray<Dimension>

coloringOptions Property

Declaration

coloringOptions: DashboardItemColoringOptions

Property Value

Type
DashboardItemColoringOptions

colorScheme Property

Declaration

colorScheme: ko.ObservableArray<ColorSchemeEntry>

Property Value

Type
ObservableArray<ColorSchemeEntry>

groupsLabelContentType Property

Declaration

groupsLabelContentType: ko.Observable<TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

groupsTooltipContentType Property

Declaration

groupsTooltipContentType: ko.Observable<TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

interactivityOptions Property

Declaration

interactivityOptions: DashboardItemInteractivityOptions

Property Value

Type
DashboardItemInteractivityOptions

layoutAlgorithm Property

Declaration

layoutAlgorithm: ko.Observable<DashboardTreemapLayoutAlgorithm>

Property Value

Type
Observable<DashboardTreemapLayoutAlgorithm>

layoutDirection Property

Declaration

layoutDirection: ko.Observable<DashboardTreemapLayoutDirection>

Property Value

Type
Observable<DashboardTreemapLayoutDirection>

tilesLabelContentType Property

Declaration

tilesLabelContentType: ko.Observable<TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

tilesTooltipContentType Property

Declaration

tilesTooltipContentType: ko.Observable<TreemapValueType>

Property Value

Type
Observable<TreemapValueType>

values Property

Declaration

values: ko.ObservableArray<Measure>

Property Value

Type
ObservableArray<Measure>

Methods

getInfo Method

For internal use.

Declaration

getInfo(): DxDesigner.Analytics.Utils.ISerializationInfoArray

Returns

Type Description
DxDesigner.Analytics.Utils.ISerializationInfoArray