diff --git a/src/components/rangeslider/draw.js b/src/components/rangeslider/draw.js index 28bd04b09c9..f1e01939ac8 100644 --- a/src/components/rangeslider/draw.js +++ b/src/components/rangeslider/draw.js @@ -136,7 +136,7 @@ module.exports = function(gd) { return (v - rl0) / drl * opts._width; }; - if(axisOpts.breaks) { + if(axisOpts.rangebreaks) { var rsBreaks = axisOpts.locateBreaks(rl0, rl1); if(rsBreaks.length) { @@ -169,7 +169,7 @@ module.exports = function(gd) { }; // fill pixel (i.e. 'p') min/max here, - // to not have to loop through the _breaks twice during `p2d` + // to not have to loop through the _rangebreaks twice during `p2d` for(j = 0; j < rsBreaks.length; j++) { brk = rsBreaks[j]; brk.pmin = opts.d2p(brk.min); @@ -455,8 +455,8 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { _context: gd._context }; - if(axisOpts.breaks) { - mockFigure.layout.xaxis.breaks = axisOpts.breaks; + if(axisOpts.rangebreaks) { + mockFigure.layout.xaxis.rangebreaks = axisOpts.rangebreaks; } mockFigure.layout[oppAxisName] = { @@ -466,8 +466,8 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { calendar: oppAxisOpts.calendar }; - if(oppAxisOpts.breaks) { - mockFigure.layout[oppAxisName].breaks = oppAxisOpts.breaks; + if(oppAxisOpts.rangebreaks) { + mockFigure.layout[oppAxisName].rangebreaks = oppAxisOpts.rangebreaks; } Plots.supplyDefaults(mockFigure); diff --git a/src/plots/cartesian/autorange.js b/src/plots/cartesian/autorange.js index 65718fcbadd..305be474860 100644 --- a/src/plots/cartesian/autorange.js +++ b/src/plots/cartesian/autorange.js @@ -95,13 +95,13 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis breaks in [v0,v1] and compute its length in value space + // find axis rangebreaks in [v0,v1] and compute its length in value space var calcBreaksLength = function(v0, v1) { var lBreaks = 0; - if(ax.breaks) { - var breaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < breaksOut.length; i++) { - var brk = breaksOut[i]; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; lBreaks += brk.max - brk.min; } } diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 8261d36af9b..fa19b0e6cf4 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -610,17 +610,17 @@ axes.calcTicks = function calcTicks(ax) { generateTicks(); - if(ax.breaks) { + if(ax.rangebreaks) { var nTicksBefore = tickVals.length; - // remove ticks falling inside breaks + // remove ticks falling inside rangebreaks tickVals = tickVals.filter(function(d) { return ax.maskBreaks(d.value) !== BADNUM; }); - // if 'numerous' ticks get placed into breaks, + // if 'numerous' ticks get placed into rangebreaks, // increase dtick to generate more ticks, - // so that some hopefully fall between breaks + // so that some hopefully fall between rangebreaks if(ax.tickmode === 'auto' && tickVals.length < nTicksBefore / 6) { axes.autoTicks(ax, ax._roughDTick / 3); autoTickRound(ax); @@ -706,8 +706,8 @@ function arrayTicks(ax) { if(j < vals.length) ticksOut.splice(j, vals.length - j); - if(ax.breaks) { - // remove ticks falling inside breaks + if(ax.rangebreaks) { + // remove ticks falling inside rangebreaks ticksOut = ticksOut.filter(function(d) { return ax.maskBreaks(d.x) !== BADNUM; }); @@ -2871,7 +2871,7 @@ axes.shouldShowZeroLine = function(gd, ax, counterAxis) { (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && - !(ax.breaks && ax.maskBreaks(0) === BADNUM) && + !(ax.rangebreaks && ax.maskBreaks(0) === BADNUM) && ( clipEnds(ax, 0) || !anyCounterAxLineAtZero(gd, ax, counterAxis, rng) || diff --git a/src/plots/cartesian/axis_defaults.js b/src/plots/cartesian/axis_defaults.js index d0bb2060038..da4f7e6a97a 100644 --- a/src/plots/cartesian/axis_defaults.js +++ b/src/plots/cartesian/axis_defaults.js @@ -120,12 +120,12 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(containerOut.type === 'date') { - var breaks = containerIn.breaks; - if(Array.isArray(breaks) && breaks.length) { + var rangebreaks = containerIn.rangebreaks; + if(Array.isArray(rangebreaks) && rangebreaks.length) { handleArrayContainerDefaults(containerIn, containerOut, { - name: 'breaks', + name: 'rangebreaks', inclusionAttr: 'enabled', - handleItemDefaults: breaksDefaults + handleItemDefaults: rangebreaksDefaults }); setConvert(containerOut, layoutOut); @@ -135,7 +135,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, if(trace.type === 'scattergl' || trace.type === 'splom') { trace.visible = false; Lib.warn(trace.type + - ' traces do not work on axes with breaks.' + + ' traces do not work on axes with rangebreaks.' + ' Setting trace ' + trace.index + ' to `visible: false`.'); } } @@ -146,9 +146,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -function breaksDefaults(itemIn, itemOut, containerOut) { +function rangebreaksDefaults(itemIn, itemOut, containerOut) { function coerce(attr, dflt) { - return Lib.coerce(itemIn, itemOut, layoutAttributes.breaks, attr, dflt); + return Lib.coerce(itemIn, itemOut, layoutAttributes.rangebreaks, attr, dflt); } var enabled = coerce('enabled'); diff --git a/src/plots/cartesian/dragbox.js b/src/plots/cartesian/dragbox.js index 117df9affe8..be7bfd12dce 100644 --- a/src/plots/cartesian/dragbox.js +++ b/src/plots/cartesian/dragbox.js @@ -986,7 +986,7 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var axi = axList[i]; if(axi.fixedrange) continue; - if(axi.breaks) { + if(axi.rangebreaks) { var isY = axi._id.charAt(0) === 'y'; var r0F = isY ? (1 - r0Fraction) : r0Fraction; var r1F = isY ? (1 - r1Fraction) : r1Fraction; @@ -1012,7 +1012,7 @@ function dragAxList(axList, pix) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - if(axi.breaks) { + if(axi.rangebreaks) { var p0 = 0; var p1 = axi._length; var d0 = axi.p2l(p0 + pix) - axi.p2l(p0); diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 7be688013fe..fe77d6fb915 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -249,15 +249,15 @@ module.exports = { ].join(' ') }, - breaks: templatedArray('break', { + rangebreaks: templatedArray('rangebreak', { enabled: { valType: 'boolean', role: 'info', dflt: true, editType: 'calc', description: [ - 'Determines whether this axis break is enabled or disabled.', - 'Please note that `breaks` only work for *date* axis type.' + 'Determines whether this axis rangebreak is enabled or disabled.', + 'Please note that `rangebreaks` only work for *date* axis type.' ].join(' ') }, @@ -270,7 +270,7 @@ module.exports = { ], editType: 'calc', description: [ - 'Sets the lower and upper bounds of this axis break.', + 'Sets the lower and upper bounds of this axis rangebreak.', 'Can be used with `operation` to determine the behavior at the bounds.', 'Can be used with `pattern`.' ].join(' ') @@ -308,7 +308,7 @@ module.exports = { editType: 'calc' }, description: [ - 'Sets the coordinate values corresponding to the breaks.', + 'Sets the coordinate values corresponding to the rangebreaks.', 'An alternative to `bounds`.', 'Use `dvalue` to set the size of the values along the axis.' ].join(' ') @@ -333,12 +333,12 @@ module.exports = { role: 'info', editType: 'calc', description: [ - 'Determines if we include or not the bound values within the break.', + 'Determines if we include or not the bound values within the rangebreak.', 'Closed interval bounds (i.e. starting with *[* or ending with *]*)', - 'include the bound value within the break and thus make coordinates', + 'include the bound value within the rangebreak and thus make coordinates', 'equal to the bound disappear.', 'Open interval bounds (i.e. starting with *(* or ending with *)*)', - 'does not include the bound value within the break and thus keep coordinates', + 'does not include the bound value within the rangebreak and thus keep coordinates', 'equal to the bound on the axis.' ].join(' ') }, @@ -351,7 +351,7 @@ module.exports = { editType: 'calc', role: 'info', description: [ - 'Sets the gap distance between the start and the end of this break.', + 'Sets the gap distance between the start and the end of this rangebreak.', 'Use with `gapmode` to set the unit of measurement.' ].join(' ') }, diff --git a/src/plots/cartesian/set_convert.js b/src/plots/cartesian/set_convert.js index 7f468ec2df0..42a27bf92ad 100644 --- a/src/plots/cartesian/set_convert.js +++ b/src/plots/cartesian/set_convert.js @@ -188,10 +188,10 @@ module.exports = function setConvert(ax, fullLayout) { return _p2l(px, ax._m, ax._b); }; - if(ax.breaks) { + if(ax.rangebreaks) { l2p = function(v) { if(!isNumeric(v)) return BADNUM; - var len = ax._breaks.length; + var len = ax._rangebreaks.length; if(!len) return _l2p(v, ax._m, ax._b); var isY = axLetter === 'y'; @@ -200,7 +200,7 @@ module.exports = function setConvert(ax, fullLayout) { var q = 0; for(var i = 0; i < len; i++) { var nextI = i + 1; - var brk = ax._breaks[i]; + var brk = ax._rangebreaks[i]; var min = isY ? -brk.max : brk.min; var max = isY ? -brk.min : brk.max; @@ -218,7 +218,7 @@ module.exports = function setConvert(ax, fullLayout) { p2l = function(px) { if(!isNumeric(px)) return BADNUM; - var len = ax._breaks.length; + var len = ax._rangebreaks.length; if(!len) return _p2l(px, ax._m, ax._b); var isY = axLetter === 'y'; @@ -227,7 +227,7 @@ module.exports = function setConvert(ax, fullLayout) { var q = 0; for(var i = 0; i < len; i++) { var nextI = i + 1; - var brk = ax._breaks[i]; + var brk = ax._rangebreaks[i]; var min = isY ? -brk.pmax : brk.pmin; var max = isY ? -brk.pmin : brk.pmax; @@ -550,43 +550,43 @@ module.exports = function setConvert(ax, fullLayout) { ax._b = -ax._m * rl0; } - // set of "N" disjoint breaks inside the range - ax._breaks = []; - // length of these breaks in value space - negative on reversed axes + // set of "N" disjoint rangebreaks inside the range + ax._rangebreaks = []; + // length of these rangebreaks in value space - negative on reversed axes ax._lBreaks = 0; // l2p slope (same for all intervals) ax._m2 = 0; // set of l2p offsets (one for each of the (N+1) piecewise intervals) ax._B = []; - if(ax.breaks) { + if(ax.rangebreaks) { var i, brk; - ax._breaks = ax.locateBreaks( + ax._rangebreaks = ax.locateBreaks( Math.min(rl0, rl1), Math.max(rl0, rl1) ); var axReverse = rl0 > rl1; var signAx = axReverse ? -1 : 1; - if(ax._breaks.length) { - for(i = 0; i < ax._breaks.length; i++) { - brk = ax._breaks[i]; + if(ax._rangebreaks.length) { + for(i = 0; i < ax._rangebreaks.length; i++) { + brk = ax._rangebreaks[i]; ax._lBreaks += brk.max - brk.min; } ax._m2 = ax._length / (rl1 - rl0 - ax._lBreaks * signAx); if(axLetter === 'y') { - ax._breaks.reverse(); + ax._rangebreaks.reverse(); // N.B. top to bottom (negative coord, positive px direction) ax._B.push(ax._m2 * rl1); } else { ax._B.push(-ax._m2 * rl0); } - for(i = 0; i < ax._breaks.length; i++) { - brk = ax._breaks[i]; + for(i = 0; i < ax._rangebreaks.length; i++) { + brk = ax._rangebreaks[i]; ax._B.push(ax._B[ax._B.length - 1] - ax._m2 * (brk.max - brk.min) * signAx); } if(axReverse) { @@ -594,9 +594,9 @@ module.exports = function setConvert(ax, fullLayout) { } // fill pixel (i.e. 'p') min/max here, - // to not have to loop through the _breaks twice during `p2l` - for(i = 0; i < ax._breaks.length; i++) { - brk = ax._breaks[i]; + // to not have to loop through the _rangebreaks twice during `p2l` + for(i = 0; i < ax._rangebreaks.length; i++) { + brk = ax._rangebreaks[i]; brk.pmin = l2p(axReverse ? brk.max : brk.min); brk.pmax = l2p(axReverse ? brk.min : brk.max); } @@ -610,11 +610,11 @@ module.exports = function setConvert(ax, fullLayout) { }; ax.maskBreaks = function(v) { - var breaksIn = ax.breaks || []; + var rangebreaksIn = ax.rangebreaks || []; var bnds, b0, b1, vb; - for(var i = 0; i < breaksIn.length; i++) { - var brk = breaksIn[i]; + for(var i = 0; i < rangebreaksIn.length; i++) { + var brk = rangebreaksIn[i]; if(brk.enabled) { var op = brk.operation; @@ -695,10 +695,10 @@ module.exports = function setConvert(ax, fullLayout) { ax.locateBreaks = function(r0, r1) { var i, bnds, b0, b1; - var breaksOut = []; - if(!ax.breaks) return breaksOut; + var rangebreaksOut = []; + if(!ax.rangebreaks) return rangebreaksOut; - var breaksIn = ax.breaks.slice().sort(function(a, b) { + 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; return 0; @@ -710,8 +710,8 @@ module.exports = function setConvert(ax, fullLayout) { if(min === max) return; var isNewBreak = true; - for(var j = 0; j < breaksOut.length; j++) { - var brkj = breaksOut[j]; + for(var j = 0; j < rangebreaksOut.length; j++) { + var brkj = rangebreaksOut[j]; if(min > brkj.max || max < brkj.min) { // potentially a new break } else { @@ -725,12 +725,12 @@ module.exports = function setConvert(ax, fullLayout) { } } if(isNewBreak) { - breaksOut.push({min: min, max: max}); + rangebreaksOut.push({min: min, max: max}); } }; - for(i = 0; i < breaksIn.length; i++) { - var brk = breaksIn[i]; + for(i = 0; i < rangebreaksIn.length; i++) { + var brk = rangebreaksIn[i]; if(brk.enabled) { var op = brk.operation; @@ -750,7 +750,7 @@ module.exports = function setConvert(ax, fullLayout) { var r0PatternDelta; // delta between break bounds in ms var bndDelta; - // step in ms between breaks + // step in ms between rangebreaks var step; // tracker to position bounds var t; @@ -816,9 +816,9 @@ module.exports = function setConvert(ax, fullLayout) { } } - breaksOut.sort(function(a, b) { return a.min - b.min; }); + rangebreaksOut.sort(function(a, b) { return a.min - b.min; }); - return breaksOut; + return rangebreaksOut; }; // makeCalcdata: takes an x or y array and converts it @@ -870,8 +870,8 @@ module.exports = function setConvert(ax, fullLayout) { } } - // mask (i.e. set to BADNUM) coords that fall inside breaks - if(ax.breaks) { + // mask (i.e. set to BADNUM) coords that fall inside rangebreaks + if(ax.rangebreaks) { for(i = 0; i < len; i++) { arrayOut[i] = ax.maskBreaks(arrayOut[i]); } diff --git a/test/image/mocks/axes_breaks-bars.json b/test/image/mocks/axes_breaks-bars.json index 12dc70110ce..addfa7ccbc0 100644 --- a/test/image/mocks/axes_breaks-bars.json +++ b/test/image/mocks/axes_breaks-bars.json @@ -22,7 +22,7 @@ "font": {"size": 12} }, "yaxis": { - "breaks": [ + "rangebreaks": [ { "bounds": [ "1970-01-01 00:00:00.000", diff --git a/test/image/mocks/axes_breaks-finance.json b/test/image/mocks/axes_breaks-finance.json index 0bb9daa882d..9da3dac8ae1 100644 --- a/test/image/mocks/axes_breaks-finance.json +++ b/test/image/mocks/axes_breaks-finance.json @@ -361,7 +361,7 @@ "showlegend": false, "xaxis": { "rangeslider": { "visible": true }, - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ 6, 0 ], @@ -374,7 +374,7 @@ }, "xaxis2": { "rangeslider": { "visible": true }, - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "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 e7341919e7d..a2dcf78bf23 100644 --- a/test/image/mocks/axes_breaks-night_autorange-reversed.json +++ b/test/image/mocks/axes_breaks-night_autorange-reversed.json @@ -190,7 +190,7 @@ "width": 800, "height": 800, "xaxis": { - "breaks": [ + "rangebreaks": [ { "pattern": "%H", "bounds": [ @@ -206,7 +206,7 @@ ] }, "xaxis2": { - "breaks": [ + "rangebreaks": [ { "pattern": "%H", "bounds": [ @@ -251,7 +251,7 @@ ] }, "yaxis3": { - "breaks": [ + "rangebreaks": [ { "pattern": "%H", "bounds": [ @@ -268,7 +268,7 @@ ] }, "yaxis4": { - "breaks": [ + "rangebreaks": [ { "pattern": "%H", "bounds": [ diff --git a/test/image/mocks/axes_breaks-rangeslider.json b/test/image/mocks/axes_breaks-rangeslider.json index a0230d2d4be..f7e9bf30c0d 100644 --- a/test/image/mocks/axes_breaks-rangeslider.json +++ b/test/image/mocks/axes_breaks-rangeslider.json @@ -2652,7 +2652,7 @@ "xaxis": { "tickformat": "%d %b %H:%M", "tickfont": {"size": 8}, - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [6, 0], diff --git a/test/image/mocks/axes_breaks-tickvals.json b/test/image/mocks/axes_breaks-tickvals.json index c68d40e8440..ddebfa8ed8d 100644 --- a/test/image/mocks/axes_breaks-tickvals.json +++ b/test/image/mocks/axes_breaks-tickvals.json @@ -16,7 +16,7 @@ ], "layout": { "xaxis": { - "breaks": [ + "rangebreaks": [ {"bounds": [ "1969-12-31 23:59:59.999", "1970-01-01 00:00:00.090" diff --git a/test/image/mocks/axes_breaks-values.json b/test/image/mocks/axes_breaks-values.json index 92fb240e3fe..3469b58471e 100644 --- a/test/image/mocks/axes_breaks-values.json +++ b/test/image/mocks/axes_breaks-values.json @@ -13,7 +13,7 @@ ], "layout": { "xaxis": { - "breaks": [ + "rangebreaks": [ { "values": [ "2020-01-04", "2020-01-05" ] } ] } diff --git a/test/image/mocks/axes_breaks-weekends-weeknights.json b/test/image/mocks/axes_breaks-weekends-weeknights.json index 3cef36b00cf..9ac70567ba0 100644 --- a/test/image/mocks/axes_breaks-weekends-weeknights.json +++ b/test/image/mocks/axes_breaks-weekends-weeknights.json @@ -13,7 +13,7 @@ ], "layout": { "xaxis": { - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ 6, 0 ], diff --git a/test/image/mocks/axes_breaks-weekends_autorange-reversed.json b/test/image/mocks/axes_breaks-weekends_autorange-reversed.json index 6b71b31d654..07911549448 100644 --- a/test/image/mocks/axes_breaks-weekends_autorange-reversed.json +++ b/test/image/mocks/axes_breaks-weekends_autorange-reversed.json @@ -86,7 +86,7 @@ "width": 800, "height": 800, "xaxis": { - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ @@ -102,7 +102,7 @@ ] }, "xaxis2": { - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ @@ -147,7 +147,7 @@ ] }, "yaxis3": { - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ @@ -164,7 +164,7 @@ ] }, "yaxis4": { - "breaks": [ + "rangebreaks": [ { "pattern": "%w", "bounds": [ diff --git a/test/image/mocks/axes_breaks.json b/test/image/mocks/axes_breaks.json index 0b2ac05a290..0a213bff086 100644 --- a/test/image/mocks/axes_breaks.json +++ b/test/image/mocks/axes_breaks.json @@ -60,7 +60,7 @@ "layout": { "grid": { "rows": 2, "columns": 2, "pattern": "independent" }, "yaxis": { - "breaks": [ + "rangebreaks": [ {"bounds": [ "1970-01-01 00:00:00.011", "1970-01-01 00:00:00.089" @@ -72,7 +72,7 @@ ] }, "xaxis3": { - "breaks": [ + "rangebreaks": [ {"bounds": [ "1970-01-01 00:00:00.011", "1970-01-01 00:00:00.089" diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 9b023fb0eb6..35cc81a4e20 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -1019,121 +1019,121 @@ describe('Test axes', function() { expect(layoutOut.yaxis2.range).withContext('yaxis2 range').toEqual([0, 4]); }); - it('should coerce *breaks* container only on a date axis', function() { + it('should coerce *rangebreaks* container only on a date axis', function() { var bounds = ['2020-01-10', '2020-01-11']; layoutIn = { - xaxis: {breaks: [{bounds: bounds}], type: 'date'}, - xaxis2: {breaks: [{bounds: bounds}], type: '-'}, - xaxis3: {breaks: [{bounds: bounds}], type: 'linear'}, - xaxis4: {breaks: [{bounds: bounds}], type: 'log'}, - xaxis5: {breaks: [{bounds: bounds}], type: 'category'}, - xaxis6: {breaks: [{bounds: bounds}], type: 'multicategory'} + xaxis: {rangebreaks: [{bounds: bounds}], type: 'date'}, + xaxis2: {rangebreaks: [{bounds: bounds}], type: '-'}, + xaxis3: {rangebreaks: [{bounds: bounds}], type: 'linear'}, + xaxis4: {rangebreaks: [{bounds: bounds}], type: 'log'}, + xaxis5: {rangebreaks: [{bounds: bounds}], type: 'category'}, + xaxis6: {rangebreaks: [{bounds: bounds}], type: 'multicategory'} }; layoutOut._subplots.xaxis.push('x2', 'x3', 'x4', 'x5', 'x6'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(Array.isArray(layoutOut.xaxis.breaks) && layoutOut.xaxis.breaks.length) - .toBe(1, 'xaxis.breaks is array of length 1'); - expect(layoutOut.xaxis2.breaks).toBeUndefined(); - expect(layoutOut.xaxis3.breaks).toBeUndefined(); - expect(layoutOut.xaxis4.breaks).toBeUndefined(); - expect(layoutOut.xaxis5.breaks).toBeUndefined(); - expect(layoutOut.xaxis6.breaks).toBeUndefined(); + expect(Array.isArray(layoutOut.xaxis.rangebreaks) && layoutOut.xaxis.rangebreaks.length) + .toBe(1, 'xaxis.rangebreaks is array of length 1'); + expect(layoutOut.xaxis2.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis3.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis4.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis5.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis6.rangebreaks).toBeUndefined(); }); - it('should coerce *breaks* container only when it is a non-empty array', function() { + it('should coerce *rangebreaks* container only when it is a non-empty array', function() { layoutIn = { - xaxis: {type: 'date', breaks: [{bounds: ['2020-01-10', '2020-01-11']}]}, - xaxis2: {type: 'date', breaks: []}, - xaxis3: {type: 'date', breaks: false}, + xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-10', '2020-01-11']}]}, + xaxis2: {type: 'date', rangebreaks: []}, + xaxis3: {type: 'date', rangebreaks: false}, xaxis4: {type: 'date'} }; layoutOut._subplots.xaxis.push('x2', 'x3', 'x4'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(Array.isArray(layoutOut.xaxis.breaks) && layoutOut.xaxis.breaks.length) - .toBe(1, 'xaxis.breaks is array of length 1'); - expect(layoutOut.xaxis2.breaks).toBeUndefined(); - expect(layoutOut.xaxis3.breaks).toBeUndefined(); - expect(layoutOut.xaxis4.breaks).toBeUndefined(); + expect(Array.isArray(layoutOut.xaxis.rangebreaks) && layoutOut.xaxis.rangebreaks.length) + .toBe(1, 'xaxis.rangebreaks is array of length 1'); + expect(layoutOut.xaxis2.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis3.rangebreaks).toBeUndefined(); + expect(layoutOut.xaxis4.rangebreaks).toBeUndefined(); }); - it('should set *breaks* to *enabled:false* when *bounds* have less than 2 items', function() { + it('should set *rangebreaks* to *enabled:false* when *bounds* have less than 2 items', function() { layoutIn = { - xaxis: {type: 'date', breaks: [{bounds: ['2020-01-10']}]}, - xaxis2: {type: 'date', breaks: [{bounds: ['2020-01-10'], values: ['2020-01-11']}]}, - xaxis3: {type: 'date', breaks: [{bounds: ['2020-01-10'], values: {}}]}, - xaxis4: {type: 'date', breaks: [{bounds: ['2020-01-10', '2020-01-11', '2020-01-12']}]} + xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-10']}]}, + xaxis2: {type: 'date', rangebreaks: [{bounds: ['2020-01-10'], values: ['2020-01-11']}]}, + xaxis3: {type: 'date', rangebreaks: [{bounds: ['2020-01-10'], values: {}}]}, + xaxis4: {type: 'date', rangebreaks: [{bounds: ['2020-01-10', '2020-01-11', '2020-01-12']}]} }; layoutOut._subplots.xaxis.push('x2', 'x3', 'x4'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut.xaxis.breaks[0].enabled).toBe(false, 'invalid *bounds*'); - expect(layoutOut.xaxis2.breaks[0].enabled).toBe(true, 'invalid *bounds*, valid *values*'); - expect(layoutOut.xaxis3.breaks[0].enabled).toBe(false, 'invalid *bounds*, invalid *values*'); - expect(layoutOut.xaxis4.breaks[0].enabled && layoutOut.xaxis4.breaks[0].bounds) + expect(layoutOut.xaxis.rangebreaks[0].enabled).toBe(false, 'invalid *bounds*'); + expect(layoutOut.xaxis2.rangebreaks[0].enabled).toBe(true, 'invalid *bounds*, valid *values*'); + expect(layoutOut.xaxis3.rangebreaks[0].enabled).toBe(false, 'invalid *bounds*, invalid *values*'); + expect(layoutOut.xaxis4.rangebreaks[0].enabled && layoutOut.xaxis4.rangebreaks[0].bounds) .withContext('valid *bounds*, sliced to length=2').toEqual(['2020-01-10', '2020-01-11']); }); - it('if *breaks* *bounds* are bigger than the set *range*, disable break', function() { + it('if *rangebreaks* *bounds* are bigger than the set *range*, disable rangebreak', function() { layoutIn = { - xaxis: {type: 'date', range: ['2020-01-10', '2020-01-14'], breaks: [{bounds: ['2020-01-11', '2020-01-12']}]}, - xaxis2: {type: 'date', range: ['2020-01-11', '2020-01-12'], breaks: [{bounds: ['2020-01-10', '2020-01-14']}]}, - xaxis3: {type: 'date', range: ['2020-01-14', '2020-01-10'], breaks: [{bounds: ['2020-01-12', '2020-01-11']}]}, - xaxis4: {type: 'date', range: ['2020-01-12', '2020-01-11'], breaks: [{bounds: ['2020-01-14', '2020-01-10']}]} + xaxis: {type: 'date', range: ['2020-01-10', '2020-01-14'], rangebreaks: [{bounds: ['2020-01-11', '2020-01-12']}]}, + xaxis2: {type: 'date', range: ['2020-01-11', '2020-01-12'], rangebreaks: [{bounds: ['2020-01-10', '2020-01-14']}]}, + xaxis3: {type: 'date', range: ['2020-01-14', '2020-01-10'], rangebreaks: [{bounds: ['2020-01-12', '2020-01-11']}]}, + xaxis4: {type: 'date', range: ['2020-01-12', '2020-01-11'], rangebreaks: [{bounds: ['2020-01-14', '2020-01-10']}]} }; layoutOut._subplots.xaxis.push('x2', 'x3', 'x4'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut.xaxis.breaks[0].enabled).toBe(true, '*bounds* within set range'); - expect(layoutOut.xaxis2.breaks[0].enabled).toBe(false, '*bounds* bigger than set range'); - expect(layoutOut.xaxis3.breaks[0].enabled).toBe(true, '*bounds* within set range (reversed)'); - expect(layoutOut.xaxis4.breaks[0].enabled).toBe(false, '*bounds* bigger than set range (reversed)'); + expect(layoutOut.xaxis.rangebreaks[0].enabled).toBe(true, '*bounds* within set range'); + expect(layoutOut.xaxis2.rangebreaks[0].enabled).toBe(false, '*bounds* bigger than set range'); + expect(layoutOut.xaxis3.rangebreaks[0].enabled).toBe(true, '*bounds* within set range (reversed)'); + expect(layoutOut.xaxis4.rangebreaks[0].enabled).toBe(false, '*bounds* bigger than set range (reversed)'); }); - it('should coerce *breaks* *bounds* over *values*/*dvalue* if both are present', function() { + it('should coerce *rangebreaks* *bounds* over *values*/*dvalue* if both are present', function() { layoutIn = { - xaxis: {type: 'date', breaks: [{bounds: ['2020-01-10', '2020-01-11']}]}, - xaxis2: {type: 'date', breaks: [{values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, - xaxis3: {type: 'date', breaks: [{bounds: ['2020-01-10', '2020-01-11'], values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, - xaxis4: {type: 'date', breaks: [{bounds: false, values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, + xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-10', '2020-01-11']}]}, + xaxis2: {type: 'date', rangebreaks: [{values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, + xaxis3: {type: 'date', rangebreaks: [{bounds: ['2020-01-10', '2020-01-11'], values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, + xaxis4: {type: 'date', rangebreaks: [{bounds: false, values: ['2020-01-10', '2020-01-12', '2020-01-14'], dvalue: 2}]}, }; layoutOut._subplots.xaxis.push('x2', 'x3', 'x4'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - var xaBreak = layoutOut.xaxis.breaks[0]; + var xaBreak = layoutOut.xaxis.rangebreaks[0]; expect(xaBreak.bounds).withContext('valid *bounds*').toEqual(['2020-01-10', '2020-01-11']); expect(xaBreak.values).toBe(undefined, 'not coerced'); expect(xaBreak.dvalue).toBe(undefined, 'not coerced'); - xaBreak = layoutOut.xaxis2.breaks[0]; + xaBreak = layoutOut.xaxis2.rangebreaks[0]; expect(xaBreak.bounds).toBe(undefined, 'not set, not coerced'); expect(xaBreak.values).withContext('valid *values*').toEqual(['2020-01-10', '2020-01-12', '2020-01-14']); expect(xaBreak.dvalue).toBe(2, 'valid *dvalue*'); - xaBreak = layoutOut.xaxis3.breaks[0]; + xaBreak = layoutOut.xaxis3.rangebreaks[0]; expect(xaBreak.bounds).withContext('set to valid, coerced').toEqual(['2020-01-10', '2020-01-11']); expect(xaBreak.values).toBe(undefined, 'not coerced'); expect(xaBreak.dvalue).toBe(undefined, 'not coerced'); - xaBreak = layoutOut.xaxis4.breaks[0]; + xaBreak = layoutOut.xaxis4.rangebreaks[0]; expect(xaBreak.bounds).toBe(undefined, 'set but invalid, not coerced'); expect(xaBreak.values).withContext('valid *values*').toEqual(['2020-01-10', '2020-01-12', '2020-01-14']); expect(xaBreak.dvalue).toBe(2, 'valid *dvalue*'); }); - it('should only coerce breaks *pattern* with *bounds*', function() { + it('should only coerce rangebreaks *pattern* with *bounds*', function() { layoutIn = { - xaxis: {type: 'date', breaks: [{bounds: ['2020-01-04', '2020-01-05']}]}, - xaxis2: {type: 'date', breaks: [{bounds: [6, 0], pattern: '%w'}]}, - xaxis3: {type: 'date', breaks: [{values: ['2020-01-04', '2020-01-05'], pattern: 'NOP'}]}, + xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-04', '2020-01-05']}]}, + xaxis2: {type: 'date', rangebreaks: [{bounds: [6, 0], pattern: '%w'}]}, + 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.breaks[0].pattern).toBe('', 'coerced to dflt value'); - expect(layoutOut.xaxis2.breaks[0].pattern).toBe('%w', 'coerced'); - expect(layoutOut.xaxis3.breaks[0].pattern).toBe(undefined, 'not coerce, using *values*'); + expect(layoutOut.xaxis.rangebreaks[0].pattern).toBe('', 'coerced to dflt value'); + expect(layoutOut.xaxis2.rangebreaks[0].pattern).toBe('%w', 'coerced'); + expect(layoutOut.xaxis3.rangebreaks[0].pattern).toBe(undefined, 'not coerce, using *values*'); }); }); @@ -4021,7 +4021,7 @@ describe('Test axes', function() { }); }); - describe('*breaks*', function() { + describe('*rangebreaks*', function() { // TODO adapt `type: 'date'` requirement !! describe('during doCalcdata', function() { @@ -4055,7 +4055,7 @@ describe('Test axes', function() { x: x }, { xaxis: { - breaks: [ + rangebreaks: [ {'operation': '()', bounds: [ '1970-01-01 00:00:00.010', '1970-01-01 00:00:00.090' @@ -4073,7 +4073,7 @@ describe('Test axes', function() { x: x }, { xaxis: { - breaks: [ + rangebreaks: [ {'operation': '[]', bounds: [ '1970-01-01 00:00:00.010', '1970-01-01 00:00:00.090' @@ -4091,7 +4091,7 @@ describe('Test axes', function() { x: x }, { xaxis: { - breaks: [ + rangebreaks: [ {'operation': '[)', bounds: [ '1970-01-01 00:00:00.010', '1970-01-01 00:00:00.090' @@ -4133,7 +4133,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%w', bounds: [6, 0], operation: '[]'} ] } @@ -4142,7 +4142,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%w', bounds: [5, 1], operation: '()'} ] } @@ -4151,7 +4151,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%w', bounds: [6, 1], operation: '[)'} ] } @@ -4160,7 +4160,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%w', bounds: [5, 0], operation: '(]'} ] } @@ -4180,7 +4180,7 @@ describe('Test axes', function() { ] }, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%H', bounds: [17, 8]} ] } @@ -4208,7 +4208,7 @@ describe('Test axes', function() { ] }, { xaxis: { - breaks: [ + rangebreaks: [ {pattern: '%H', bounds: [17, 8]} ] } @@ -4242,7 +4242,7 @@ describe('Test axes', function() { _calc({x: x}, { xaxis: { - breaks: [{values: ['2020-01-04', '2020-01-05'], dvalue: ONEDAY}], + rangebreaks: [{values: ['2020-01-04', '2020-01-05'], dvalue: ONEDAY}], } }); _assert('two values', [ @@ -4266,7 +4266,7 @@ describe('Test axes', function() { ] }, { xaxis: { - breaks: [{ values: [ + rangebreaks: [{ values: [ '1970-01-01 00:00:00.002', '1970-01-01 00:00:00.003' ], dvalue: 1, operation: '()' }] @@ -4275,14 +4275,14 @@ describe('Test axes', function() { _assert('', [1, 2, BADNUM, 4, 5]); }); - it('should adapt coords generated from x0/dx about breaks', function() { + it('should adapt coords generated from x0/dx about rangebreaks', function() { _calc({ x0: '1970-01-01 00:00:00.001', dx: 0.5, y: [1, 3, 5, 2, 4] }, { xaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.002', '1970-01-01 00:00:00.003' @@ -4308,7 +4308,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis._lBreaks).toBe(exp.lBreaks, msg + '| lBreaks'); } - it('should adapt padding about axis breaks length', function(done) { + it('should adapt padding about axis rangebreaks length', function(done) { Plotly.plot(gd, [{ mode: 'markers', x: [ @@ -4323,7 +4323,7 @@ describe('Test axes', function() { ] }], { xaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4353,21 +4353,21 @@ describe('Test axes', function() { }) .then(function() { gd.data[0].mode = 'markers'; - gd.layout.xaxis.breaks[0].enabled = false; + gd.layout.xaxis.rangebreaks[0].enabled = false; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('mode:markers | one of two breaks enabled', { + _assert('mode:markers | one of two rangebreaks enabled', { xrng: ['1969-12-31 23:59:59.9928', '1970-01-01 00:00:00.2072'], lBreaks: 88 }); }) .then(function() { - gd.layout.xaxis.breaks[1].enabled = false; + gd.layout.xaxis.rangebreaks[1].enabled = false; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('mode:markers | no breaks enabled', { + _assert('mode:markers | no rangebreaks enabled', { xrng: ['1969-12-31 23:59:59.9871', '1970-01-01 00:00:00.2129'], lBreaks: 0 }); @@ -4391,21 +4391,21 @@ describe('Test axes', function() { var ax = fullLayout[axLetter + 'axis']; if(exp) { - expect(ax._breaks.length) - .toBe(exp.breaks.length, msg + '| correct # of breaks'); - expect(ax._breaks.map(function(brk) { return [brk.min, brk.max]; })) - .toBeCloseTo2DArray(exp.breaks, 2, msg + '| breaks [min,max]'); + expect(ax._rangebreaks.length) + .toBe(exp.rangebreaks.length, msg + '| correct # of rangebreaks'); + expect(ax._rangebreaks.map(function(brk) { return [brk.min, brk.max]; })) + .toBeCloseTo2DArray(exp.rangebreaks, 2, msg + '| rangebreaks [min,max]'); expect(ax._m2).toBe(exp.m2, msg + '| l2p slope'); expect(ax._B).toBeCloseToArray(exp.B, 2, msg + '| l2p piecewise offsets'); } else { - expect(ax._breaks).withContext(msg).toEqual([]); + expect(ax._rangebreaks).withContext(msg).toEqual([]); expect(ax._m2).toBe(0, msg); expect(ax._B).withContext(msg).toEqual([]); } } - it('should locate breaks & compute l <-> p parameters - x-axis case', function(done) { + it('should locate rangebreaks & compute l <-> p parameters - x-axis case', function(done) { Plotly.plot(gd, [{ x: [ '1970-01-01 00:00:00.000', @@ -4421,10 +4421,10 @@ describe('Test axes', function() { xaxis: {} }) .then(function() { - _assert('no set breaks', 'x', null); + _assert('no set rangebreaks', 'x', null); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4437,14 +4437,14 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('2 disjoint breaks within range', 'x', { - breaks: [[11, 89], [101, 189]], + _assert('2 disjoint rangebreaks within range', 'x', { + rangebreaks: [[11, 89], [101, 189]], m2: 14.062499999998405, B: [30.937, -1065.937, -2303.437] }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4457,14 +4457,14 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('2 overlapping breaks within range', 'x', { - breaks: [[11, 189]], + _assert('2 overlapping rangebreaks within range', 'x', { + rangebreaks: [[11, 189]], m2: 21.7741935483922, B: [30.483, -3845.322] }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {bounds: [ '1969-12-31 23:59:59.990', '1970-01-01 00:00:00.089' @@ -4478,13 +4478,13 @@ describe('Test axes', function() { }) .then(function() { _assert('break beyond xaxis.range[0]', 'x', { - breaks: [[88.6, 89], [101, 189]], + rangebreaks: [[88.6, 89], [101, 189]], m2: 22.1311475409836, B: [-1960.819, -1969.672, -3917.213] }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4498,13 +4498,13 @@ describe('Test axes', function() { }) .then(function() { _assert('break beyond xaxis.range[1]', 'x', { - breaks: [[11, 89], [101, 101.4]], + rangebreaks: [[11, 89], [101, 101.4]], m2: 22.131147540988888, B: [30.983, -1695.245, -1704.098] }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {bounds: [ '1969-12-31 23:59:59.989', '1970-01-01 00:00:00.090' @@ -4517,8 +4517,8 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('both breaks beyond xaxis.range', 'x', { - breaks: [[89.4, 90]], + _assert('both rangebreaks beyond xaxis.range', 'x', { + rangebreaks: [[89.4, 90]], m2: 50.943396226415125, B: [-4554.339622641512, -4584.9056603773615] }); @@ -4527,7 +4527,7 @@ describe('Test axes', function() { .then(done); }); - it('should locate breaks & compute l <-> p parameters - y-axis case', function(done) { + it('should locate rangebreaks & compute l <-> p parameters - y-axis case', function(done) { Plotly.plot(gd, [{ y: [ '1970-01-01 00:00:00.000', @@ -4543,10 +4543,10 @@ describe('Test axes', function() { yaxis: {} }) .then(function() { - _assert('no set breaks', 'y', null); + _assert('no set rangebreaks', 'y', null); }) .then(function() { - gd.layout.yaxis.breaks = [ + gd.layout.yaxis.rangebreaks = [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4559,14 +4559,14 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('2 disjoint breaks within range', 'y', { - breaks: [[101, 189], [11, 89]], + _assert('2 disjoint rangebreaks within range', 'y', { + rangebreaks: [[101, 189], [11, 89]], m2: 6.923076923076923, B: [1401.923, 792.692, 252.692] }); }) .then(function() { - gd.layout.yaxis.breaks = [ + gd.layout.yaxis.rangebreaks = [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4579,8 +4579,8 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('2 overlapping breaks within range', 'y', { - breaks: [[11, 189]], + _assert('2 overlapping rangebreaks within range', 'y', { + rangebreaks: [[11, 189]], m2: 10.714285714283243, B: [2160, 252.857] }); @@ -4589,7 +4589,7 @@ describe('Test axes', function() { .then(done); }); - it('should locate breaks & compute l <-> p parameters - date axis case', function(done) { + it('should locate rangebreaks & compute l <-> p parameters - date axis case', function(done) { Plotly.plot(gd, [{ x: [ // Thursday @@ -4609,17 +4609,17 @@ describe('Test axes', function() { xaxis: {} }) .then(function() { - _assert('no set breaks', 'x', null); + _assert('no set rangebreaks', 'x', null); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [5, 1]} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('break over the weekend days', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-04', '2020-01-06'].map(Lib.dateTime2ms) ], m2: 0.000001640946501588664, @@ -4627,14 +4627,14 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [6, 0], operation: '[]'} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('break over the weekend days (with operation:[])', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-04', '2020-01-06'].map(Lib.dateTime2ms) ], m2: 0.000001640946501588664, @@ -4642,14 +4642,14 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [4, 6]} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('skip Friday', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-03', '2020-01-04'].map(Lib.dateTime2ms) ], m2: 0.0000012658730158736563, @@ -4657,14 +4657,14 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [5, 5], operation: '[]'} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('skip Friday (operation:[] version)', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-03', '2020-01-04'].map(Lib.dateTime2ms) ], m2: 0.0000012658730158736563, @@ -4672,23 +4672,23 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [5, 5], operation: '()'} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('bad input -> implied empty breaks', 'x', null); + _assert('bad input -> implied empty rangebreaks', 'x', null); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%H', bounds: [17, 8]} ]; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('breaks outside workday hours', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms), ['2020-01-03 17:00:00', '2020-01-04 08:00:00'].map(Lib.dateTime2ms), ['2020-01-04 17:00:00', '2020-01-05 08:00:00'].map(Lib.dateTime2ms), @@ -4706,7 +4706,7 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [5, 1]}, {pattern: '%H', bounds: [17, 8]} ]; @@ -4714,7 +4714,7 @@ describe('Test axes', function() { }) .then(function() { _assert('breaks outside workday hours & weekends', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms), ['2020-01-03 17:00:00', '2020-01-06 08:00:00'].map(Lib.dateTime2ms), ['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms), @@ -4729,7 +4729,7 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%H', bounds: [17, 8]}, {pattern: '%w', bounds: [5, 1]} ]; @@ -4737,7 +4737,7 @@ describe('Test axes', function() { }) .then(function() { _assert('breaks outside workday hours & weekends (reversed break order)', 'x', { - breaks: [ + rangebreaks: [ ['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms), ['2020-01-03 17:00:00', '2020-01-06 08:00:00'].map(Lib.dateTime2ms), ['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms), @@ -4752,7 +4752,7 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%H', bounds: [17, 8]} ]; // N.B. xaxis.range[0] falls within a break @@ -4762,7 +4762,7 @@ describe('Test axes', function() { }) .then(function() { _assert('when range[0] falls within a break pattern (%H case)', 'x', { - breaks: [ + 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), ['2020-01-03 17:00:00', '2020-01-04 08:00:00'].map(Lib.dateTime2ms), @@ -4773,7 +4773,7 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks = [ + gd.layout.xaxis.rangebreaks = [ {pattern: '%w', bounds: [1, 4]} ]; // N.B. xaxis.range[0] falls within a break @@ -4783,7 +4783,7 @@ describe('Test axes', function() { }) .then(function() { _assert('when range[0] falls within a break pattern (%w case)', 'x', { - breaks: [ + 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) ], @@ -4813,7 +4813,7 @@ describe('Test axes', function() { .withContext(msg).toEqual(exp.tickVals); } - it('should not include ticks that fall within breaks', function(done) { + it('should not include ticks that fall within rangebreaks', function(done) { Plotly.plot(gd, [{ x: [ '1970-01-01 00:00:00.000', @@ -4837,7 +4837,7 @@ describe('Test axes', function() { }) .then(function() { gd.layout.xaxis = { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -4851,7 +4851,7 @@ describe('Test axes', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('with two breaks', { + _assert('with two rangebreaks', { tickVals: [0, 10, 100, 200] }); }) @@ -4859,12 +4859,12 @@ describe('Test axes', function() { .then(done); }); - it('should increase dtick when too many (auto) ticks fall into breaks', function(done) { + it('should increase dtick when too many (auto) ticks fall into rangebreaks', function(done) { var fig = Lib.extendDeep({}, require('@mocks/axes_breaks-finance.json')); // break over weekend - fig.layout.xaxis.breaks[0].enabled = false; + fig.layout.xaxis.rangebreaks[0].enabled = false; // break on a single holiday - fig.layout.xaxis.breaks[1].enabled = false; + fig.layout.xaxis.rangebreaks[1].enabled = false; Plotly.plot(gd, fig) .then(function() { @@ -4873,12 +4873,12 @@ describe('Test axes', function() { }); }) .then(function() { - gd.layout.xaxis.breaks[0].enabled = true; - gd.layout.xaxis.breaks[1].enabled = true; + gd.layout.xaxis.rangebreaks[0].enabled = true; + gd.layout.xaxis.rangebreaks[1].enabled = true; return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { - _assert('with breaks enabled on x-axis', { + _assert('with rangebreaks enabled on x-axis', { tickVals: [ 1483574400000, 1484092800000, 1484611200000, 1484870400000, 1485388800000, 1485907200000, 1486425600000, 1486684800000 @@ -4902,7 +4902,7 @@ describe('Test axes', function() { }); }); - it('should set visible:false in scattergl traces on axis with breaks', function(done) { + it('should set visible:false in scattergl traces on axis with rangebreaks', function(done) { var gd = createGraphDiv(); spyOn(Lib, 'warn'); @@ -4919,13 +4919,13 @@ describe('Test axes', function() { ] }], { xaxis: { - breaks: [{pattern: '%H', bounds: [17, 8]}] + rangebreaks: [{pattern: '%H', bounds: [17, 8]}] } }) .then(function() { expect(gd._fullData[0].visible).toBe(false, 'sets visible:false'); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('scattergl traces do not work on axes with breaks. Setting trace 0 to `visible: false`.'); + expect(Lib.warn).toHaveBeenCalledWith('scattergl traces do not work on axes with rangebreaks. Setting trace 0 to `visible: false`.'); }) .catch(failTest) .then(function() { diff --git a/test/jasmine/tests/cartesian_interact_test.js b/test/jasmine/tests/cartesian_interact_test.js index 91cb61395f9..8016d86f4b1 100644 --- a/test/jasmine/tests/cartesian_interact_test.js +++ b/test/jasmine/tests/cartesian_interact_test.js @@ -2030,7 +2030,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(done); }); - describe('with axis breaks', function() { + describe('with axis rangebreaks', function() { it('should compute correct range updates - x-axis case', function(done) { function _assert(msg, xrng) { expect(gd.layout.xaxis.range).toBeCloseToArray(xrng, 2, 'xrng - ' + msg); @@ -2050,7 +2050,7 @@ describe('axis zoom/pan and main plot zoom', function() { ] }], { xaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -2070,7 +2070,7 @@ describe('axis zoom/pan and main plot zoom', function() { ]); }) .then(doDrag('xy', 'nsew', 50, 0)) - // x range would be ~ [100, 118] w/o breaks + // x range would be ~ [100, 118] w/o rangebreaks .then(function() { _assert('after x-only zoombox', [ '1970-01-01 00:00:00.095', @@ -2086,7 +2086,7 @@ describe('axis zoom/pan and main plot zoom', function() { }) .then(function() { return Plotly.relayout(gd, 'dragmode', 'pan'); }) .then(doDrag('xy', 'nsew', 50, 0)) - // x range would be ~ [-18, 181] w/o breaks + // x range would be ~ [-18, 181] w/o rangebreaks .then(function() { _assert('after x-only pan', [ '1969-12-31 23:59:59.9969', @@ -2116,7 +2116,7 @@ describe('axis zoom/pan and main plot zoom', function() { ] }], { yaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -2136,7 +2136,7 @@ describe('axis zoom/pan and main plot zoom', function() { ]); }) .then(doDrag('xy', 'nsew', 0, 50)) - // y range would be ~ [62, 100] w/o breaks + // y range would be ~ [62, 100] w/o rangebreaks .then(function() { _assert('after y-only zoombox', [ '1970-01-01 00:00:00.01', @@ -2152,7 +2152,7 @@ describe('axis zoom/pan and main plot zoom', function() { }) .then(function() { return Plotly.relayout(gd, 'dragmode', 'pan'); }) .then(doDrag('xy', 'nsew', 0, 50)) - // y range would be ~ [35, 239] w/o breaks + // y range would be ~ [35, 239] w/o rangebreaks .then(function() { _assert('after y-only pan', [ '1970-01-01 00:00:00.0051', diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 4b5fd59ecef..dfe24ddcad6 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -2682,7 +2682,7 @@ describe('Hover on multicategory axes', function() { }); }); -describe('Hover on axes with breaks', function() { +describe('Hover on axes with rangebreaks', function() { var gd; var eventData; @@ -2704,7 +2704,7 @@ describe('Hover on axes with breaks', function() { expect(eventData.y).toBe(exp.y, 'event data y'); } - it('should work when breaks are present on x-axis', function(done) { + it('should work when rangebreaks are present on x-axis', function(done) { Plotly.plot(gd, [{ mode: 'lines', // i.e. no autorange padding x: [ @@ -2720,7 +2720,7 @@ describe('Hover on axes with breaks', function() { ] }], { xaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -2772,7 +2772,7 @@ describe('Hover on axes with breaks', function() { .then(done); }); - it('should work when breaks are present on y-axis', function(done) { + it('should work when rangebreaks are present on y-axis', function(done) { Plotly.plot(gd, [{ mode: 'lines', // i.e. no autorange padding y: [ @@ -2788,7 +2788,7 @@ describe('Hover on axes with breaks', function() { ] }], { yaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' diff --git a/test/jasmine/tests/range_slider_test.js b/test/jasmine/tests/range_slider_test.js index c719d0576dd..a7232261480 100644 --- a/test/jasmine/tests/range_slider_test.js +++ b/test/jasmine/tests/range_slider_test.js @@ -201,7 +201,7 @@ describe('Visible rangesliders', function() { .then(done); }); - it('should update correctly when moving slider on an axis with breaks', function(done) { + it('should update correctly when moving slider on an axis with rangebreaks', function(done) { var start = 250; var end = 300; @@ -219,7 +219,7 @@ describe('Visible rangesliders', function() { ] }], { xaxis: { - breaks: [ + rangebreaks: [ {bounds: [ '1970-01-01 00:00:00.011', '1970-01-01 00:00:00.089' @@ -246,7 +246,7 @@ describe('Visible rangesliders', function() { }) .then(function() { return slide(start, sliderY, end, sliderY); }) .then(function() { - // x range would be ~ [15.625, 200] w/o breaks + // x range would be ~ [15.625, 200] w/o rangebreaks expect(gd._fullLayout.xaxis.range).withContext('after xrng').toEqual([ '1970-01-01 00:00:00.0027', '1970-01-01 00:00:00.2'