ID del nivel que se muestra al iniciar el gráfico.
Explorar y abrir detalle
Selecciona un dato y pulsa Ver detalle; Volver recupera la vista anterior.
Ejemplo de exploración
Configuración
Ajusta la altura máxima en todos los niveles. En contenedores estrechos, la gráfica circular se mantiene cuadrada y su ancho limita la altura.
Código del ejemplo
Copia el ejemplo con la configuración aplicada.
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": "donut",
"data": [
{
"id": "north",
"label": "Norte",
"value": 40
},
{
"id": "south",
"label": "Sur",
"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": "Pedidos",
"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": "En línea",
"value": 12
},
{
"id": "store",
"label": "Tienda",
"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": "es",
"theme": "light",
toolbar: {
actions: [ChartToolbarAction.Csv, ChartToolbarAction.Png, ChartToolbarAction.Svg],
position: ChartToolbarPosition.Top,
}
},
"nodes": {
"regions": {
"title": "Explora las regiones",
"description": "Selecciona Norte y abre su detalle.",
"height": 220,
"legend": {
"visible": true,
"position": "bottom",
"interactive": true
},
"appearance": {
"colors": [
"#2C6DCD",
"#638A35"
],
"dataLabels": true
}
},
"north": {
"title": "Norte · detalle original",
"description": "A: 0 · B: 10 · C: 30. Abre C para ver los canales.",
"height": 220,
"unit": "pedidos",
"legend": {
"position": "bottom"
},
"viewport": {
"axes": "x",
"controls": true
},
"appearance": {}
},
"channel": {
"title": "C · canales",
"height": 220,
"unit": "pedidos",
"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(); }Datos, opciones y eventos
Los enlaces usan los IDs originales. Selecciona un punto y abre su detalle. Al volver se recupera la vista anterior.