Shared Chart Configuration & Utility Functions
Centralized utility module for Chart.js and D3.js visualizations across all 9 dashboard sections. Provides responsive configuration, empty/loading states, accessibility helpers, and cyberpunk theme integration.
Features
- Responsive Chart Configuration: Mobile-first responsive options for Chart.js
- Empty/Loading States: User-friendly fallback UI components
- Accessibility Helpers: ARIA labels, keyboard navigation, screen reader support
- Theme Integration: Cyberpunk color palette with CSS custom properties
- Number Formatting: Swedish locale formatting (1,234,567)
- Performance: Debounced resize handlers, lazy rendering
Usage Examples
// Responsive Chart.js configuration
const chart = new Chart(ctx, {
...ChartUtils.getResponsiveOptions('bar'),
data: { ... }
});
// Show loading state
ChartUtils.showLoadingState('partyEffectivenessChart');
// Handle empty data
if (!data || data.length === 0) {
ChartUtils.showEmptyState('partyEffectivenessChart', 'No party data available');
return;
}
- Version:
- 1.0.0
- Since:
- 2026
- License:
- Apache-2.0
- Source:
Requires
- module:Chart.js