Getting Started
20 Mar 202324 minutes to read
This section explains you the steps required to create a TreeMap control and demonstrate its basic usage.
Dependencies
The following list of minimum dependencies are required to use the TreeMap control:
|-- @syncfusion/ej2-react-treemap
|-- @syncfusion/ej2-treemap
|-- @syncfusion/ej2-base
|-- @syncfusion/ej2-data
|-- @syncfusion/ej2-pdf-export
|-- @syncfusion/ej2-svg-base
|-- @syncfusion/ej2-react-base
Installation and configuration
To get started with the React application, create-react-app can be used to setup the application. To install create-react-app run the following command.
<div class='jsx'>
```
npm install -g create-react-app
```
</div>
To create basic React application, run the following command.
<div class='jsx'>
```
create-react-app quickstart
```
</div>
Now, the application is created in the quickstart folder. Run the following command one-by-one to navigate to the quickstart folder, and install the required npm packages.
```
cd quickstart
npm install
```
In the quickstart application, the Syncfusion component is added in the JavaScript file.
Creating a React application with TypeScript
To create React application with TypeScript, use the following command.
<div class='jsx'>
```
create-react-app quickstart --template typescript
```
</div>
Now, the application is created in the quickstart folder. Run the following command one-by-one to navigate to the quickstart folder, and install the required npm packages.
```
cd quickstart
npm install
```
Adding Syncfusion packages
All the available Essential JS 2 packages are published in npmjs.com public registry. To install TreeMap package, use the following command.
```
npm install @syncfusion/ej2-react-treemap --save
```
Add TreeMap to project
Now, the TreeMap component can be added in the application. To initialize the TreeMap control in the React application, import the TreeMap control in the src/App.js
or src/App.tsx as per the application. Please use the below code to include the TreeMap component in the application.
import * as React from 'react';
import * as ReactDOM from "react-dom";
import { TreeMapComponent } from '@syncfusion/ej2-react-treemap';
export function App() {
return ( <TreeMapComponent ></TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
Run the application
Since any data source has not been bound to the TreeMap, no item will be rendered. Only an empty SVG element is appended to the TreeMap container.
The TreeMap control is now included in the quickstart application. Use the following command to run the application.
npm start
Module injection
The TreeMap control is segregated into individual feature-wise modules. To use a particular feature, inject its feature module using the <Inject services={} />
method. Find the modules available in TreeMap and their descriptions as follows.
- TreeMapHighlight - Inject this provider to use highlight feature.
- TreeMapSelection - Inject this provider to use selection feature.
- TreeMapLegend - Inject this provider to use legend feature.
- TreeMapTooltip - Inject this provider to use tooltip series.
In the current application, the above basic TreeMap is modified to visualize international airport count in South America.
In this demo, the TreeMap is just rendered with labels. For this, you need not to import any modules.
Render TreeMap
This section explains how to render the TreeMap with data source.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject } from '@syncfusion/ej2-react-treemap';
export function App() {
return ( <TreeMapComponent
height= '350px'
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
leafItemSettings= { {
labelPath: 'State'
}}>
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject } from '@syncfusion/ej2-react-treemap';
export function App() {
return ( <TreeMapComponent
height= '350px'
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
leafItemSettings= { {
labelPath: 'State'
}}>
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
Here, the TreeMap is created with data source and set with the weightValuePath as count. You can customize the leaf level TreeMap items using the leafItemSettings. The properties such as fill, border, and labelPosition can be changed using the leafItemSettings.
Apply color mapping
The color mapping feature supports customization of item colors based on the underlying value of item received from bound data source. Specify the field name from the values that have to be compared for the item in the equalColorValuePath or rangeColorValuePath property.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { TreeMapComponent } from '@syncfusion/ej2-react-treemap';
export function App() {
return (
<TreeMapComponent
height="350px"
dataSource={[
{
Title: 'State wise International Airport count in South America',
State: 'Brazil',
Count: 25,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Colombia',
Count: 12,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Argentina',
Count: 9,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Ecuador',
Count: 7,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Chile',
Count: 6,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Peru',
Count: 3,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Venezuela',
Count: 3,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Bolivia',
Count: 2,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Paraguay',
Count: 2,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Uruguay',
Count: 2,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Falkland Islands',
Count: 1,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'French Guiana',
Count: 1,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Guyana',
Count: 1,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Suriname',
Count: 1,
Brand: 'Ford',
},
]}
weightValuePath="Count"
equalColorValuePath="Brand"
leafItemSettings={{
labelPath: 'State',
colorMapping: [
{
value: 'Ford',
color: '#634D6F',
},
{
value: 'Maruti',
color: '#B34D6D',
},
],
}}
></TreeMapComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { TreeMapComponent } from '@syncfusion/ej2-react-treemap';
export function App() {
return (
<TreeMapComponent
height="350px"
dataSource={[
{
Title: 'State wise International Airport count in South America',
State: 'Brazil',
Count: 25,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Colombia',
Count: 12,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Argentina',
Count: 9,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Ecuador',
Count: 7,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Chile',
Count: 6,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Peru',
Count: 3,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Venezuela',
Count: 3,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Bolivia',
Count: 2,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Paraguay',
Count: 2,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Uruguay',
Count: 2,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Falkland Islands',
Count: 1,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'French Guiana',
Count: 1,
Brand: 'Ford',
},
{
Title: 'State wise International Airport count in South America',
State: 'Guyana',
Count: 1,
Brand: 'Maruti',
},
{
Title: 'State wise International Airport count in South America',
State: 'Suriname',
Count: 1,
Brand: 'Ford',
},
]}
weightValuePath="Count"
equalColorValuePath="Brand"
leafItemSettings={{
labelPath: 'State',
colorMapping: [
{
value: 'Ford',
color: '#634D6F',
},
{
value: 'Maruti',
color: '#B34D6D',
},
],
}}
></TreeMapComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
Enable legend
You can show legend for the TreeMap by setting the visible property to true in legendSettings object and injecting the TreeMapLegend
module using the <Inject services={[TreeMapLegend]} />
.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend } from '@syncfusion/ej2-react-treemap';
export function App(){
return ( <TreeMapComponent
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={{
labelPath: 'State',
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend } from '@syncfusion/ej2-react-treemap';
export function App(){
return ( <TreeMapComponent
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={{
labelPath: 'State',
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
Add labels
The labels are added to show additional information of the items in TreeMap. By default, the visibility of the label is true. This can be customized using the showLabels property in leafItemSettings.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend } from '@syncfusion/ej2-react-treemap';
export function App() {
return ( <TreeMapComponent
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={ {
showLabels: true,
labelPath: 'State',
labelPosition: 'Center',
labelStyle: {
color: 'white'
},
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend } from '@syncfusion/ej2-react-treemap';
export function App() {
return ( <TreeMapComponent
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={ {
showLabels: true,
labelPath: 'State',
labelPosition: 'Center',
labelStyle: {
color: 'white'
},
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
Enable tooltip
The tooltips are used when labels cannot display information due to space constraints. Tooltips can be enabled by setting the visible property to true in tooltipSettings object and injecting the TreeMapTooltip
module using the <Inject services={[TreeMapTooltip]} />
.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend, TreeMapTooltip } from '@syncfusion/ej2-react-treemap';
export function App(){
return ( <TreeMapComponent
tooltipSettings={ {
visible: true
}}
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={ {
showLabels: true,
labelPath: 'State',
labelPosition: 'Center',
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapTooltip, TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from "react-dom";
import { TreeMapComponent, Inject, TreeMapLegend, TreeMapTooltip } from '@syncfusion/ej2-react-treemap';
export function App(){
return ( <TreeMapComponent
tooltipSettings={ {
visible: true
}}
dataSource={[
{ Title: 'State wise International Airport count in South America', State: "Brazil", Count: 25 },
{ Title: 'State wise International Airport count in South America', State: "Colombia", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Argentina", Count: 9 },
{ Title: 'State wise International Airport count in South America', State: "Ecuador", Count: 7 },
{ Title: 'State wise International Airport count in South America', State: "Chile", Count: 6 },
{ Title: 'State wise International Airport count in South America', State: "Peru", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Venezuela", Count: 3 },
{ Title: 'State wise International Airport count in South America', State: "Bolivia", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Paraguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Uruguay", Count: 2 },
{ Title: 'State wise International Airport count in South America', State: "Falkland Islands", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "French Guiana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Guyana", Count: 1 },
{ Title: 'State wise International Airport count in South America', State: "Suriname", Count: 1 },
]}
weightValuePath='Count'
equalColorValuePath='Count'
legendSettings={ {
visible: true,
position: 'Top',
shape: 'Rectangle'
}}
leafItemSettings={ {
showLabels: true,
labelPath: 'State',
labelPosition: 'Center',
colorMapping: [
{
value: 25,
color: '#634D6F'
},
{
value: 12,
color: '#B34D6D'
},
{
value: 9,
color: '#557C5C'
},
{
value: 7,
color: '#44537F'
},
{
value: 6,
color: '#637392'
},
{
value: 3,
color: '#7C754D'
},
{
value: 2,
color: '#2E7A64'
},
{
value: 1,
color: '#95659A'
},
]}}>
<Inject services={[TreeMapTooltip, TreeMapLegend]} />
</TreeMapComponent> );
}
const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);