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
Adjust chart height at every drilldown level.
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": "column",
"axes": {
"x": {
"type": "category",
"values": [
{
"id": "north",
"label": "North"
},
{
"id": "south",
"label": "South"
}
]
},
"y": {
"type": "linear"
}
},
"series": [
{
"id": "orders",
"name": "Orders",
"data": [
{
"id": "north",
"x": "north",
"y": 40
},
{
"id": "south",
"x": "south",
"y": 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": "orders",
"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,
"layout": {
"orientation": "vertical"
},
"axes": {
"grid": true,
"x": {
"visible": true,
"title": "Region"
},
"y": {
"visible": true,
"title": "Orders"
}
},
"legend": {
"visible": true,
"position": "bottom",
"interactive": true
},
"appearance": {
"colors": [
"#2C6DCD"
],
"dataLabels": false
}
},
"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.