Skip to content

Commit fe86418

Browse files
committed
update readme.md
1 parent dce301c commit fe86418

File tree

2 files changed

+77
-3
lines changed

2 files changed

+77
-3
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Jens Segers
3+
Copyright (c) 2019 jxlwqq
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,78 @@
1-
laravel-admin extension
2-
======
1+
# Use Echarts in laravel-admin
32

3+
## Installation
44

5+
```bash
6+
composer require jxlwqq/echarts
7+
8+
php artisan vendor:publish --tag=laravel-admin-echarts
9+
```
10+
11+
## Configuration
12+
13+
Open `config/admin.php`, add configurations that belong to this extension at `extensions` section.
14+
15+
```php
16+
'extensions' => [
17+
'echarts' => [
18+
// Set to `false` if you want to disable this extension
19+
'enable' => true,
20+
]
21+
]
22+
```
23+
24+
## Usage
25+
26+
Create a view in views directory like `resources/views/admin/echarts.blade.php`, and add following codes:
27+
```html
28+
<!-- prepare a DOM container with width and height -->
29+
<div id="main" style="width: 600px;height:400px;"></div>
30+
<script type="text/javascript">
31+
// based on prepared DOM, initialize echarts instance
32+
var myChart = echarts.init(document.getElementById('main'));
33+
34+
// specify chart configuration item and data
35+
var option = {
36+
title: {
37+
text: 'ECharts entry example'
38+
},
39+
tooltip: {},
40+
legend: {
41+
data:['Sales']
42+
},
43+
xAxis: {
44+
data: ["shirt","cardign","chiffon shirt","pants","heels","socks"]
45+
},
46+
yAxis: {},
47+
series: [{
48+
name: 'Sales',
49+
type: 'bar',
50+
data: [5, 20, 36, 10, 10, 20]
51+
}]
52+
};
53+
54+
// use configuration item and data specified to show chart
55+
myChart.setOption(option);
56+
</script>
57+
```
58+
59+
Then show it on the page
60+
61+
```php
62+
class EchartsController extends Controller
63+
{
64+
public function index(Content $content)
65+
{
66+
return $content
67+
->header('Echarts')
68+
->body(new Box('echarts demo', view('admin.echarts')));
69+
}
70+
}
71+
```
72+
73+
For more usage, please refer to the official [website](https://echarts.apache.org/en/index.html) of echarts.
74+
75+
76+
License
77+
------------
78+
Licensed under [The MIT License (MIT)](LICENSE).

0 commit comments

Comments
 (0)