@@ -198,6 +198,50 @@ describe('Line Axis', () => {
198198 expect ( labelWidth ) . toBeLessThan ( 40 ) ;
199199 } ) ;
200200
201+ it ( 'hides a flushed rotated endpoint label that overlaps its predecessor' , ( ) => {
202+ const axis = new LineAxis ( {
203+ orient : 'left' ,
204+ start : { x : 0 , y : 0 } ,
205+ end : { x : 0 , y : 400 } ,
206+ verticalFactor : 1 ,
207+ items : [
208+ [
209+ { id : - 200000000000 , label : '-200000000000' , rawValue : - 200000000000 , value : 1 } ,
210+ { id : - 100000000000 , label : '-100000000000' , rawValue : - 100000000000 , value : 0.8571428571428571 } ,
211+ { id : 0 , label : '0' , rawValue : 0 , value : 0.7142857142857143 } ,
212+ { id : 100000000000 , label : '100000000000' , rawValue : 100000000000 , value : 0.5714285714285714 } ,
213+ { id : 200000000000 , label : '200000000000' , rawValue : 200000000000 , value : 0.4285714285714286 } ,
214+ { id : 300000000000 , label : '300000000000' , rawValue : 300000000000 , value : 0.2857142857142857 } ,
215+ { id : 400000000000 , label : '400000000000' , rawValue : 400000000000 , value : 0.14285714285714285 } ,
216+ { id : 500000000000 , label : '500000000000' , rawValue : 500000000000 , value : 0 }
217+ ]
218+ ] ,
219+ label : {
220+ visible : true ,
221+ autoLimit : false ,
222+ autoHide : true ,
223+ autoHideMethod : 'greedy' ,
224+ flush : true ,
225+ style : {
226+ angle : Math . PI / 2 ,
227+ textAlign : 'center' ,
228+ textBaseline : 'top'
229+ }
230+ }
231+ } ) ;
232+
233+ ( axis as any ) . render ( ) ;
234+
235+ const labels = axis . getElementsByName ( AXIS_ELEMENT_NAME . label ) as unknown as IText [ ] ;
236+ const first = labels . find ( label => label . attribute . text === '-200000000000' ) ;
237+ const second = labels . find ( label => label . attribute . text === '-100000000000' ) ;
238+
239+ expect ( first ) . toBeDefined ( ) ;
240+ expect ( second ) . toBeDefined ( ) ;
241+ expect ( first . attribute . visible ) . toBe ( true ) ;
242+ expect ( second . attribute . visible ) . toBe ( false ) ;
243+ } ) ;
244+
201245 it ( 'Line Axis with Title' , ( ) => {
202246 const scale = new LinearScale ( ) . domain ( [ 0 , 100 ] ) . range ( [ 0 , 1 ] ) . nice ( ) ;
203247 const items = scale . ticks ( 10 ) . map ( tick => {
0 commit comments