File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ - Format tick labels correctly for small numbers in exponential notation [[ #7768 ] ( https://github.com/plotly/plotly.js/pull/7768 )]
Original file line number Diff line number Diff line change @@ -3627,6 +3627,50 @@ describe('Test axes', function() {
36273627 } ) ;
36283628 } ) ;
36293629
3630+ it ( 'formats tick labels correctly for small numbers in exponential notation' , function ( ) {
3631+ var textOut = mockCalc ( {
3632+ type : 'linear' ,
3633+ tickmode : 'linear' ,
3634+ exponentformat : 'none' ,
3635+ showexponent : 'all' ,
3636+ tick0 : 0 ,
3637+ dtick : 1e-9 ,
3638+ range : [ 8.5e-9 , 11.5e-9 ]
3639+ } ) ;
3640+
3641+ expect ( textOut ) . toEqual ( [
3642+ '0.000000009' , '0.00000001' , '0.000000011'
3643+ ] ) ;
3644+
3645+ textOut = mockCalc ( {
3646+ type : 'linear' ,
3647+ tickmode : 'linear' ,
3648+ exponentformat : 'none' ,
3649+ showexponent : 'all' ,
3650+ tick0 : 0 ,
3651+ dtick : 1e-15 ,
3652+ range : [ 8.5e-15 , 11.5e-15 ]
3653+ } ) ;
3654+
3655+ expect ( textOut ) . toEqual ( [
3656+ '0.000000000000009' , '0.00000000000001' , '0.000000000000011'
3657+ ] ) ;
3658+
3659+ textOut = mockCalc ( {
3660+ type : 'linear' ,
3661+ tickmode : 'linear' ,
3662+ exponentformat : 'e' ,
3663+ showexponent : 'all' ,
3664+ tick0 : 0 ,
3665+ dtick : 1e-15 ,
3666+ range : [ 8.5e-15 , 11.5e-15 ]
3667+ } ) ;
3668+
3669+ expect ( textOut ) . toEqual ( [
3670+ '0.9e\u221214' , '1e\u221214' , '1.1e\u221214'
3671+ ] ) ;
3672+ } ) ;
3673+
36303674 it ( 'provides a new date suffix whenever the suffix changes' , function ( ) {
36313675 var ax = {
36323676 type : 'date' ,
You can’t perform that action at this time.
0 commit comments