TreeMap

The TreeMap is a widget that displays hierarchical data by using nested rectangles.

Included in: dx.viz.js, dx.viz-web.js, dx.all.js
Module: viz/tree_map
TreeMap interactive configuration
Copy Code
Copy to Codepen
$("#treemap").dxTreeMap({
});

In the TreeMap widget, hierarchical data is represented by a set of nested rectangles whose sizes are proportional to the visualized values. TreeMap operates with flat and hierarchical data sources. Also, it can visualize a hierarchy reconstructed from a flat data source.

TreeMap provides three layout algorithms out-of-the-box along with the capability to implement your own algorithm. In addition, the widget includes API methods that enable you to implement the drill down feature. Moreover, TreeMap supports all interactive features available in other DevExtreme Data Visualization Widgets: click, hover and selection.

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

  • jQuery
    Use the dxTreeMap jQuery plug-in.

    HTML
    <div id="treeMapContainer"></div>
    JavaScript
    $("#treeMapContainer").dxTreeMap({
        dataSource: data,
        labelField: 'text',
        valueField: 'val'
    });
  • Knockout
    Add a div element and apply dxTreeMap binding to this element.

    HTML
    <div data-bind="dxTreeMap: {
        dataSource: data,
        labelField: 'text',
        valueField: 'val'
    }"></div>
  • AngularJS
    Add a div element and apply the dx-tree-map directive to this element.

    HTML
    <div dx-tree-map="{
        dataSource: data,
        labelField: 'text',
        valueField: 'val'
    }"></div>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

View Demo Watch Video

Configuration

This section describes properties that configure the contents, behavior and appearance of the TreeMap widget.

Methods

This section describes methods that can be called to manipulate the TreeMap widget.

Events

This section describes events fired by this widget.

Node

This section describes fields and methods that can be used in code to manipulate a Node object.

Node objects are accessible within certain event handlers, for example, onNodesInitialized, onNodesRendering, etc. Also, you can obtain these objects using the getRootNode() and getCurrentNode() methods.