2017 © Pedro Peláez
 

project php-graphs

A PHP library for JS charts.

image

koenster/php-graphs

A PHP library for JS charts.

  • Sunday, June 12, 2016
  • by Koenster
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,407 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

PHP graphs

A PHP library to cast a collection of data into a graph object which your favourite js graph library can convert into a beautiful graph for your application., (*1)

Requirements

  • PHP 5.5.9 or greater

Supported javascript libraries

Current JS implementations: * Chart.js (http://www.chartjs.org/) * morris.js (http://morrisjs.github.io/morris.js/), (*2)

Implementation

App


use koenster\PHPGraphs\contract\ChartContract; use koenster\PHPGraphs\PHPChart; $chart = new PHPChart(PHPChart::IMPLEMENTATION_CHART_JS); $graph = $chart->add(PHPChart::TYPE_LINE, 'results', ['width' => 400, 'height' => 400]); $graph->setLine([100,75,50,75,50,75,100], ['label' => 'Costs']) ->setLine([90,65,40,65,40,65,150], ['label' => 'Revenue']) ->setDimensions(['2006', '2007', '2008', '2009', '2010', '2011', '2012']);

View


<!doctype html> <html> <head> <!-- This is optional --> <?php foreach ($chart->getFactory()->getCss() as $css) : ?> <link rel="stylesheet" href="{{ $css }}"> <?php endforeach; ?> <!-- This is optional --> <?php foreach ($chart->getFactory()->getJs() as $js) : ?> <script src="<?php echo $js; ?>"></script> <?php endforeach; ?> </head> <body> generate(); ?>

For the full implementation (line, area, pie's etc.), see the examples directory., (*3)

Contributing

Feel free to edit and/or improve the code to make a better PHP Graph library., (*4)

Todo's (in random order)

  • More detailed wiki/documentation
  • More implementations
  • More configuration per implementation (add more config variables)
  • Better validation

Future implementations

  • Chrtist.js -> https://gionkunz.github.io/chartist-js/
  • jQuery flot -> http://www.flotcharts.org/

License

This PHP Graph library is open-sourced software licensed under the MIT license., (*5)

The Versions

12/06 2016

dev-master

9999999-dev

A PHP library for JS charts.

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

charts php charts graphs php graphs

12/06 2016

v0.1.2

0.1.2.0

A PHP library for JS charts.

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

charts php charts graphs php graphs

14/02 2016

v0.1.1

0.1.1.0

A PHP library for JS charts.

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

charts php charts graphs php graphs

14/02 2016

v0.1.0

0.1.0.0

A PHP wrapper for JS charts.

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

charts php charts graphs php graphs