New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adecks/chartjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adecks/chartjs

PHP Model Abstraction of ChartJs Objects

Source
Packagist
Version
v1.0.1
Version published
Total downloads
7
Maintainers
1
Created
Source

PHP Chart.js

Latest Version on Packagist

PHP Composer

Total Downloads

I made this package, since most of my PHP projects make use of graphs, my go to graphing library

if you require more information about chartjs please go Offical Docs.

Installation

You can install the package via composer:


composer require adecks/chartjs -vvv

Creating a chart

Creating a Line chart

use Adecks\ChartJs\Types\Line; 
use Adecks\ChartJs\Options;
use Adecks\ChartJs\Datasets\Dataset;

class ExampleController extends Controller {

	public function index() {
	
		$xAxisLabels = ['Jan','Feb','Mar'];
		
		$chartOptions = new Options; 
		
		$lineChart =  new Line($xAxisLabels,$chartOptions);

		$lineChart->addDataset((new Dataset('MyFirstData',[10,12,13])); 
	
		return response()->json($lineChart); 
		
	}

}

Creating a chart with a (x,y) value

(new Bubble(['Jan','Feb','Mar']))->addData(new Dataset('MyfirsData', ['x' => 123 , 'y' => 321 , 'r' => 10 ); 

The JSON structure from result

{ 
"type": "line",
"data": {
	"labels": ["Jan","Feb","Mar"],
	"datasets": [{"label": "MyFirstData",
		"backgroundColor": "red",
		"borderColor": "red",
		"data": [10,12,13]}]
	}
}

Types of Charts.

use Adecks\ChartJs\Types\Bar;
use Adecks\ChartJs\Types\Bubble; 
use Adecks\ChartJs\Types\Doughnut; 
use Adecks\ChartJs\Types\Line;
use Adecks\ChartJs\Types\Pie; 
use Adecks\ChartJs\Types\PolarArea; 
use Adecks\ChartJs\Types\Radar; 
use Adecks\ChartJs\Types\Scatter; 

Testing


php vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email andrekendeck@gmail.com instead of using the issue tracker.

Credits

  • Andre Kendeck

License

The MIT License (MIT). Please see License File for more information.Ï

Keywords

charts

FAQs

Package last updated on 30 Mar 2021

Related posts