Declara las gráficas que forman la composición. Cada panel tiene su propio ID y sus propios datos.
Ventana numérica enlazada
Dominios X explícitos e iguales permiten coordinar valores originales sin compartir Y.
Demo interactiva
Configuración
En automático, los paneles comparten fila cuando hay espacio. Usa una columna para compararlos en vertical.
Automática
Código del ejemplo
Copia el ejemplo con la configuración aplicada.
JS/TS · TypeScript
import { ChartToolbarAction, ChartToolbarPosition } from '@neural-charts/web';
import { createChartPanels, type ChartPanelsData, type ChartPanelsOptions } from '@neural-charts/web/panels';
const data: ChartPanelsData = {
"panels": [
{
"id": "overview",
"data": {
"type": "line",
"axes": {
"x": {
"type": "linear",
"domain": [
0,
70
],
"nice": false
},
"y": {
"type": "linear",
"domain": [
0,
100
],
"nice": false
}
},
"series": [
{
"id": "sessions",
"name": "Sesiones",
"data": [
{
"id": "p0",
"x": 0,
"y": 20
},
{
"id": "p1",
"x": 10,
"y": 45
},
{
"id": "p2",
"x": 20,
"y": 30
},
{
"id": "p3",
"x": 30,
"y": 65
},
{
"id": "p4",
"x": 40,
"y": 42
},
{
"id": "p5",
"x": 50,
"y": 75
},
{
"id": "p6",
"x": 60,
"y": 60
},
{
"id": "p7",
"x": 70,
"y": 80
}
]
}
]
}
},
{
"id": "detail",
"data": {
"type": "line",
"axes": {
"x": {
"type": "linear",
"domain": [
0,
70
],
"nice": false
},
"y": {
"type": "linear",
"domain": [
0,
100
],
"nice": false
}
},
"series": [
{
"id": "sessions",
"name": "Sesiones",
"data": [
{
"id": "p0",
"x": 0,
"y": 20
},
{
"id": "p1",
"x": 10,
"y": 45
},
{
"id": "p2",
"x": 20,
"y": 30
},
{
"id": "p3",
"x": 30,
"y": 65
},
{
"id": "p4",
"x": 40,
"y": 42
},
{
"id": "p5",
"x": 50,
"y": 75
},
{
"id": "p6",
"x": 60,
"y": 60
},
{
"id": "p7",
"x": 70,
"y": 80
}
]
}
]
}
}
],
"viewportLinks": [
{
"id": "original-x",
"axis": "x",
"panelIds": [
"overview",
"detail"
]
}
]
};
const options: ChartPanelsOptions = {
chart: {
"animation": {
"enabled": true
},
"locale": "es",
"theme": "light",
toolbar: {
actions: [ChartToolbarAction.Csv, ChartToolbarAction.Png, ChartToolbarAction.Svg],
position: ChartToolbarPosition.Top,
}
},
"columns": "auto",
"panels": {
"overview": {
"title": "Rango Y completo",
"height": 220,
"unit": "sesiones",
"legend": {
"visible": true,
"position": "bottom",
"interactive": true
},
"viewport": {
"axes": "xy",
"controls": true
},
"appearance": {
"colors": [
"#2C6DCD"
],
"markers": true
}
},
"detail": {
"title": "Detalle Y independiente",
"height": 220,
"unit": "sesiones",
"legend": {
"visible": true,
"position": "bottom",
"interactive": true
},
"viewport": {
"axes": "xy",
"controls": true,
"value": {
"y": [
20,
80
]
}
},
"appearance": {
"colors": [
"#2C6DCD"
],
"markers": true
}
}
}
};
const host = document.createElement('div');
document.body.append(host);
const chart = createChartPanels(host, data, options, { instanceId: 'rollout' });
if (chart.status === 'invalid') throw new Error(chart.diagnostic.message);
export function dispose() { chart.value.destroy(); host.remove(); }Datos, opciones y eventos
Identifica cada panel y enlaza los ejes X que comparten dominio. Puedes aplicar opciones comunes y sustituirlas por panel.