{# Chart Macros ============ Reusable chart components using Chart.js with Alpine.js integration. Prerequisites: Add Chart.js CDN to your base template: Usage: {% from 'shared/macros/charts.html' import chart_card, line_chart, bar_chart, doughnut_chart %} {# Line chart in a card #} {{ chart_card('salesChart', 'Monthly Sales', 'line', chart_config) }} {# Standalone bar chart #} {{ bar_chart('ordersChart', chart_data, height='300px') }} #} {# Chart Card ========== A card container with a chart and optional dropdown menu. Parameters: - id: Unique chart ID (used for canvas element) - title: Card title - chart_type: 'line' | 'bar' | 'doughnut' | 'pie' (default: 'line') - height: Chart height (default: '300px') - show_menu: Whether to show dropdown menu (default: true) - subtitle: Optional subtitle text #} {% macro chart_card(id, title, chart_type='line', height='300px', show_menu=true, subtitle=none) %}
{{ subtitle }}
{% endif %}