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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!--
* 疫情防控
-->
<script lang="ts">
export default {
name: 'PAGE7',
};
</script>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import {
X_DATA,
LOCAL_INFECTED,
PROVINCE_INNER_INFECTED,
PROVINCE_OUT_INFECTED,
OFFSHORE_INPUT_INFECTED,
LABEL_DATA,
COLOR_LIST,
} from './config';
import * as echarts from 'echarts';
type EChartsOption = echarts.EChartsOption;
var chartMain;
const chartMainRef = ref<any>(null);
onMounted(() => {
initDom();
let abc = false;
let type = Object.prototype.toString.call(abc);
console.log(type);
});
function initDom() {
chartMain = echarts.init(chartMainRef.value);
const option: EChartsOption = {
tooltip: {
trigger: 'axis',
},
color: COLOR_LIST,
legend: {
data: LABEL_DATA,
show: true,
},
grid: {
left: 80,
right: 100,
bottom: 80,
top: 40,
containLabel: true,
},
xAxis: {
type: 'category',
boundaryGap: false,
data: X_DATA,
},
yAxis: {
type: 'value',
},
series: [
{
name: LABEL_DATA[0],
type: 'line',
data: LOCAL_INFECTED,
},
{
name: LABEL_DATA[1],
type: 'line',
data: PROVINCE_INNER_INFECTED,
},
{
name: LABEL_DATA[2],
type: 'line',
data: PROVINCE_OUT_INFECTED,
},
{
name: LABEL_DATA[3],
type: 'line',
data: OFFSHORE_INPUT_INFECTED,
},
],
};
chartMain.setOption(option);
}
</script>
<template>
<div class="box container-height">
<div class="title">
成都市新冠疫情 {{ X_DATA[X_DATA.length - 1] }} 新增情况
</div>
<div class="single-box">
<div class="single" :style="{ color: COLOR_LIST[0] }">
<div class="single-label">{{ LABEL_DATA[0] }}</div>
<div class="single-value">
+ {{ LOCAL_INFECTED[LOCAL_INFECTED.length - 1] }}
</div>
</div>
<div class="single" :style="{ color: COLOR_LIST[1] }">
<div class="single-label">{{ LABEL_DATA[1] }}</div>
<div class="single-value">
+ {{ PROVINCE_INNER_INFECTED[PROVINCE_INNER_INFECTED.length - 1] }}
</div>
</div>
<div class="single" :style="{ color: COLOR_LIST[2] }">
<div class="single-label">{{ LABEL_DATA[2] }}</div>
<div class="single-value">
+ {{ PROVINCE_OUT_INFECTED[PROVINCE_OUT_INFECTED.length - 1] }}
</div>
</div>
<div class="single" :style="{ color: COLOR_LIST[3] }">
<div class="single-label">{{ LABEL_DATA[3] }}</div>
<div class="single-value">
+ {{ OFFSHORE_INPUT_INFECTED[OFFSHORE_INPUT_INFECTED.length - 1] }}
</div>
</div>
</div>
<div class="content">
<div class="chart-main" ref="chartMainRef"></div>
</div>
</div>
</template>
<style lang="scss" scoped>
.box {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
}
.title {
text-align: center;
margin: $padding-md auto;
font-size: 26px;
color: #414141;
}
.content {
display: flex;
justify-content: center;
flex: 1;
.chart-main {
flex: 1;
}
}
.single-box {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin: $padding-md;
margin-bottom: 0;
}
.single {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0 14px;
.single-label {
font-size: 12px;
}
.single-value {
font-size: 20px;
}
}
</style>