PHP Classes

Laravel Highcharts: Display charts using the Highcharts API

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 104 All time: 9,753 This week: 48Up
Version License PHP version Categories
laravelhighcharts 1.0.1The PHP License5PHP 5, Graphics, Web services
Description 

Author

This package can display charts using the Highcharts API.

It can generate HTML with JavaScript code to configure several aspects of a chart.

The package can configure attributes like the type of chart, chart data, legend, axis, etc..

Picture of DeGraciaMathieu
  Performance   Level  
Innovation award
Innovation award
Nominee: 16x

Winner: 2x

 

Recommendations

Chart Graphic Library
I'm looking for a chart library with commercial use license.

Documentation

Codacy Badge Scrutinizer Code Quality <a href="https://styleci.io/repos/69124179"><img src="https://img.shields.io/badge/Built_for-Laravel-orange.svg" alt="Build For Laravel"></a> Latest Version on Packagist Total Downloads

EnergieProduction/Chart

Chart service for Highcharts on Laravel 5

Installation

Run in console below command to download package to your project:

composer require energieproduction/chart

Configuration

For Laravel 5

In /config/app.php add ChartServiceProvider:

EnergieProduction\Chart\ChartServiceProvider::class,

Do not forget to use the scripts from Highcharts on the pages that contains a chart

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

Usage

In progress...

Examples

$chart = app('chart');

$chart->pushSubset('title', function($title){
    $title->pushCriteria(new Criterias\Text('Solar Employment Growth by Sector, 2010-2016'));
});

$chart->pushSubset('subtitle', function($subtitle){
    $subtitle->pushCriteria(new Criterias\Text('Source: thesolarfoundation.com'));
});

$chart->pushSubset('yAxis.title', function($title){
    $title->pushCriteria(new Criterias\Text('Number of Employees'));
});

$chart->pushSubset('legend', function($legend){
    $legend->pushCriteria(new Criterias\Layout('vertical'));
    $legend->pushCriteria(new Criterias\Align('right'));
    $legend->pushCriteria(new Criterias\VerticalAlign('middle'));
});

$chart->pushSubset('plotOptions.series', function($plotOptions){
    $plotOptions->pushCriteria(new Criterias\PointStart(2010));
});

$chart->pushSubset('series', function($series){
    $series->pushCriteria(new Criterias\Name('Installation'));
    $series->pushCriteria(new Criterias\Data([43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]));
});

$chartSolarEmployment = $chart->render();

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
 
<div id='chart'></div>
 
<script type="text/javascript">
$(function () {
    $('chart').highcharts({{$chartSolarEmployment}});
});
</script>

Demo


  Files folder image Files (415)  
File Role Description
Files folder imagesrc (3 files, 4 directories)
Files folder imagetests (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:104
This week:0
All time:9,753
This week:48Up