ding / laravel-echarts
使用laravel构建ECharts
v1.0.1
2021-01-25 02:24 UTC
Requires
- php: ^7.0
- illuminate/support: ^6|^7|^8
README
使用laravel构建ECharts
安装
composer require ding/laravel-echarts
用法
在你的PHP文件或块中
$chart = app('chart')->locale('ZH') ->addSeries([ 'name' => 'Series #1', 'type' => 'line', 'data' => [1, 3, 2, 2, 4, 12, 5] ]) ->addSeries([ 'name' => 'Series #2', 'type' => 'line', 'data' => [3, 1, 3, 4, 2, 11, 3] ]) ->xAxis(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']) ->yAxis() ->legend() // 自动根据 series names 设置 legend ->lazy(); // 懒加载
在你的blade
文件中
<div style="width: 500px;height:400px;"> {!! $chart->render() !!} </div>