diff --git a/src/plots/cartesian/constants.js b/src/plots/cartesian/constants.js index a06eff59894..98ef0bc9f18 100644 --- a/src/plots/cartesian/constants.js +++ b/src/plots/cartesian/constants.js @@ -31,6 +31,9 @@ module.exports = { // and for 2D subplots SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/, + HOUR_PATTERN: 'hour', + WEEKDAY_PATTERN: 'day of week', + // pixels to move mouse before you stop clamping to starting point MINDRAG: 8, diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index caca53ef82e..f2cef7d688a 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -18,6 +18,8 @@ var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; var DATE_FORMAT_LINK = require('../../constants/docs').DATE_FORMAT_LINK; var ONEDAY = require('../../constants/numerical').ONEDAY; var constants = require('./constants'); +var HOUR = constants.HOUR_PATTERN; +var DAY_OF_WEEK = constants.WEEKDAY_PATTERN; module.exports = { visible: { @@ -278,22 +280,19 @@ module.exports = { pattern: { valType: 'enumerated', - // TODO could add '%H:%M:%S' - values: ['%w', '%H', ''], + values: [DAY_OF_WEEK, HOUR, ''], dflt: '', role: 'info', editType: 'calc', description: [ 'Determines a pattern on the time line that generates breaks.', - 'If *%w* - Sunday-based weekday as a decimal number [0, 6].', - 'If *%H* - hour (24-hour clock) as a decimal number [0, 23].', - 'These are the same directive as in `tickformat`, see', - 'https://github.com/d3/d3-time-format#locale_format', + 'If *' + DAY_OF_WEEK + '* - Sunday-based weekday as a decimal number [0, 6].', + 'If *' + HOUR + '* - hour (24-hour clock) as decimal numbers between 0 and 24.', 'for more info.', 'Examples:', - '- { pattern: \'%w\', bounds: [6, 0], operation: \'[]\' }', + '- { pattern: \'' + DAY_OF_WEEK + '\', bounds: [6, 0] }', ' breaks from Saturday to Monday (i.e. skips the weekends).', - '- { pattern: \'%H\', bounds: [17, 8] }', + '- { pattern: \'' + HOUR + '\', bounds: [17, 8], operation: \'()\' }', // TODO: simplify after revise defaults ' breaks from 5pm to 8am (i.e. skips non-work hours).' ].join(' ') }, diff --git a/src/plots/cartesian/set_convert.js b/src/plots/cartesian/set_convert.js index 7f4b834ee4e..b03d034187c 100644 --- a/src/plots/cartesian/set_convert.js +++ b/src/plots/cartesian/set_convert.js @@ -27,9 +27,12 @@ var ONEHOUR = numConstants.ONEHOUR; var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; -var constants = require('./constants'); var axisIds = require('./axis_ids'); +var constants = require('./constants'); +var HOUR_PATTERN = constants.HOUR_PATTERN; +var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; + function fromLog(v) { return Math.pow(10, v); } @@ -611,7 +614,7 @@ module.exports = function setConvert(ax, fullLayout) { ax.maskBreaks = function(v) { var rangebreaksIn = ax.rangebreaks || []; - var bnds, b0, b1, vb; + var bnds, b0, b1, vb, vDate; for(var i = 0; i < rangebreaksIn.length; i++) { var brk = rangebreaksIn[i]; @@ -622,55 +625,56 @@ module.exports = function setConvert(ax, fullLayout) { var op1 = op.charAt(1); if(brk.bounds) { - var doesCrossPeriod = false; + var pattern = brk.pattern; + bnds = Lib.simpleMap(brk.bounds, pattern ? + cleanNumber : + ax.d2c // case of pattern: '' + ); + b0 = bnds[0]; + b1 = bnds[1]; + + switch(pattern) { + case WEEKDAY_PATTERN: + vDate = new Date(v); + vb = vDate.getUTCDay(); + + if(b0 > b1) { + b1 += 7; + if(vb < b0) vb += 7; + } - switch(brk.pattern) { - case '%w': - bnds = Lib.simpleMap(brk.bounds, cleanNumber); - b0 = bnds[0]; - b1 = bnds[1]; - vb = (new Date(v)).getUTCDay(); - if(bnds[0] > bnds[1]) doesCrossPeriod = true; break; - case '%H': - bnds = Lib.simpleMap(brk.bounds, cleanNumber); - b0 = bnds[0]; - b1 = bnds[1]; - var vDate = new Date(v); - vb = vDate.getUTCHours() + ( - vDate.getUTCMinutes() * ONEMIN + - vDate.getUTCSeconds() * ONESEC + - vDate.getUTCMilliseconds() - ) / ONEDAY; - if(bnds[0] > bnds[1]) doesCrossPeriod = true; + case HOUR_PATTERN: + vDate = new Date(v); + var hours = vDate.getUTCHours(); + var minutes = vDate.getUTCMinutes(); + var seconds = vDate.getUTCSeconds(); + var milliseconds = vDate.getUTCMilliseconds(); + + vb = hours + ( + minutes / 60 + + seconds / 3600 + + milliseconds / 3600000 + ); + + if(b0 > b1) { + b1 += 24; + if(vb < b0) vb += 24; + } + break; case '': // N.B. should work on date axes as well! // e.g. { bounds: ['2020-01-04', '2020-01-05 23:59'] } - bnds = Lib.simpleMap(brk.bounds, ax.d2c); - if(bnds[0] <= bnds[1]) { - b0 = bnds[0]; - b1 = bnds[1]; - } else { - b0 = bnds[1]; - b1 = bnds[0]; - } // TODO should work with reversed-range axes vb = v; break; } - if(doesCrossPeriod) { - if( - (op0 === '(' ? vb > b0 : vb >= b0) || - (op1 === ')' ? vb < b1 : vb <= b1) - ) return BADNUM; - } else { - if( - (op0 === '(' ? vb > b0 : vb >= b0) && - (op1 === ')' ? vb < b1 : vb <= b1) - ) return BADNUM; - } + if( + (op0 === '(' ? vb > b0 : vb >= b0) && + (op1 === ')' ? vb < b1 : vb <= b1) + ) return BADNUM; } else { var vals = Lib.simpleMap(brk.values, ax.d2c).sort(Lib.sorterAsc); var onOpenBound = false; @@ -699,8 +703,8 @@ module.exports = function setConvert(ax, fullLayout) { if(!ax.rangebreaks) return rangebreaksOut; var rangebreaksIn = ax.rangebreaks.slice().sort(function(a, b) { - if(a.pattern === '%w' && b.pattern === '%H') return -1; - else if(b.pattern === '%w' && a.pattern === '%H') return 1; + if(a.pattern === WEEKDAY_PATTERN && b.pattern === HOUR_PATTERN) return -1; + if(b.pattern === WEEKDAY_PATTERN && a.pattern === HOUR_PATTERN) return 1; return 0; }); @@ -756,7 +760,7 @@ module.exports = function setConvert(ax, fullLayout) { var t; switch(brk.pattern) { - case '%w': + case WEEKDAY_PATTERN: b0 = bnds[0] + (op0 === '(' ? 1 : 0); b1 = bnds[1]; r0Pattern = r0Date.getUTCDay(); @@ -771,7 +775,7 @@ module.exports = function setConvert(ax, fullLayout) { r0Date.getUTCSeconds() * ONESEC - r0Date.getUTCMilliseconds(); break; - case '%H': + case HOUR_PATTERN: b0 = bnds[0]; b1 = bnds[1]; r0Pattern = r0Date.getUTCHours(); diff --git a/test/image/mocks/axes_breaks-finance.json b/test/image/mocks/axes_breaks-finance.json index 21b7056a1b6..05c43622f4f 100644 --- a/test/image/mocks/axes_breaks-finance.json +++ b/test/image/mocks/axes_breaks-finance.json @@ -363,7 +363,7 @@ "rangeslider": { "visible": true }, "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 ] }, { @@ -376,7 +376,7 @@ "rangeslider": { "visible": true }, "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 ] }, { diff --git a/test/image/mocks/axes_breaks-night_autorange-reversed.json b/test/image/mocks/axes_breaks-night_autorange-reversed.json index a2dcf78bf23..fbc0dc878da 100644 --- a/test/image/mocks/axes_breaks-night_autorange-reversed.json +++ b/test/image/mocks/axes_breaks-night_autorange-reversed.json @@ -192,7 +192,7 @@ "xaxis": { "rangebreaks": [ { - "pattern": "%H", + "pattern": "hour", "bounds": [ 18, 6 @@ -208,7 +208,7 @@ "xaxis2": { "rangebreaks": [ { - "pattern": "%H", + "pattern": "hour", "bounds": [ 18, 6 @@ -253,7 +253,7 @@ "yaxis3": { "rangebreaks": [ { - "pattern": "%H", + "pattern": "hour", "bounds": [ 18, 6 @@ -270,7 +270,7 @@ "yaxis4": { "rangebreaks": [ { - "pattern": "%H", + "pattern": "hour", "bounds": [ 18, 6 diff --git a/test/image/mocks/axes_breaks-rangeslider.json b/test/image/mocks/axes_breaks-rangeslider.json index f7e9bf30c0d..a3c82646099 100644 --- a/test/image/mocks/axes_breaks-rangeslider.json +++ b/test/image/mocks/axes_breaks-rangeslider.json @@ -2654,22 +2654,22 @@ "tickfont": {"size": 8}, "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [6, 0], "operation": "[]" }, { - "pattern": "%H", + "pattern": "hour", "bounds": [0, 9], "operation": "()" }, { - "pattern": "%H", + "pattern": "hour", "bounds": [12, 13], "operation": "()" }, { - "pattern": "%H", + "pattern": "hour", "bounds": [15, 21], "operation": "()" } diff --git a/test/image/mocks/axes_breaks-weekends-weeknights.json b/test/image/mocks/axes_breaks-weekends-weeknights.json index 9ac70567ba0..a3513c42d75 100644 --- a/test/image/mocks/axes_breaks-weekends-weeknights.json +++ b/test/image/mocks/axes_breaks-weekends-weeknights.json @@ -15,12 +15,12 @@ "xaxis": { "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 ], "operation": "[]" }, { - "pattern": "%H", + "pattern": "hour", "bounds": [ 16, 8 ], "operation": "()" } diff --git a/test/image/mocks/axes_breaks-weekends_autorange-reversed.json b/test/image/mocks/axes_breaks-weekends_autorange-reversed.json index 07911549448..cd0d5e8f59d 100644 --- a/test/image/mocks/axes_breaks-weekends_autorange-reversed.json +++ b/test/image/mocks/axes_breaks-weekends_autorange-reversed.json @@ -88,7 +88,7 @@ "xaxis": { "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 @@ -104,7 +104,7 @@ "xaxis2": { "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 @@ -149,7 +149,7 @@ "yaxis3": { "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 @@ -166,7 +166,7 @@ "yaxis4": { "rangebreaks": [ { - "pattern": "%w", + "pattern": "day of week", "bounds": [ 6, 0 diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 3f25a078996..0f18c61353c 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -1125,14 +1125,14 @@ describe('Test axes', function() { it('should only coerce rangebreaks *pattern* with *bounds*', function() { layoutIn = { xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-04', '2020-01-05']}]}, - xaxis2: {type: 'date', rangebreaks: [{bounds: [6, 0], pattern: '%w'}]}, + xaxis2: {type: 'date', rangebreaks: [{bounds: [6, 0], pattern: 'day of week'}]}, xaxis3: {type: 'date', rangebreaks: [{values: ['2020-01-04', '2020-01-05'], pattern: 'NOP'}]}, }; layoutOut._subplots.xaxis.push('x2', 'x3'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); expect(layoutOut.xaxis.rangebreaks[0].pattern).toBe('', 'coerced to dflt value'); - expect(layoutOut.xaxis2.rangebreaks[0].pattern).toBe('%w', 'coerced'); + expect(layoutOut.xaxis2.rangebreaks[0].pattern).toBe('day of week', 'coerced'); expect(layoutOut.xaxis3.rangebreaks[0].pattern).toBe(undefined, 'not coerce, using *values*'); }); }); @@ -4104,7 +4104,7 @@ describe('Test axes', function() { _assert('with mixed operation values', [0, BADNUM, BADNUM, 90, 100, BADNUM, BADNUM, 200]); }); - it('should discard coords within break bounds - date %w case', function() { + it('should discard coords within break bounds - date day of week case', function() { var x = [ // Thursday '2020-01-02 08:00', '2020-01-02 16:00', @@ -4132,7 +4132,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { rangebreaks: [ - {pattern: '%w', bounds: [6, 0], operation: '[]'} + {pattern: 'day of week', bounds: [6, 0], operation: '[]'} ] } }); @@ -4141,7 +4141,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { rangebreaks: [ - {pattern: '%w', bounds: [5, 1], operation: '()'} + {pattern: 'day of week', bounds: [5, 1], operation: '()'} ] } }); @@ -4150,7 +4150,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { rangebreaks: [ - {pattern: '%w', bounds: [6, 1], operation: '[)'} + {pattern: 'day of week', bounds: [6, 1], operation: '[)'} ] } }); @@ -4159,14 +4159,14 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { rangebreaks: [ - {pattern: '%w', bounds: [5, 0], operation: '(]'} + {pattern: 'day of week', bounds: [5, 0], operation: '(]'} ] } }); _assert('(5,0]', noWeekend); }); - it('should discard coords within break bounds - date %H case', function() { + it('should discard coords within break bounds - date hour case', function() { _calc({ x: [ '2020-01-02 08:00', '2020-01-02 20:00', @@ -4179,7 +4179,7 @@ describe('Test axes', function() { }, { xaxis: { rangebreaks: [ - {pattern: '%H', bounds: [17, 8], operation: '()'} + {pattern: 'hour', bounds: [17, 8], operation: '()'} ] } }); @@ -4193,7 +4193,7 @@ describe('Test axes', function() { ]); }); - it('should discard coords within break bounds - date %H / high precision case', function() { + it('should discard coords within break bounds - date hour / high precision case', function() { _calc({ x: [ '2020-01-03 17:00', @@ -4207,7 +4207,7 @@ describe('Test axes', function() { }, { xaxis: { rangebreaks: [ - {pattern: '%H', bounds: [17, 8], operation: '()'} + {pattern: 'hour', bounds: [17, 8], operation: '()'} ] } }); @@ -4222,6 +4222,162 @@ describe('Test axes', function() { ]); }); + it('should discard coords within break bounds - date hour case of [23, 1]', function() { + _calc({ + x: [ + '2020-01-01 22', + '2020-01-01 23', + '2020-01-01 23:30', + '2020-01-01 23:59', + '2020-01-01 23:59:30', + '2020-01-01 23:59:59', + '2020-01-02 00:00:00', + '2020-01-02 00:00:01', + '2020-01-02 00:00:30', + '2020-01-02 00:30', + '2020-01-02 01', + '2020-01-02 02' + ] + }, { + xaxis: { + rangebreaks: [ + {pattern: 'hour', bounds: [23, 1], operation: '()'} + ] + } + }); + _assert('with dflt operation', [ + Lib.dateTime2ms('2020-01-01 22'), + Lib.dateTime2ms('2020-01-01 23'), + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + Lib.dateTime2ms('2020-01-02 01'), + Lib.dateTime2ms('2020-01-02 02') + ]); + }); + + it('should discard coords within break bounds - date hour case of [23, 0]', function() { + _calc({ + x: [ + '2020-01-01 22', + '2020-01-01 23', + '2020-01-01 23:30', + '2020-01-01 23:59', + '2020-01-01 23:59:30', + '2020-01-01 23:59:59', + '2020-01-02 00:00:00', + '2020-01-02 00:00:01', + '2020-01-02 00:00:30', + '2020-01-02 00:30', + '2020-01-02 01', + '2020-01-02 02' + ] + }, { + xaxis: { + rangebreaks: [ + {pattern: 'hour', bounds: [23, 0], operation: '()'} + ] + } + }); + _assert('with dflt operation', [ + Lib.dateTime2ms('2020-01-01 22'), + Lib.dateTime2ms('2020-01-01 23'), + BADNUM, + BADNUM, + BADNUM, + BADNUM, + Lib.dateTime2ms('2020-01-02 00:00:00'), + Lib.dateTime2ms('2020-01-02 00:00:01'), + Lib.dateTime2ms('2020-01-02 00:00:30'), + Lib.dateTime2ms('2020-01-02 00:30'), + Lib.dateTime2ms('2020-01-02 01'), + Lib.dateTime2ms('2020-01-02 02') + ]); + }); + + it('should discard coords within break bounds - date hour case of [23, 24]', function() { + _calc({ + x: [ + '2020-01-01 22', + '2020-01-01 23', + '2020-01-01 23:30', + '2020-01-01 23:59', + '2020-01-01 23:59:30', + '2020-01-01 23:59:59', + '2020-01-02 00:00:00', + '2020-01-02 00:00:01', + '2020-01-02 00:00:30', + '2020-01-02 00:30', + '2020-01-02 01', + '2020-01-02 02' + ] + }, { + xaxis: { + rangebreaks: [ + {pattern: 'hour', bounds: [23, 24], operation: '()'} + ] + } + }); + _assert('with dflt operation', [ + Lib.dateTime2ms('2020-01-01 22'), + Lib.dateTime2ms('2020-01-01 23'), + BADNUM, + BADNUM, + BADNUM, + BADNUM, + Lib.dateTime2ms('2020-01-02 00:00:00'), + Lib.dateTime2ms('2020-01-02 00:00:01'), + Lib.dateTime2ms('2020-01-02 00:00:30'), + Lib.dateTime2ms('2020-01-02 00:30'), + Lib.dateTime2ms('2020-01-02 01'), + Lib.dateTime2ms('2020-01-02 02') + ]); + }); + + it('should discard coords within break bounds - date hour case of [23.75, 0.25]', function() { + _calc({ + x: [ + '2020-01-01 22', + '2020-01-01 23', + '2020-01-01 23:30', + '2020-01-01 23:59', + '2020-01-01 23:59:30', + '2020-01-01 23:59:59', + '2020-01-02 00:00:00', + '2020-01-02 00:00:01', + '2020-01-02 00:00:30', + '2020-01-02 00:30', + '2020-01-02 01', + '2020-01-02 02' + ] + }, { + xaxis: { + rangebreaks: [ + {pattern: 'hour', bounds: [23.75, 0.25]} + ] + } + }); + _assert('with dflt operation', [ + Lib.dateTime2ms('2020-01-01 22'), + Lib.dateTime2ms('2020-01-01 23'), + Lib.dateTime2ms('2020-01-01 23:30'), + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + BADNUM, + Lib.dateTime2ms('2020-01-02 00:30'), + Lib.dateTime2ms('2020-01-02 01'), + Lib.dateTime2ms('2020-01-02 02') + ]); + }); + it('should discard coords within [values[i], values[i] + dvalue] bounds', function() { var x = [ // Thursday @@ -4611,7 +4767,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [5, 1], operation: '()'} + {pattern: 'day of week', bounds: [5, 1], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4626,7 +4782,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [6, 0], operation: '[]'} + {pattern: 'day of week', bounds: [6, 0], operation: '[]'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4641,7 +4797,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [4, 6], operation: '()'} + {pattern: 'day of week', bounds: [4, 6], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4656,7 +4812,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [5, 5], operation: '[]'} + {pattern: 'day of week', bounds: [5, 5], operation: '[]'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4671,7 +4827,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [5, 5], operation: '()'} + {pattern: 'day of week', bounds: [5, 5], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4680,7 +4836,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%H', bounds: [17, 8], operation: '()'} + {pattern: 'hour', bounds: [17, 8], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4705,8 +4861,8 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [5, 1], operation: '()'}, - {pattern: '%H', bounds: [17, 8], operation: '()'} + {pattern: 'day of week', bounds: [5, 1], operation: '()'}, + {pattern: 'hour', bounds: [17, 8], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4728,8 +4884,8 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%H', bounds: [17, 8], operation: '()'}, - {pattern: '%w', bounds: [5, 1], operation: '()'} + {pattern: 'hour', bounds: [17, 8], operation: '()'}, + {pattern: 'day of week', bounds: [5, 1], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) @@ -4751,7 +4907,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%H', bounds: [17, 8], operation: '()'} + {pattern: 'hour', bounds: [17, 8], operation: '()'} ]; // N.B. xaxis.range[0] falls within a break gd.layout.xaxis.autorange = false; @@ -4759,7 +4915,7 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('when range[0] falls within a break pattern (%H case)', 'x', { + _assert('when range[0] falls within a break pattern (hour case)', 'x', { rangebreaks: [ [1577908800000, Lib.dateTime2ms('2020-01-02 08:00:00')], ['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms), @@ -4772,7 +4928,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis.rangebreaks = [ - {pattern: '%w', bounds: [1, 4], operation: '()'} + {pattern: 'day of week', bounds: [1, 4], operation: '()'} ]; // N.B. xaxis.range[0] falls within a break gd.layout.xaxis.autorange = false; @@ -4780,7 +4936,7 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('when range[0] falls within a break pattern (%w case)', 'x', { + _assert('when range[0] falls within a break pattern (day of week case)', 'x', { rangebreaks: [ ['2020-01-01 00:00:00', '2020-01-02 00:00:00'].map(Lib.dateTime2ms), ['2020-01-07 00:00:00', '2020-01-09 00:00:00'].map(Lib.dateTime2ms) @@ -4917,7 +5073,7 @@ describe('Test axes', function() { ] }], { xaxis: { - rangebreaks: [{pattern: '%H', bounds: [17, 8]}] + rangebreaks: [{pattern: 'hour', bounds: [17, 8]}] } }) .then(function() {