Declares the charts in the composition. Each panel has its own ID and chart data.
Panels with linked zoom
Compare latency and errors after a rollout. Zoom either panel to inspect the same time range. Each panel keeps its own vertical scale and legend.
Live demo
Configuration
With automatic layout, panels share a row when space allows. Use one column to compare them vertically.
Automatic
Example code
Copy the example with its current settings.
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": "latency",
"data": {
"type": "line",
"axes": {
"x": {
"type": "time",
"domain": [
1768381200000,
1768384500000
]
},
"y": {
"type": "linear",
"includeZero": true
}
},
"series": [
{
"id": "observed",
"name": "p95 latency",
"data": [
{
"id": "sample-0",
"x": 1768381200000,
"y": 122
},
{
"id": "sample-1",
"x": 1768381500000,
"y": 116
},
{
"id": "sample-2",
"x": 1768381800000,
"y": 131
},
{
"id": "sample-3",
"x": 1768382100000,
"y": 148
},
{
"id": "sample-4",
"x": 1768382400000,
"y": 237
},
{
"id": "sample-5",
"x": 1768382700000,
"y": 186
},
{
"id": "sample-6",
"x": 1768383000000,
"y": 147
},
{
"id": "sample-7",
"x": 1768383300000,
"y": 126
},
{
"id": "sample-8",
"x": 1768383600000,
"y": 120
},
{
"id": "sample-9",
"x": 1768383900000,
"y": 113
},
{
"id": "sample-10",
"x": 1768384200000,
"y": 119
},
{
"id": "sample-11",
"x": 1768384500000,
"y": 115
}
]
}
]
}
},
{
"id": "errors",
"data": {
"type": "line",
"axes": {
"x": {
"type": "time",
"domain": [
1768381200000,
1768384500000
]
},
"y": {
"type": "linear",
"includeZero": true
}
},
"series": [
{
"id": "observed",
"name": "Errors",
"data": [
{
"id": "sample-0",
"x": 1768381200000,
"y": 1
},
{
"id": "sample-1",
"x": 1768381500000,
"y": 2
},
{
"id": "sample-2",
"x": 1768381800000,
"y": 1
},
{
"id": "sample-3",
"x": 1768382100000,
"y": 3
},
{
"id": "sample-4",
"x": 1768382400000,
"y": 15
},
{
"id": "sample-5",
"x": 1768382700000,
"y": 9
},
{
"id": "sample-6",
"x": 1768383000000,
"y": 4
},
{
"id": "sample-7",
"x": 1768383300000,
"y": 2
},
{
"id": "sample-8",
"x": 1768383600000,
"y": 2
},
{
"id": "sample-9",
"x": 1768383900000,
"y": 1
},
{
"id": "sample-10",
"x": 1768384200000,
"y": 1
},
{
"id": "sample-11",
"x": 1768384500000,
"y": 1
}
]
}
]
}
}
],
"viewportLinks": [
{
"id": "rollout",
"axis": "x",
"panelIds": [
"latency",
"errors"
]
}
]
};
const options: ChartPanelsOptions = {
chart: {
"animation": {
"enabled": true
},
"locale": "en",
"theme": "light",
"height": 320,
"viewport": {
"axes": "x",
"controls": true
},
"tooltip": {
"crosshair": true
},
"formatting": {
"date": {
"hour": "2-digit",
"minute": "2-digit",
"hourCycle": "h23"
}
},
toolbar: {
actions: [ChartToolbarAction.Csv, ChartToolbarAction.Png, ChartToolbarAction.Svg],
position: ChartToolbarPosition.Top,
}
},
"panels": {
"latency": {
"title": "p95 latency (ms)"
},
"errors": {
"title": "Errors per interval",
"appearance": {
"colors": [
"#A75028"
]
}
}
},
"columns": "auto"
};
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(); }Data, options and events
Identify each panel and link X axes that share a domain. Apply common options and override them per panel.