1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
| <template>
| <div class="box">
| <div class="title">设备设施统计</div>
| <div ref="main" style="width: 100%; height: 400px"></div>
| </div>
| </template>
| <script lang="ts">
| import { defineComponent, onMounted, ref } from 'vue';
| import * as echarts from 'echarts';
| export default defineComponent({
| setup() {
| const main = ref();
| const init = () => {
| var myChart = echarts.init(main.value);
| var option = {
| tooltip: {},
| grid: {
| left: '3%',
| right: '4%',
| bottom: '5%',
| containLabel: true,
| },
| xAxis: {
| type: 'category',
| data: ['在用数', '报废数', '维修数', '停用数'],
| },
| yAxis: {
| type: 'value',
| name: '数量',
| nameTextStyle: {
| color: '#aaa',
| nameLocation: 'start',
| },
| },
| color: ['#6394f9'],
| series: [
| {
| data: [120, 200, 150, 80, 70, 110, 130],
| type: 'bar',
| },
| ],
| };
|
| myChart.setOption(option);
| };
| onMounted(() => {
| init();
| });
| return {
| init,
| onMounted,
| main,
| };
| },
| });
| </script>
| <style scoped>
| .box {
| background-color: #fff;
| box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
| }
| .title {
| font-size: 16px;
| border-bottom: 1px solid #eee;
| padding: 20px;
| }
| </style>
|
|