File tree 1 file changed +40
-2
lines changed
1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ var Cartesian = require('@src/plots/cartesian');
13
13
var Axes = require ( '@src/plots/cartesian/axes' ) ;
14
14
var Fx = require ( '@src/components/fx' ) ;
15
15
var supplyLayoutDefaults = require ( '@src/plots/cartesian/layout_defaults' ) ;
16
- var BADNUM = require ( '@src/constants/numerical' ) . BADNUM ;
17
- var ONEDAY = require ( '@src/constants/numerical' ) . ONEDAY ;
16
+ var numerical = require ( '@src/constants/numerical' ) ;
17
+ var BADNUM = numerical . BADNUM ;
18
+ var ONEDAY = numerical . ONEDAY ;
19
+ var ONEWEEK = numerical . ONEWEEK ;
18
20
19
21
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
20
22
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -6020,6 +6022,42 @@ describe('Test axes', function() {
6020
6022
. then ( done ) ;
6021
6023
} ) ;
6022
6024
} ) ;
6025
+
6026
+ [ undefined , '%U' , '%V' , '%W' ] . forEach ( function ( tickformat ) {
6027
+ it ( 'with ' + tickformat + ' tickformat, should default tick0 on a Sunday when dtick is a round number of weeks' , function ( done ) {
6028
+ var fig = {
6029
+ data : [
6030
+ {
6031
+ showlegend : false ,
6032
+ type : 'bar' ,
6033
+ width : ONEWEEK ,
6034
+ xperiod : ONEWEEK ,
6035
+ x : [
6036
+ '2020-09-16' ,
6037
+ '2020-09-24' ,
6038
+ '2020-09-30'
6039
+ ] ,
6040
+ y : [ 3 , 2 , 4 ]
6041
+ }
6042
+ ] ,
6043
+ layout : {
6044
+ xaxis : {
6045
+ tickformat : tickformat ,
6046
+ dtick : ONEWEEK ,
6047
+ ticklabelmode : 'period' ,
6048
+ showgrid : true ,
6049
+ }
6050
+ }
6051
+ } ;
6052
+
6053
+ Plotly . newPlot ( gd , fig )
6054
+ . then ( function ( ) {
6055
+ expect ( gd . _fullLayout . xaxis . tick0 ) . toBe ( '2000-01-02' ) ;
6056
+ } )
6057
+ . catch ( failTest )
6058
+ . then ( done ) ;
6059
+ } ) ;
6060
+ } ) ;
6023
6061
} ) ;
6024
6062
} ) ;
6025
6063
You can’t perform that action at this time.
0 commit comments