ID of the level shown when the chart starts.
Explore and open details
Select a region, open its detail and navigate back through the same data hierarchy.
Drilldown example
Configuration
Set the maximum height at every level. In narrow containers, the circular plot stays square and its width limits the height.
Example code
Copy the example with its current settings.
JS/TS · TypeScript
import { ChartToolbarAction, ChartToolbarPosition } from '@neural-charts/web';
import { createChartDrilldown, type ChartDrilldownData, type ChartDrilldownOptions } from '@neural-charts/web/drilldown';
const data: ChartDrilldownData = {
"rootId": "regions",
"nodes": [
{
"id": "regions",
"data": {
"type": "pie",
"data": [
{
"id": "north",
"label": "North",
"value": 40
},
{
"id": "south",
"label": "South",
"value": 60
}
]
}
},
{
"id": "north",
"data": {
"type": "column",
"axes": {
"x": {
"type": "category",
"values": [
{
"id": "a",
"label": "A"
},
{
"id": "b",
"label": "B"
},
{
"id": "c",
"label": "C"
}
]
},
"y": {
"type": "linear"
}
},
"series": [
{
"id": "orders",
"name": "Orders",
"data": [
{
"id": "a",
"x": "a",
"y": 0
},
{
"id": "b",
"x": "b",
"y": 10
},
{
"id": "c",
"x": "c",
"y": 30
}
]
}
]
}
},
{
"id": "channel",
"data": {
"type": "donut",
"data": [
{
"id": "online",
"label": "Online",
"value": 12
},
{
"id": "store",
"label": "Store",
"value": 18
}
]
}
}
],
"links": [
{
"fromNodeId": "regions",
"datumId": {
"seriesId": "north",
"pointId": "north"
},
"toNodeId": "north"
},
{
"fromNodeId": "north",
"datumId": {
"seriesId": "orders",
"pointId": "c"
},
"toNodeId": "channel"
}
]
};
const options: ChartDrilldownOptions = {
chart: {
"animation": {
"enabled": true
},
"locale": "en",
"theme": "light",
toolbar: {
actions: [ChartToolbarAction.Csv, ChartToolbarAction.Png, ChartToolbarAction.Svg],
position: ChartToolbarPosition.Top,
}
},
"nodes": {
"regions": {
"title": "Explore the regions",
"description": "Select North and open its detail.",
"height": 220,
"legend": {
"visible": true,
"position": "bottom",
"interactive": true
},
"appearance": {
"colors": [
"#2C6DCD",
"#638A35"
],
"dataLabels": true
}
},
"north": {
"title": "North · original breakdown",
"description": "A: 0 · B: 10 · C: 30. Open C to see the channels.",
"height": 220,
"unit": "orders",
"legend": {
"position": "bottom"
},
"viewport": {
"axes": "x",
"controls": true
},
"appearance": {}
},
"channel": {
"title": "C · channels",
"height": 220,
"unit": "orders",
"legend": {
"position": "bottom"
},
"appearance": {}
}
}
};
const host = document.createElement('div');
document.body.append(host);
const result = createChartDrilldown(host, data, options, { instanceId: 'regional-orders' });
if (result.status === 'invalid') throw new Error(result.diagnostic.message);
export function dispose() { result.value.destroy(); host.remove(); }Data, options and events
Links use original IDs. Select a point and open its detail. Going back restores the previous view.