treemap
is a component to show treemaps. For more information about this type of visualization please read this article.
Note: currently only one-level treemaps are supported. No formatters and event handlers are available as well (to be implemented).
Import the treemap
component:
import {Treemap} from 'react-vis';
Add the following code to your render function:
<Treemap
title={'My New Treemap'}
height={300}
data={
{
title: '',
opacity: 1,
children: [
{
title: 'dogs',
size: 100,
opacity: 10,
color: 1
},
{
title: 'cats',
size: 60,
opacity: 15,
color: 10
}
]
}
}
/>
Type: number
Width of the component.
Type: number
Height of the component.
Type: number
The padding between cells the cells of the heatmap in pixels.
Type: Object
The data for the component. The data
property is a tree-like structure.
Each point consists of following properties:
title
Type:string
The title to show inside the cell. Might be a string or a React component.size
Type:number
The relative size of the cell.opacity
(optional)
Type:number
The value to visualize the opacity with.color
(optional)
Type:number
The value to visualize the color with.children
(optional)
Type:Array
The children for the leaf.
Type: boolean|Object
Please refer to Animation doc for more information.