import { generateDashboardSection } from './content-generators/dashboard-section.js';
const section = generateDashboardSection({
data: {
title: 'Party Seat Distribution',
summary: 'Current Riksdag seat allocation after 2022 election.',
charts: [{
id: 'seat-chart',
type: 'bar',
title: 'Seats by Party',
labels: ['S', 'M', 'SD', 'C', 'V', 'KD', 'L', 'MP'],
datasets: [{
label: 'Seats',
data: [107, 68, 73, 24, 24, 19, 16, 18],
backgroundColor: ['#e8112d','#1b49dd','#dddd00','#009933','#da291c','#000077','#006ab3','#83cf39'],
}],
}],
},
lang: 'en',
});
articleData.sections = [...(articleData.sections ?? []), section];
Generate an embeddable dashboard section with Chart.js charts.
Returns a
TemplateSectionthat can be appended toArticleData.sections. Each chart is rendered as a<canvas>element with its Chart.js config stored in adata-chart-configattribute, consistent with the codebase's "no inline scripts" pattern. Client-side initialisation is NOT automatic — embedding pages must load Chart.js and run an initializer that readsdata-chart-config(e.g. the shared chart-factory module).