avninc / chartjs-wrapper
This allows to generate chart.js charts using PHP fluid interface
Installs: 1 427
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.4
This package is not auto-updated.
Last update: 2024-11-09 20:39:43 UTC
README
The idea of this package is to allow a fluid interface of generating chart.js JS chart code.
Simple Example
$data = new Data(['label' => '# of Votes', 'data' => [12, 19, 3, 5, 2, 3]], ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"]); $options = new Options(['responsive' => true]); $chart = new Chart('mycharts', (new Bar), $data, $options); $code = $chart->render(); // $code will look something like this: var chartElement = document.getElementById("mycharts"); var chart = new Chart(chartElement, { type: "bar", data: {"datasets":{"label":"# of Votes","data":[12,19,3,5,2,3]},"labels":["Red","Blue","Yellow","Green","Purple","Orange"],"xLabels":[],"yLabels":[]}, options: {"responsive":true} });