x
1
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>漏斗图</title>
6
<script src="https://a.alipayobjects.com/jquery/jquery/1.11.1/jquery.js"></script>
7
<script src="https://gw.alipayobjects.com/as/g/datavis/g2/2.3.13/index.js"></script>
8
</head>
9
<body>
10
<div id="c1"></div>
11
<script>
12
var data = [
13
{"action": "Website visits", "value": 5654},
14
{"action": "Downloads", "value": 4064},
15
{"action": "Requested price list", "value": 1987},
16
{"action": "Invoice sent", "value": 976},
17
{"action": "Finalized", "value": 484}
18
];
19
var chart = new G2.Chart({
20
id: 'c1',
21
forceFit: true,
22
height: 450,
23
plotCfg: {
24
margin: 80
25
}
26
});
27
chart.source(data);
28
chart.coord('rect').transpose().scale(1,-1);
29
chart.axis(false);
30
chart.legend('action', {
31
position: 'bottom'
32
});
33
chart.intervalSymmetric()
34
.position('action*value')
35
.color('action', ['#C82B3D', '#EB4456', '#F9815C', '#F8AB60', '#EDCC72'])
36
.shape('funnel')
37
.label('action', {offset: 10, label: {fontSize: 14}}).animate({
38
appear:{
39
animation:'zoomIn'
40
},
41
leave:{
42
animation:'fadeIn',
43
easing:'easeInQuart'
44
}
45
});
46
chart.render();
47
</script>
48
</body>
49
</html>
50
漏斗图
漏斗图适用于业务流程比较规范、周期长、环节多的单流程单向分析,通过漏斗各环节业务数据的比较能够直观地发现和说明问题所在的环节,进而做出决策。 了解更多