File tree 5 files changed +66
-7
lines changed
5 files changed +66
-7
lines changed Original file line number Diff line number Diff line change @@ -211,12 +211,61 @@ describe('core', () => {
211
211
xField : 'date' ,
212
212
yField : 'value' ,
213
213
} ) ;
214
-
215
- line . render ( ) ;
216
-
217
214
expect ( container . dataset . chartSourceType ) . toBe ( 'G2Plot' ) ;
218
215
line . destroy ( ) ;
219
216
220
217
expect ( container . dataset . chartSourceType ) . toBe ( undefined ) ;
221
218
} ) ;
219
+
220
+ it ( 'default autoHide' , ( ) => {
221
+ const line = new Line ( createDiv ( '' ) , {
222
+ data : partySupport . filter ( ( o ) => o . type === 'FF' ) ,
223
+ xField : 'date' ,
224
+ yField : 'value' ,
225
+ } ) ;
226
+
227
+ line . render ( ) ;
228
+
229
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoRotate ) . toBe ( false ) ;
230
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoHide ) . toEqual ( {
231
+ type : 'equidistance' ,
232
+ cfg : {
233
+ minGap : 6 ,
234
+ } ,
235
+ } ) ;
236
+
237
+ line . update ( {
238
+ xAxis : {
239
+ label : {
240
+ autoHide : {
241
+ type : 'equidistance' ,
242
+ cfg : {
243
+ minGap : 12 ,
244
+ } ,
245
+ } ,
246
+ } ,
247
+ } ,
248
+ } ) ;
249
+ line . render ( ) ;
250
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoRotate ) . toBe ( false ) ;
251
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoHide ) . toEqual ( {
252
+ type : 'equidistance' ,
253
+ cfg : {
254
+ minGap : 12 ,
255
+ } ,
256
+ } ) ;
257
+
258
+ line . update ( {
259
+ xAxis : {
260
+ label : {
261
+ autoHide : false ,
262
+ } ,
263
+ } ,
264
+ } ) ;
265
+ line . render ( ) ;
266
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoRotate ) . toBe ( false ) ;
267
+ expect ( line . chart . getOptions ( ) . axes [ 'date' ] . label . autoHide ) . toBe ( false ) ;
268
+
269
+ line . destroy ( ) ;
270
+ } ) ;
222
271
} ) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,12 @@ describe('Histogram: axis', () => {
112
112
expect ( histogram . chart . options . axes . range ) . toEqual ( {
113
113
nice : true ,
114
114
label : {
115
- autoHide : true ,
115
+ autoHide : {
116
+ type : 'equidistance' ,
117
+ cfg : {
118
+ minGap : 6 ,
119
+ } ,
120
+ } ,
116
121
autoRotate : false ,
117
122
} ,
118
123
} ) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,12 @@ describe('histogram', () => {
36
36
expect ( histogram . chart . options . axes . range ) . toEqual ( {
37
37
nice : true ,
38
38
label : {
39
- autoHide : true ,
39
+ autoHide : {
40
+ type : 'equidistance' ,
41
+ cfg : {
42
+ minGap : 6 ,
43
+ } ,
44
+ } ,
40
45
autoRotate : false ,
41
46
} ,
42
47
} ) ;
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ export abstract class Plot<O extends PickOptions> extends EE {
118
118
nice : true ,
119
119
label : {
120
120
autoRotate : false ,
121
- autoHide : true ,
121
+ autoHide : { type : 'equidistance' , cfg : { minGap : 6 } } ,
122
122
} ,
123
123
} ,
124
124
yAxis : {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export interface LineOptions extends Options {
19
19
/** 折线图形样式 */
20
20
readonly lineStyle ?: StyleAttr ;
21
21
/** 折线 shape 配置 */
22
- readonly lineShape ?: LineGeometryOptions [ 'line' ] [ 'shape' ] ;
22
+ readonly lineShape ?: Required < LineGeometryOptions > [ 'line' ] [ 'shape' ] ;
23
23
/** 折线数据点图形样式 */
24
24
readonly point ?: PointGeometryOptions [ 'point' ] ;
25
25
}
You can’t perform that action at this time.
0 commit comments