徐畅 / laravel-echarts
使用 Laravel 构建 ECharts
1.0.3
2022-09-15 00:49 UTC
Requires
- php: >=7.1.3
- illuminate/support: ^7.0|^8.0
- laravel/framework: *
This package is auto-updated.
Last update: 2024-09-15 04:57:48 UTC
README
使用 Laravel 构建 ECharts
安装
composer require xuanchen/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>