Angular UI Components Documentation
The Angular TreeMap displays hierarchical data as a set of nested rectangles. This guide adds the Angular TreeMap (jqxTreeMap) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxtreemap 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxTreeMapModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxTreeMapModule } from 'jqwidgets-ng/jqxtreemap';
@Component({
selector: 'app-root',
imports: [jqxTreeMapModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Custom Rendering demo.
<jqxTreeMap
[width]="getWidth()" [height]="300"
[colorRanges]="colorRanges"
[renderCallbacks]="renderCallbacks"
[source]="data">
</jqxTreeMap>
<span style="font-size: 13px; font-family: Verdana;">Non-mobile web browser usage for Wikimedia visitors as of March 2014</span>
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxTreeMapModule } from 'jqwidgets-ng/jqxtreemap';
@Component({
imports: [CommonModule, jqxTreeMapModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
data: any[] = [
{ label: 'Chrome', value: 44.06, color: '#37c837' },
{ label: 'Internet Explorer', value: 22.08, color: '#0066ff' },
{ label: 'Firefox', value: 18.17, color: '#ed7b0f' },
{ label: 'Others', value: 9.07, color: '#818181' },
{ label: 'Opera', value: 3.38, color: '#9a0900' },
{ label: 'Safari', value: 3.24, color: '#4dbff1' }
];
renderCallbacks: any = {
'*': (element: any, data: any) => {
element.css({ color: '#ffffff' });
element.html(
'<span style="font-size: 11px;" class="jqx-treemap-label">' +
data.label +
', ' +
data.value +
'%</span>'
);
return true;
}
};
getWidth(): any {
if (document.body.offsetWidth < 850) {
return '90%';
}
return 850;
}
colorRanges: any[] = [
{ min: 1254040000, max: 1454040000, color: '#de290b' },
{ min: 1054040000, max: 1254039999, color: '#de440c' },
{ min: 300000000, max: 1054040000, color: '#ea7707' },
{ min: 210000000, max: 460000000, color: '#ee8a06' },
{ min: 190000000, max: 209999999, color: '#f19505' },
{ min: 180000000, max: 189999999, color: '#f6a903' },
{ min: 160000000, max: 179999999, color: '#f8b203' },
{ min: 140000000, max: 159999999, color: '#fabb02' },
{ min: 100000000, max: 139999999, color: '#fbbf01' },
{ min: 90000000, max: 99999999, color: '#fbcd01' },
{ min: 10000000, max: 89999999, color: '#fbde33' }
];
}
Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, bindingComplete: This event is triggered when the jqxTreeMap's source property is set to point to jqxDataAdapter instance and the jqxDataAdapter's binding is finished.
<jqxTreeMap (onBindingComplete)="onBindingComplete($event)"></jqxTreeMap>
onBindingComplete(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, destroy: Destroy the jqxTreeMap widget.
<jqxTreeMap #myTreeMap></jqxTreeMap>
import { Component, viewChild } from '@angular/core';
import { jqxTreeMapModule, jqxTreeMapComponent } from 'jqwidgets-ng/jqxtreemap';
@Component({
selector: 'app-root',
imports: [jqxTreeMapModule],
templateUrl: './app.html'
})
export class App {
readonly myTreeMap = viewChild.required<jqxTreeMapComponent>('myTreeMap');
run(): void {
this.myTreeMap().destroy();
}
}