PHPackages                             vitopedro/laravel-chartjs - 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. vitopedro/laravel-chartjs

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

vitopedro/laravel-chartjs
=========================

chartjs wrapper for laravel

1.4.0(2y ago)1401MITPHP

Since Nov 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vitopedro/laravel-chartjs)[ Packagist](https://packagist.org/packages/vitopedro/laravel-chartjs)[ RSS](/packages/vitopedro-laravel-chartjs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (7)Used By (0)

Description
===========

[](#description)

This is a wrapper of [chart.js](https://www.chartjs.org/) in php to be used in [Laravel Framework](https://laravel.com/).

This component offers an easy and fast interface to add charts to a lavaravel application.

Setup
=====

[](#setup)

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

[](#installation)

Install it via composer with the command:

```
composer require vitopedro/laravel-chartjs

```

Configuration
-------------

[](#configuration)

1 - Add the service provider to your application in your configuration file that is normally under `config/app.php`

```
...
/*
 * Application Service Providers...
 */
...
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,

vitopedro\chartjs\ChartjsServiceProvider::class,
...

```

2 - Test your application with `php artisan serve`, if it has errors, reset your composer qutoload with:

```
composer dump-autoload

```

3 - Publish the public assets with the the command:

```
php artisan vendor:publish --tag=public --force

```

if everything worked correctlly, you will have in your application's public folder a folder `vitopedro\chartjs`

Usage
=====

[](#usage)

Include the class coresponding to the chart type nedeed, the minimum requirement for a chart to properlly render is to set the labels and the series. It is also recommended to set the title, but not mandatory.

Line/Area/Column
----------------

[](#lineareacolumn)

Those chart types are similar and can be used interchangeblly to represent the same set of data. In those types, the labels correspond to the points in the x axix of the chart and are required to properlly render the data. The series corresponds to the data itself, and it is an array containing in each position a label and a data positions. The label is to be used in the legend and in the tooltip of the chart, the data should be an array of numbers and should have the same length that labels has.

### Examples

[](#examples)

#### Line chart

[](#line-chart)

```
use vitopedro\chartjs\LineChart;

$line = new LineChart();
$line->setTitle("this is a title");
$line->setLabels(['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange']);
$line->setSeries([
    [
        'label' => 'data 1',
        'data' => [12, 19, 3, 5, 2, 3],
    ],
    [
        'label' => 'data 2',
        'data' => [10, 15, 3, 5, 2, 3],
    ],
]);
echo $line->render();

```

[![alt Line chart example](./src/preview/line.png "Line chart example")](./src/preview/line.png)

#### Area chart

[](#area-chart)

```
use vitopedro\chartjs\AreaChart;

$area = new AreaChart();
$area->setTitle("this is a title");
$area->setLabels(['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange']);
$area->setSeries([
    [
        'label' => 'data 1',
        'data' => [12, 19, 3, 5, 2, 3],
    ],
    [
        'label' => 'data 2',
        'data' => [10, 15, 3, 5, 2, 3],
    ],
]);
echo $area->render();

```

[![alt Area chart example](./src/preview/area.png "Area chart example")](./src/preview/area.png)

#### Column chart

[](#column-chart)

```
use vitopedro\chartjs\ColumnChart;

$column = new ColumnChart();
$column->setTitle("this is a title");
$column->setLabels(['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange']);
$column->setSeries([
    [
        'label' => 'data 1',
        'data' => [12, 19, 3, 5, 2, 3],
    ],
    [
        'label' => 'data 2',
        'data' => [10, 15, 3, 5, 2, 3],
    ],
]);
echo $column->render();

```

[![alt Column chart example](./src/preview/column.png "Column chart example")](./src/preview/column.png)

Pie
---

[](#pie)

This chart type differs from the the previous ones, since it doesnt have x axix. In here the labels correspond to the legend or tooltip of each value. To create a pure pie chart only one serie should be used, if multiple series are passed to the setSeries function, multiple circles will be rendered. In the series, the label must also be sent in order to maintain consistency, but it is not rendered anywhere.

### Example

[](#example)

```
use vitopedro\chartjs\PieChart;

$pie = new PieChart();
$pie->setTitle("this is a title");
$pie->setLabels([
    'Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange',
]);
$pie->setSeries([
    [
        'label' => 'data 1',
        'data' => [
            12, 19, 3, 5, 2, 3,
        ],
    ],
]);
return $pie->render();

```

[![alt Pie chart example](./src/preview/pie.png "Pie chart example")](./src/preview/pie.png)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~232 days

Recently: every ~290 days

Total

6

Last Release

835d ago

Major Versions

0.1 → 1.02020-11-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/7682567fb3f2d47134121b16e66537c87d3dcb94719ed5b8d904d58999327583?d=identicon)[vitopedro](/maintainers/vitopedro)

---

Top Contributors

[![vitopedro](https://avatars.githubusercontent.com/u/9669057?v=4)](https://github.com/vitopedro "vitopedro (1 commits)")

---

Tags

phplaravellaravel-packagechartjsPHP7laravel-framework

### Embed Badge

![Health badge](/badges/vitopedro-laravel-chartjs/health.svg)

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

###  Alternatives

[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[imanghafoori/laravel-nullable

A package to help you write expressive defensive code in a functional manner

151423.7k6](/packages/imanghafoori-laravel-nullable)[imanghafoori/laravel-middlewarize

Use laravel middlewares on any method calls in your app

1134.5k1](/packages/imanghafoori-laravel-middlewarize)[epessine/axis

Draw charts with a simple API on Laravel

265.6k](/packages/epessine-axis)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[waad/laravel-profanity-filter

Laravel Profanity Filter - Powerful PHP package for detecting, filtering, and masking profanity in multiple languages. Supports leet speak, custom word lists, case sensitivity, and seamless Laravel integration.

202.9k](/packages/waad-laravel-profanity-filter)

PHPackages © 2026

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