# 一.legend
查看代码详情
<template>
<WebPie :config="getOptions" :data="data"></WebPie>
</template>
<script>
export default {
data() {
return {
data: [],
};
},
async created() {
let res = await this.$api.getPolar(1);
if (res.data) {
this.data = res.data.map((item) => ({ ...item, value: item.descript }));
}
},
methods: {
getOptions(data) {
return {
color: ["#003366", "#006699", "#4cabce", "#e5323e"],
dataset: {
source: [
["type", "2012", "2013", "2014", "2015", "2016"],
["Forest", 320, 332, 301, 334, 390],
["Steppe", 220, 182, 191, 234, 290],
["Desert", 150, 232, 201, 154, 190],
["Wetland", 98, 77, 101, 99, 40],
],
},
legend: {},
xAxis: {
type: "category",
axisTick: {
show: false,
},
},
yAxis: {},
series: [
{
type: "bar",
seriesLayoutBy: "row",
},
{
type: "bar",
seriesLayoutBy: "row",
},
{
type: "bar",
seriesLayoutBy: "row",
},
{
type: "bar",
seriesLayoutBy: "row",
},
],
};
},
},
};
</script>
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
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