avninc/ chartjs-wrapper
这允许使用PHP流畅接口生成chart.js图表
0.0.2
2016-12-23 20:53 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.4
This package is not auto-updated.
Last update: 2024-09-14 19:36:54 UTC
README
此包的目的是允许生成chart.js JS图表代码的流畅接口。
简单示例
$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} });