Panel specs, flat or as a 2D grid in reading order.
Grid options; root is required.
A single Maidr object spanning all panels.
whenGoogleChartsReady(charts, google.visualization.events, () => {
const maidr = createMaidrFromGoogleCharts(
panels, // [{ chart, dataTable, container, chartType, title }, …]
{ root: document.getElementById('grid'), layout: { columns: 2 } },
);
root.setAttribute('maidr', JSON.stringify(maidr));
});
charts.forEach((chart, i) => chart.draw(dataTables[i], drawOptions[i]));
Creates a single multi-panel MAIDR figure from several rendered Google Charts instances (Google Charts has no native facet/trellis concept — a "faceted" page is N chart instances in N containers).
Users navigate the resulting figure at subplot level first (arrow keys move between panels,
Enterdrills into a panel,Escreturns).Grid shape, in priority order:
panelsis a 2D array (GoogleChartPanel[][]) — used directly as the subplot grid (rows may be ragged, but never empty).panelsis flat andoptions.layoutis given — chunked row-major.Always supply the grid in visual reading order (top-left panel first).
Call this after every panel has finished rendering — see whenGoogleChartsReady — then set the returned object as the
maidrattribute onoptions.root(NOT on the individual panel containers):