flow.vue
2.14 KB
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
<!--
* @Description: 客流转化
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-24 16:26:20
-->
<template>
<div class="flow-box">
<div class="title inline">客流转化</div>
<div class="chart-box">
<div id="flow" :style="{ height: height - 3.1 + 'vh' }"></div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'Flow',
props: ['height'],
data() {
return {}
},
mounted() {
this.getChart()
},
methods: {
getChart() {
var chartDom = document.getElementById('flow')
var myChart = echarts.init(chartDom)
var option
option = {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c}%'
},
series: [
{
name: 'Funnel',
type: 'funnel',
left: 0,
top: 8,
bottom: 8,
width: '100%',
min: 0,
max: 100,
minSize: '30%',
maxSize: '100%',
sort: 'descending',
gap: 2,
label: {
show: true,
position: 'inside'
},
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid'
}
},
itemStyle: {
borderColor: '#fff',
borderWidth: 1
},
emphasis: {
label: {
fontSize: 20
}
},
data: [
{ value: 60, name: 'Visit' },
{ value: 40, name: 'Inquiry' },
{ value: 20, name: 'Order' },
{ value: 80, name: 'Click' },
{ value: 100, name: 'Show' }
]
}
]
}
option && myChart.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
.flow-box {
padding: 0 8px 1vh;
box-sizing: border-box;
}
.chart-box {
width: 148px;
height: 11.7vh;
background-color: #262525;
padding: 0 25px;
// margin: 0 20px 1vh 8px;
// box-sizing: border-box;
}
</style>