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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
| <template>
| <div class="charts-container">
| <div id="preWarning"></div>
| </div>
| </template>
| <script setup>
| import * as echarts from 'echarts';
| import {onMounted} from "vue";
|
| onMounted(()=>{
| initChart()
| })
|
| const initChart =()=>{
| var chartDom = document.getElementById('preWarning');
| var myChart = echarts.init(chartDom);
| var option;
|
| option = {
| title: [
| {
| text: '近30天预警信息趋势',
| left: '0',
| top: '2%',
| textStyle: {
| fontSize: 12,
| color: 'rgba(255,255,255,.6)',
| fontWeight: 'normal'
| }
| }
| ],
| xAxis: {
| type: 'category',
| data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
| axisLabel:{
| color: '#fff'
| },
| axisTick: {
| show: false
| }
| },
| yAxis: {
| type: 'value',
| splitLine: {
| lineStyle:{
| color: 'rgba(255,255,255,.1)',
| type: 'dashed'
| }
| },
| axisLabel:{
| color: 'rgba(255,255,255,.6)'
| }
| },
| grid: [
| {
| top: '15%',
| right: '2%',
| bottom: '10%'
| }
| ],
| series: [
| {
| data: [150, 230, 224, 218, 135, 147, 260],
| type: 'line',
| label:{
| show: true,
| color: '#fff',
| textBorderColor: 'transparent',
| fontSize: 8
| },
| // showSymbol: false,
| lineStyle:{
| color: '#54d5ff'
| },
| itemStyle:{
| color: '#54d5ff',
| }
| }
| ]
| };
|
| option && myChart.setOption(option);
| }
|
| </script>
|
| <style lang="postcss" scoped>
| .charts-container{
| width: 100%;
| height: 100%;
| }
|
| #preWarning{
| width: 100%;
| height: 100%;
| }
| </style>
|
|