@@ -8,6 +8,7 @@ const DATA1 = [
8
8
{ stage : '录取人数' , number : 87 } ,
9
9
{ stage : '入职人数' , number : null } ,
10
10
{ stage : '离职人数' , number : 10 } ,
11
+ { stage : '回流人数' } ,
11
12
] ;
12
13
13
14
const DATA2 = [
@@ -17,16 +18,18 @@ const DATA2 = [
17
18
{ stage : '录取人数' , number : 87 , company : 'A公司' } ,
18
19
{ stage : '入职人数' , number : null , company : 'A公司' } ,
19
20
{ stage : '离职人数' , number : 10 , company : 'A公司' } ,
21
+ { stage : '回流人数' , company : 'A公司' } ,
20
22
{ stage : '简历筛选' , number : 303 , company : 'B公司' } ,
21
23
{ stage : '初试人数' , number : 0 , company : 'B公司' } ,
22
24
{ stage : '复试人数' , number : 153 , company : 'B公司' } ,
23
25
{ stage : '录取人数' , number : 117 , company : 'B公司' } ,
24
26
{ stage : '入职人数' , number : 79 , company : 'B公司' } ,
25
27
{ stage : '离职人数' , number : 15 , company : 'B公司' } ,
28
+ { stage : '回流人数' , company : 'B公司' } ,
26
29
] ;
27
30
28
31
describe ( '#2124' , ( ) => {
29
- it ( 'Funnel 数据为 null, 0 不能报错' , async ( ) => {
32
+ it ( 'Funnel 数据为 null, 0, undefined 不能报错' , async ( ) => {
30
33
const plot = new Funnel ( createDiv ( ) , {
31
34
data : DATA1 ,
32
35
xField : 'stage' ,
@@ -42,7 +45,7 @@ describe('#2124', () => {
42
45
. getController ( 'annotation' )
43
46
. getComponents ( )
44
47
. map ( ( co ) => co . component . cfg . text . content )
45
- ) . toEqual ( [ '转化率: 59.68%' , '转化率: -∞' , '转化率: ∞' , '转化率: -' , '转化率: -' ] ) ;
48
+ ) . toEqual ( [ '转化率: 59.68%' , '转化率: -∞' , '转化率: ∞' , '转化率: -' , '转化率: -' , '转化率: -' ] ) ;
46
49
47
50
plot . destroy ( ) ;
48
51
} ) ;
@@ -80,15 +83,37 @@ describe('#2124', () => {
80
83
. getComponents ( )
81
84
. filter ( ( co ) => co . component . cfg . type === 'line' )
82
85
. map ( ( co ) => co . component . cfg . text . content )
83
- ) . toEqual ( [ '转化率: 59.68%' , '转化率: -∞' , '转化率: ∞' , '转化率: -' , '转化率: -' ] ) ;
86
+ ) . toEqual ( [ '转化率: 59.68%' , '转化率: -∞' , '转化率: ∞' , '转化率: -' , '转化率: -' , '转化率: -' ] ) ;
84
87
85
88
expect (
86
89
plot . chart . views [ 1 ]
87
90
. getController ( 'annotation' )
88
91
. getComponents ( )
89
92
. filter ( ( co ) => co . component . cfg . type === 'line' )
90
93
. map ( ( co ) => co . component . cfg . text . content )
91
- ) . toEqual ( [ '转化率: -∞' , '转化率: ∞' , '转化率: 76.47%' , '转化率: 67.52%' , '转化率: 18.99%' ] ) ;
94
+ ) . toEqual ( [ '转化率: -∞' , '转化率: ∞' , '转化率: 76.47%' , '转化率: 67.52%' , '转化率: 18.99%' , '转化率: -' ] ) ;
95
+
96
+ plot . destroy ( ) ;
97
+ } ) ;
98
+
99
+ it ( '动态高度漏斗图' , async ( ) => {
100
+ const plot = new Funnel ( createDiv ( ) , {
101
+ data : DATA1 ,
102
+ xField : 'stage' ,
103
+ yField : 'number' ,
104
+ dynamicHeight : true ,
105
+ legend : false ,
106
+ minSize : 0.1 ,
107
+ } ) ;
108
+
109
+ plot . render ( ) ;
110
+
111
+ expect (
112
+ plot . chart
113
+ . getController ( 'annotation' )
114
+ . getComponents ( )
115
+ . map ( ( co ) => co . component . cfg . text . content )
116
+ ) . toEqual ( [ '转化率: 59.68%' , '转化率: -∞' , '转化率: ∞' , '转化率: -' , '转化率: -' , '转化率: -' ] ) ;
92
117
93
118
plot . destroy ( ) ;
94
119
} ) ;
0 commit comments