@echarts-extension/voronoi-treemap
v0.1.0
Published
ECharts extension chart for weighted Voronoi treemaps
Readme
@echarts-extension/voronoi-treemap
Language: English | 中文
ECharts extension chart for weighted Voronoi treemaps. Import this package for side effects to register series.type = 'voronoiTreemap'.

Install
npm install echarts @echarts-extension/voronoi-treemapBasic Usage
import * as echarts from 'echarts';
import '@echarts-extension/voronoi-treemap';
const chart = echarts.init(document.getElementById('main'));
chart.setOption({
series: [
{
type: 'voronoiTreemap',
data: {
name: 'Portfolio',
children: [
{ name: 'Core', children: [{ name: 'Search', value: 48 }, { name: 'Ads', value: 32 }] },
{ name: 'Growth', children: [{ name: 'Cloud', value: 34 }, { name: 'AI', value: 26 }] }
]
},
gap: 2,
maxIteration: 18,
label: { show: true, showInternal: false }
}
]
});Data
Use one root object, an array of roots, or array rows:
- Hierarchies use
childrenby default. - Flat array rows can use
dimensions,nameField, andvalueField. childrenField,nameField, andvalueFieldsupport custom shapes.- Set
rootVisible: falseto hide a synthetic root.
Options
This table is generated by scripts/sync-options-from-readmes.mjs --write-readmes. Update the English README option table, then run npm run docs:sync-options to refresh the docs page.
| Option | Description | Values |
| --- | --- | --- |
| type | Registers this package series with ECharts. | 'voronoiTreemap' |
| silent | Disables mouse events for the series when true. | boolean |
| width | Series box width. | number \| string (pixel or percent) |
| height | Series box height. | number \| string (pixel or percent) |
| top | Distance from the top of the chart container. | number \| string (pixel or percent) |
| right | Distance from the right of the chart container. | number \| string (pixel or percent) |
| bottom | Distance from the bottom of the chart container. | number \| string (pixel or percent) |
| left | Distance from the left of the chart container. | number \| string (pixel or percent) |
| data | Hierarchical records to split into Voronoi cells. | Object \| Array<object \| unknown[]> |
| data.id | Record id. | string \| number |
| data.parentId | Parent record id. | string \| number |
| data.name | Display name. | string |
| data.value | Numeric value. | number |
| data.children | Child records. | Array<object> |
| data.children.id | Record id. | string \| number |
| data.children.parentId | Parent record id. | string \| number |
| data.children.name | Display name. | string |
| data.children.value | Numeric value. | number |
| data.children.children | Child records. | Array<object> |
| data.children.children.name | Display name. | string |
| data.children.children.value | Numeric value. | number |
| data.children.children.itemStyle | Per-record item style. | Object |
| data.children.children.itemStyle.color | Fill color. | string |
| data.children.children.itemStyle.fill | Alias for fill color. | string |
| data.children.children.itemStyle.opacity | Fill opacity. | number |
| data.children.children.itemStyle.borderColor | Border color. | string |
| data.children.children.itemStyle.borderWidth | Border width. | number |
| data.children.children.itemStyle.borderRadius | Corner radius. | number |
| data.children.children.itemStyle.shadowBlur | Shadow blur radius. | number |
| data.children.children.itemStyle.shadowColor | Shadow color. | string |
| data.children.children.itemStyle.lineWidth | Stroke width used by icon or shape styles. | number |
| data.children.children.label | Per-record label style. | Object |
| data.children.children.label.show | Shows labels when true. | boolean |
| data.children.children.label.color | Label text color. | string |
| data.children.children.label.fontSize | Label text size. | number |
| data.children.children.label.fontWeight | Label font weight. | string \| number |
| data.children.children.label.formatter | Formats label text. | string \| function |
| data.children.itemStyle | Per-record item style. | Object |
| data.children.itemStyle.color | Fill color. | string |
| data.children.itemStyle.fill | Alias for fill color. | string |
| data.children.itemStyle.opacity | Fill opacity. | number |
| data.children.itemStyle.borderColor | Border color. | string |
| data.children.itemStyle.borderWidth | Border width. | number |
| data.children.itemStyle.borderRadius | Corner radius. | number |
| data.children.itemStyle.shadowBlur | Shadow blur radius. | number |
| data.children.itemStyle.shadowColor | Shadow color. | string |
| data.children.itemStyle.lineWidth | Stroke width used by icon or shape styles. | number |
| data.children.label | Per-record label style. | Object |
| data.children.label.show | Shows labels when true. | boolean |
| data.children.label.color | Label text color. | string |
| data.children.label.fontSize | Label text size. | number |
| data.children.label.fontWeight | Label font weight. | string \| number |
| data.children.label.formatter | Formats label text. | string \| function |
| data.itemStyle | Per-record item style. | Object |
| data.itemStyle.color | Fill color. | string |
| data.itemStyle.fill | Alias for fill color. | string |
| data.itemStyle.opacity | Fill opacity. | number |
| data.itemStyle.borderColor | Border color. | string |
| data.itemStyle.borderWidth | Border width. | number |
| data.itemStyle.borderRadius | Corner radius. | number |
| data.itemStyle.shadowBlur | Shadow blur radius. | number |
| data.itemStyle.shadowColor | Shadow color. | string |
| data.itemStyle.lineWidth | Stroke width used by icon or shape styles. | number |
| data.label | Per-record label style. | Object |
| data.label.show | Shows labels when true. | boolean |
| data.label.color | Label text color. | string |
| data.label.fontSize | Label text size. | number |
| data.label.fontWeight | Label font weight. | string \| number |
| data.label.formatter | Formats label text. | string \| function |
| dimensions | Names tuple columns when data rows are arrays. | string[] |
| nameField | Field used for labels and names. | string \| number |
| valueField | Field used for cell area. | string \| number |
| childrenField | Field containing child nodes. | string |
| padding | Inset around the treemap. | number |
| gap | Gap between cells. | number |
| rootName | Display name for an implicit root node. | string |
| rootVisible | Shows the root cell when true. | boolean |
| sort | Sorts hierarchy nodes before layout. | boolean \| 'none' \| 'value' \| 'name' |
| maxIteration | Maximum iterations for Voronoi relaxation. | number |
| colors | Palette used by depth or groups. | string[] |
| itemStyle | Styles cells. | Object |
| itemStyle.color | Primary color. | string |
| itemStyle.opacity | Opacity. | number |
| itemStyle.borderColor | Border color. | string |
| itemStyle.borderWidth | Border width. | number |
| itemStyle.shadowBlur | Shadow blur radius. | number |
| itemStyle.shadowColor | Shadow color. | string |
| label | Styles cell labels. | Object |
| label.show | Shows labels when true. | boolean |
| label.color | Label text color. | string |
| label.fontSize | Label text size. | number |
| label.fontWeight | Label font weight. | string \| number |
| label.formatter | Formats label text. | string \| function |
| label.lineHeight | Label line height. | number |
| label.showInternal | Shows labels for internal hierarchy cells when true. | boolean |
| label.minArea | Minimum cell area required before the label is shown. | number |
| emphasis | Styles cells while hovered. | Object |
| emphasis.itemStyle | Nested item style option. | object |
| emphasis.itemStyle.color | Fill color. | string |
| emphasis.itemStyle.fill | Alias for fill color. | string |
| emphasis.itemStyle.opacity | Fill opacity. | number |
| emphasis.itemStyle.borderColor | Border color. | string |
| emphasis.itemStyle.borderWidth | Border width. | number |
| emphasis.itemStyle.borderRadius | Corner radius. | number |
| emphasis.itemStyle.shadowBlur | Shadow blur radius. | number |
| emphasis.itemStyle.shadowColor | Shadow color. | string |
| emphasis.itemStyle.lineWidth | Stroke width used by icon or shape styles. | number |
| emphasis.edgeStyle | Nested edgeStyle option. | object |
| emphasis.edgeStyle.color | Fill color. | string |
| emphasis.edgeStyle.fill | Alias for fill color. | string |
| emphasis.edgeStyle.opacity | Fill opacity. | number |
| emphasis.edgeStyle.borderColor | Border color. | string |
| emphasis.edgeStyle.borderWidth | Border width. | number |
| emphasis.edgeStyle.borderRadius | Corner radius. | number |
| emphasis.edgeStyle.shadowBlur | Shadow blur radius. | number |
| emphasis.edgeStyle.shadowColor | Shadow color. | string |
| emphasis.edgeStyle.lineWidth | Stroke width used by icon or shape styles. | number |
| emphasis.focus | Nested focus option. | string |
| emphasis.blurScope | Nested blurScope option. | string |
