Generate accessible SVG graphs for Laravel Blades
anthonyedmonds/laravel-graph is a Laravel package for generate accessible svg graphs for laravel blades.
It currently has 0 GitHub stars and 115 downloads on Packagist (latest version 0.0.5).
Install it with composer require anthonyedmonds/laravel-graph.
Discover more Laravel packages by anthonyedmonds
or browse all Laravel packages to compare alternatives.
Last updated
Add ARIA-accessible graphs to Laravel systems.
Each graph is fully described, keyboard navigable, screen-reader accessible, and provides an alternative HTML table.
Each graph can be created using the provided blade templates, and customised via the attributes.
<x-laravel-graph::line-chart
caption="Performance over the last day"
:data="$collection"
description="Server performance over the last 24 hours"
horizontal-axis-caption="Time log taken"
horizontal-axis-key="created_at"
vertical-axis-caption="CPU usage"
/>
| Attribute | Type | Default | Notes |
|-----------------------|-------------|------------------|--------------------------------------------------------------------------------------|
| caption | string | Required | The caption for the graph |
| description | string | Required | A description of what the graph shows |
| data | Collection | Required | The graph data |
| horizontalAxisKey | string | Required | The key in $data for the horizontal axis |
| horizontalAxisCaption | string | Required | The caption for the horizontal axis |
| verticalAxisCaption | string | Required | The caption for the vertical axis |
| verticalAxisKeys | array | null | Keys must be present in $data, automatically fetched from $data when null |
| width | int | 630 | The base width of the graph in pixels |
| height | int | 340 | The base height of the graph in pixels |
| id | string | null | The ID for the graph, automatically generated when null |
| verticalAxisUnit | string | '' | The unit of measurement for the vertical axis |
| verticalAxisMax | int|string | null | The maximum value of the vertical axis, automatically derived from $data when null |
| verticalAxisMin | int|string | null | The minimum value of the vertical axis, automatically derived from $data when null |
| palette | Palette | Palette::Default | The colour palette to use |
I won't lie, it's a little rough around the edges.
I started work on this back in early 2023, and had to abandon the project.
This initial release gets the line chart over the edge.
The graph is currently hardcoded to the GOV.UK design system.