Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laravel-admin-extensions/echarts
baidu echarts for laravel-admin
https://github.com/laravel-admin-extensions/echarts
Last synced: 6 days ago
JSON representation
baidu echarts for laravel-admin
- Host: GitHub
- URL: https://github.com/laravel-admin-extensions/echarts
- Owner: laravel-admin-extensions
- License: mit
- Created: 2019-06-27T10:02:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T10:43:42.000Z (over 5 years ago)
- Last Synced: 2024-10-30T20:50:25.174Z (9 days ago)
- Language: PHP
- Homepage:
- Size: 245 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-laravel-admin - echarts - Echarts 图表 (扩展包 / 视图类扩展包)
README
# Use Echarts in laravel-admin
## Installation
```bash
composer require jxlwqq/echartsphp artisan vendor:publish --tag=laravel-admin-echarts
```## Configuration
Open `config/admin.php`, add configurations that belong to this extension at `extensions` section.
```php
'extensions' => [
'echarts' => [
// Set to `false` if you want to disable this extension
'enable' => true,
]
]
```## Usage
Create a view in views directory like `resources/views/admin/echarts.blade.php`, and add following codes:
```html$(function () {
// based on prepared DOM, initialize echarts instance
var myChart = echarts.init(document.getElementById('main'));// specify chart configuration item and data
var option = {
title: {
text: 'ECharts entry example'
},
tooltip: {},
legend: {
data: ['Sales']
},
xAxis: {
data: ["shirt", "cardign", "chiffon shirt", "pants", "heels", "socks"]
},
yAxis: {},
series: [{
name: 'Sales',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};// use configuration item and data specified to show chart
myChart.setOption(option);
});```
Then show it on the page
```php
class EchartsController extends Controller
{
public function index(Content $content)
{
return $content
->header('Echarts')
->body(new Box('echarts demo', view('admin.echarts')));
}
}
```For more usage, please refer to the official [website](https://echarts.apache.org/en/index.html) of echarts.
License
------------
Licensed under [The MIT License (MIT)](LICENSE).