File tree 2 files changed +24
-2
lines changed
__tests__/unit/plots/funnel
src/plots/funnel/geometries
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,20 @@ describe('basic funnel', () => {
71
71
} ) ;
72
72
} ) ;
73
73
74
+ describe ( 'pyramid' , ( ) => {
75
+ test ( 'transpose' , ( ) => {
76
+ funnel . update ( {
77
+ ...funnelOption ,
78
+ shape : 'pyramid' ,
79
+ } ) ;
80
+
81
+ const geometry = funnel . chart . geometries [ 0 ] ;
82
+ expect ( geometry . labelOption . cfg . layout . type ) . toBe ( 'interval-adjust-position' ) ;
83
+ const shapeFields = geometry . getAttribute ( 'shape' ) . getFields ( ) ;
84
+ expect ( shapeFields [ 0 ] ) . toBe ( 'pyramid' ) ;
85
+ } ) ;
86
+ } ) ;
87
+
74
88
describe ( 'transpose' , ( ) => {
75
89
test ( 'transpose' , ( ) => {
76
90
funnel . update ( {
Original file line number Diff line number Diff line change 1
1
import { Types } from '@antv/g2' ;
2
2
import { isArray } from '@antv/util' ;
3
- import { flow , findGeometry } from '../../../utils' ;
3
+ import { flow , findGeometry , deepAssign } from '../../../utils' ;
4
4
import { getTooltipMapping } from '../../../utils/tooltip' ;
5
5
import { Params } from '../../../core/adaptor' ;
6
6
import { Datum , Data } from '../../../types/common' ;
@@ -51,7 +51,15 @@ function geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {
51
51
color,
52
52
style : funnelStyle ,
53
53
} ,
54
- label,
54
+ // 使用 Interval 绘制的漏斗图,默认使用 'interval-adjust-position', 否则尖底漏斗图最后一行 label 错位
55
+ label : deepAssign (
56
+ {
57
+ layout : {
58
+ type : 'interval-adjust-position' ,
59
+ } ,
60
+ } ,
61
+ label
62
+ ) ,
55
63
state,
56
64
} ,
57
65
} ) ;
You can’t perform that action at this time.
0 commit comments