PHPackages                             laravel-enso/charts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravel-enso/charts

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laravel-enso/charts
===================

Backend chart payload builders for Laravel Enso

4.7.3(2mo ago)1762.8k↓11.3%56MITPHPPHP ^8.2CI failing

Since Mar 19Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/laravel-enso/charts)[ Packagist](https://packagist.org/packages/laravel-enso/charts)[ Docs](https://github.com/laravel-enso/charts)[ RSS](/packages/laravel-enso-charts/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (119)Used By (6)

Charts
======

[](#charts)

[![License](https://camo.githubusercontent.com/497e01b68eeba9eb3a641eece769ad098521a91fd6251eb286532e9bc56657ab/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f6368617274732f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/37f5225529ffc55d541f34d1f9993e781d427b08709a69ae2c796a8ed43599d6/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f6368617274732f76657273696f6e)](https://packagist.org/packages/laravel-enso/charts)[![Downloads](https://camo.githubusercontent.com/e67cb6bbde54dfb0f43d83b2b24fb9cef01c73056911192ddecf4273def379a9/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f6368617274732f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/charts)[![PHP](https://camo.githubusercontent.com/da7cf113b588d26fe679dfefe4a15009272ed358ad4e786ad3c78b45faa61d69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/c2fa8977643be63d4337fea100cdc02a5e6ba03427b0ad43065b391e6f48117e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f6368617274732e737667)](https://github.com/laravel-enso/charts/issues)[![Merge Requests](https://camo.githubusercontent.com/5876b70e0fafb01fe3a08ad02fdc23809d761bd361b78ce7865a363f30d3563b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f6368617274732e737667)](https://github.com/laravel-enso/charts/pulls)

Description
-----------

[](#description)

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.

Installation
------------

[](#installation)

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
```

Features
--------

[](#features)

- Provides dedicated factories for:
    - bar charts
    - line charts
    - bubble charts
    - radar charts
    - pie charts
    - doughnut charts
    - polar area charts
- Returns Chart.js-ready payloads through a single `get()` call.
- Supports fluent chart metadata such as:
    - title
    - aspect ratio
    - plugin configuration
    - per-option overrides
- Supports per-axis configuration for Cartesian charts.
- Supports per-dataset configuration overrides by dataset label.
- Supports custom palettes through `colorsConfig()`.
- Supports chart datalabel configuration through `datalabels()`.
- Supports optional gridlines and automatic Y-axis minimum handling.
- Supports short-number formatting hints for the frontend.
- Ships default Enso chart colors and plugin defaults in `config/enso/charts.php`.

Usage
-----

[](#usage)

### Bar chart

[](#bar-chart)

```
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();
```

### Line chart

[](#line-chart)

```
use LaravelEnso\Charts\Factories\Line;

$chart = (new Line())
    ->title('Users by month')
    ->labels(['Jan', 'Feb', 'Mar'])
    ->datasets([
        'Users' => [20, 40, 35],
    ])
    ->fill()
    ->get();
```

### Bubble chart

[](#bubble-chart)

```
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()`. :::

API
---

[](#api)

### Factories

[](#factories)

- `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.

### Shared fluent methods

[](#shared-fluent-methods)

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()`

### Payload shape

[](#payload-shape)

The factories return arrays with this top-level structure:

- `type`
- `title`
- `data`
- `options`

For Cartesian charts, `data` contains:

- `labels`
- `datasets`

For bubble charts, `data` contains:

- `datasets`

Each dataset is normalized for the target chart type and enriched with default Enso colors plus datalabel configuration.

### Configuration

[](#configuration)

Config file:

- `config/enso/charts.php`

Current 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.

Depends On
----------

[](#depends-on)

Required Enso packages:

- [`laravel-enso/helpers`](https://docs.laravel-enso.com/backend/helpers.html) [↗](https://github.com/laravel-enso/helpers)

Companion frontend package:

- [`@enso-ui/charts`](https://docs.laravel-enso.com/frontend/charts.html) [↗](https://github.com/enso-ui/charts)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~154 days

Total

107

Last Release

76d ago

Major Versions

1.3.0 → 2.0.02017-09-26

1.3.1 → 2.1.132018-02-15

2.5.9 → 3.0.02019-03-08

3.2.3 → 4.0.02020-06-24

PHP version history (5 changes)1.0.0PHP &gt;=5.6.4

1.1.1PHP &gt;=7.1.0

3.2.0PHP &gt;=7.4.0

4.5.0PHP ^8.0

4.7.2PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (139 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (29 commits)")[![vmcvlad](https://avatars.githubusercontent.com/u/37445394?v=4)](https://github.com/vmcvlad "vmcvlad (15 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (7 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (3 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

chartjslaravellaravel-chartslaravel-ensolaravelchartjschartslaravel-enso

### Embed Badge

![Health badge](/badges/laravel-enso-charts/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-enso-charts/health.svg)](https://phpackages.com/packages/laravel-enso-charts)
```

###  Alternatives

[laravel-enso/tables

Server-side data tables and export backend for Laravel Enso

63355.1k84](/packages/laravel-enso-tables)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[laravel-enso/forms

JSON-based form builder for Laravel Enso

12354.2k85](/packages/laravel-enso-forms)[epessine/axis

Draw charts with a simple API on Laravel

267.3k](/packages/epessine-axis)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
