Backend chart payload builders for Laravel Enso
laravel-enso/charts is a Laravel package for backend chart payload builders for laravel enso.
It currently has 17 GitHub stars and 62.724 downloads on Packagist (latest version 4.7.3).
Install it with composer require laravel-enso/charts.
Discover more Laravel packages by laravel-enso
or browse all Laravel packages to compare alternatives.
Last updated
Charts is Laravel Enso's backend chart payload builder for the @enso-ui/charts frontend package.
It provides fluent factories for the chart types used across Enso dashboards and reporting screens, then returns normalized arrays that can be serialized directly to the frontend. The package also centralizes default chart colors, plugin defaults, datalabel handling, and axis configuration so host applications can generate consistent Chart.js payloads without hand-crafting dataset structures.
This package comes pre-installed in Laravel Enso applications that render chart widgets or dashboard analytics.
For standalone installation inside an Enso-based application:
composer require laravel-enso/charts
The package auto-registers its service provider and merges the enso.charts configuration namespace.
If you need to publish the configuration file:
php artisan vendor:publish --tag=charts-config
or:
php artisan vendor:publish --tag=enso-config
get() call.colorsConfig().datalabels().config/enso/charts.php.use LaravelEnso\Charts\Factories\Bar;
$chart = (new Bar())
->title('Quarterly revenue')
->labels(['Q1', 'Q2', 'Q3', 'Q4'])
->datasets([
'Revenue' => [12000, 18000, 15000, 22000],
'Forecast' => [10000, 16000, 17000, 21000],
])
->gridlines()
->shortNumbers()
->get();
use LaravelEnso\Charts\Factories\Line;
$chart = (new Line())
->title('Users by month')
->labels(['Jan', 'Feb', 'Mar'])
->datasets([
'Users' => [20, 40, 35],
])
->fill()
->get();
use LaravelEnso\Charts\Factories\Bubble;
$chart = (new Bubble())
->title('Portfolio risk')
->labels(['Low risk', 'High risk'])
->datasets([
[
[12, 4, 10],
[18, 8, 25],
],
[
[9, 6, 15],
[15, 12, 20],
],
])
->get();
::: tip Tip
Bubble charts auto-scale point radius by default. If the dataset already contains the exact radius values you want to render, call disableAutoRadius() before get().
:::
LaravelEnso\Charts\Factories\Bar
Adds horizontal() and stackedScales() helpers for bar datasets.LaravelEnso\Charts\Factories\Line
Adds fill() for filled line charts.LaravelEnso\Charts\Factories\Bubble
Maps [x, y, radius] tuples into bubble datasets and can auto-scale radius values.LaravelEnso\Charts\Factories\Radar
Builds radar chart datasets.LaravelEnso\Charts\Factories\Pie
Builds pie chart payloads.LaravelEnso\Charts\Factories\Doughnut
Builds doughnut chart payloads.LaravelEnso\Charts\Factories\Polar
Builds polar area chart payloads.All chart factories inherit these methods from LaravelEnso\Charts\Factories\Chart:
title(string $title)labels(array $labels)datasets(array $datasets)ratio(float $ratio)option(string $option, mixed $value)plugin(string $plugin, mixed $config)shortNumbers(int $precision = 2)gridlines()autoYMin()datalabels(array $config)colorsConfig(array $colors)datasetConfig(string $dataset, array $config)xAxisConfig(array $config, ?string $dataset = 'x')yAxisConfig(array $config, ?string $dataset = 'y')get()The factories return arrays with this top-level structure:
typetitledataoptionsFor Cartesian charts, data contains:
labelsdatasetsFor bubble charts, data contains:
datasetsEach dataset is normalized for the target chart type and enriched with default Enso colors plus datalabel configuration.
Config file:
config/enso/charts.phpCurrent package options:
fillBackgroundOpacity
Opacity used when converting a hex color into an RGBA fill color.options
Default Chart.js options merged into each factory response.colors
Default Enso chart palette used when no custom colors are supplied.Required Enso packages:
Companion frontend package:
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!