Appearance
Multi-mount dashboards
Construct one Insight per container. Pass a stable instanceId so agents can address each chart. Duplicate ids on the same page throw — they would otherwise overwrite the registry entry and cross-contaminate persist keys.
html
<div id="a" style="height:300px"></div>
<div id="b" style="height:300px"></div>
<script type="module">
import { Insight, snapshotInsights } from 'https://unpkg.com/@chartbuddy.io/embed';
const a = new Insight('#a', {
instanceId: 'revenue',
persist: false,
chartData: chartA,
});
const b = new Insight('#b', {
instanceId: 'bridge',
persist: false,
chartData: chartB,
});
await Promise.all([a.ready, b.ready]);
// Agent: await snapshotInsights() → { charts: { revenue, bridge } }
</script>Update with setData / update / setChartData on the instance you own. Destroy before removing the element.
Live registry: window.__CHARTBUDDY_INSIGHTS__ / getInsights().
See the dashboard sample.