diff --git a/src/components/colorbar/draw.js b/src/components/colorbar/draw.js index a695747e113..7b01b971113 100644 --- a/src/components/colorbar/draw.js +++ b/src/components/colorbar/draw.js @@ -1004,6 +1004,7 @@ function mockColorBarAxis(gd, opts, zrange) { noHover: true, noTickson: true, noTicklabelmode: true, + noInsideRange: true, calendar: fullLayout.calendar // not really necessary (yet?) }; diff --git a/src/plot_api/helpers.js b/src/plot_api/helpers.js index aa1405ce738..f30b9539fd3 100644 --- a/src/plot_api/helpers.js +++ b/src/plot_api/helpers.js @@ -72,6 +72,9 @@ exports.cleanLayout = function(layout) { ax.autorange = true; ax.rangemode = 'tozero'; } + + if(ax.insiderange) delete ax.range; + delete ax.islog; delete ax.isdate; delete ax.categories; // replaced by _categories diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 7e50588c651..a104e88bb11 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -357,9 +357,12 @@ function _doPlot(gd, data, layout, config) { seq.push( drawAxes, function insideTickLabelsAutorange(gd) { - if(gd._fullLayout._insideTickLabelsAutorange) { - relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { - gd._fullLayout._insideTickLabelsAutorange = undefined; + var insideTickLabelsUpdaterange = gd._fullLayout._insideTickLabelsUpdaterange; + if(insideTickLabelsUpdaterange) { + gd._fullLayout._insideTickLabelsUpdaterange = undefined; + + return relayout(gd, insideTickLabelsUpdaterange).then(function() { + Axes.saveRangeInitial(gd, true); }); } } @@ -379,16 +382,9 @@ function _doPlot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, - saveRangeInitialForInsideTickLabels, Plots.previousPromises ); - function saveRangeInitialForInsideTickLabels(gd) { - if(gd._fullLayout._insideTickLabelsAutorange) { - if(graphWasEmpty) Axes.saveRangeInitial(gd, true); - } - } - // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -1793,7 +1789,6 @@ function relayout(gd, astr, val) { // something may have happened within relayout that we // need to wait for var seq = [Plots.previousPromises]; - if(flags.layoutReplot) { seq.push(subroutines.layoutReplot); } else if(Object.keys(aobj).length) { diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index d3a56d04ad3..de8a293501c 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -3821,28 +3821,105 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var computeTickLabelBoundingBoxes = function() { + var labelsMaxW = 0; + var labelsMaxH = 0; + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb; + + if(ax._vals[i]) { + bb = ax._vals[i].bb || Drawing.bBox(thisLabel.node()); + ax._vals[i].bb = bb; + } + + labelsMaxW = Math.max(labelsMaxW, bb.width); + labelsMaxH = Math.max(labelsMaxH, bb.height); + } + }); + + return { + labelsMaxW: labelsMaxW, + labelsMaxH: labelsMaxH + }; + }; + var anchorAx = ax._anchorAxis; if( - anchorAx && anchorAx.autorange && + anchorAx && (anchorAx.autorange || anchorAx.insiderange) && insideTicklabelposition(ax) && !isLinked(fullLayout, ax._id) ) { - if(!fullLayout._insideTickLabelsAutorange) { - fullLayout._insideTickLabelsAutorange = {}; + if(!fullLayout._insideTickLabelsUpdaterange) { + fullLayout._insideTickLabelsUpdaterange = {}; } - fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; - - seq.push( - function computeFinalTickLabelBoundingBoxes() { - tickLabels.each(function(d, i) { - var thisLabel = selectTickLabel(this); - var mathjaxGroup = thisLabel.select('.text-math-group'); - if(mathjaxGroup.empty()) { - ax._vals[i].bb = Drawing.bBox(thisLabel.node()); - } - }); + + if(anchorAx.autorange) { + fullLayout._insideTickLabelsUpdaterange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push(computeTickLabelBoundingBoxes); + } + + if(anchorAx.insiderange) { + var BBs = computeTickLabelBoundingBoxes(); + var move = ax._id.charAt(0) === 'y' ? + BBs.labelsMaxW : + BBs.labelsMaxH; + + move += 2 * TEXTPAD; + + if(ax.ticklabelposition === 'inside') { + move += ax.ticklen || 0; } - ); + + var sgn = (ax.side === 'right' || ax.side === 'top') ? 1 : -1; + var index = sgn === 1 ? 1 : 0; + var otherIndex = sgn === 1 ? 0 : 1; + + var newRange = []; + newRange[otherIndex] = anchorAx.range[otherIndex]; + + var p0 = anchorAx.d2p(anchorAx.range[index]); + var p1 = anchorAx.d2p(anchorAx.range[otherIndex]); + var dist = Math.abs(p1 - p0); + if(dist - move > 0) { + dist -= move; + move *= 1 + move / dist; + } else { + move = 0; + } + + if(ax._id.charAt(0) !== 'y') move = -move; + + newRange[index] = anchorAx.p2d( + anchorAx.d2p(anchorAx.range[index]) + + sgn * move + ); + + // handle partial ranges in insiderange + if( + anchorAx.autorange === 'min' || + anchorAx.autorange === 'max reversed' + ) { + newRange[0] = null; + + anchorAx._rangeInitial0 = undefined; + anchorAx._rangeInitial1 = undefined; + } else if( + anchorAx.autorange === 'max' || + anchorAx.autorange === 'min reversed' + ) { + newRange[1] = null; + + anchorAx._rangeInitial0 = undefined; + anchorAx._rangeInitial1 = undefined; + } + + fullLayout._insideTickLabelsUpdaterange[anchorAx._name + '.range'] = newRange; + } } var done = Lib.syncOrAsync(seq); diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 894dd649fa4..bfa540f082c 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -398,6 +398,21 @@ module.exports = { 'If true, then zoom is disabled.' ].join(' ') }, + insiderange: { + valType: 'info_array', + items: [ + {valType: 'any', editType: 'plot'}, + {valType: 'any', editType: 'plot'} + ], + editType: 'plot', + description: [ + 'Could be used to set the desired inside range of this axis', + '(excluding the labels) when `ticklabelposition` of', + 'the anchored axis has *inside*.', + 'Not implemented for axes with `type` *log*.', + 'This would be ignored when `range` is provided.' + ].join(' ') + }, // scaleanchor: not used directly, just put here for reference // values are any opposite-letter axis id, or `false`. scaleanchor: { diff --git a/src/plots/cartesian/range_defaults.js b/src/plots/cartesian/range_defaults.js index eefb9c19703..c2e36ae44f5 100644 --- a/src/plots/cartesian/range_defaults.js +++ b/src/plots/cartesian/range_defaults.js @@ -10,6 +10,25 @@ module.exports = function handleRangeDefaults(containerIn, containerOut, coerce, coerce('maxallowed'); var range = coerce('range'); + if(!range) { + var insiderange; + if(!options.noInsiderange && axType !== 'log') { + insiderange = coerce('insiderange'); + + // We may support partial insideranges in future + // For now it is out of scope + if(insiderange && ( + insiderange[0] === null || + insiderange[1] === null + )) { + containerOut.insiderange = false; + insiderange = undefined; + } + + if(insiderange) range = coerce('range', insiderange); + } + } + var autorangeDflt = containerOut.getAutorangeDflt(range, options); var autorange = coerce('autorange', autorangeDflt); diff --git a/src/plots/gl3d/layout/axis_defaults.js b/src/plots/gl3d/layout/axis_defaults.js index f6759f04f8f..fff3e6ec2a1 100644 --- a/src/plots/gl3d/layout/axis_defaults.js +++ b/src/plots/gl3d/layout/axis_defaults.js @@ -46,6 +46,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { noTicklabelstep: true, noTicklabelposition: true, noTicklabeloverflow: true, + noInsiderange: true, bgColor: options.bgColor, calendar: options.calendar }, diff --git a/test/image/baselines/zz-insiderange-x-narrow.png b/test/image/baselines/zz-insiderange-x-narrow.png new file mode 100644 index 00000000000..38280ba02a2 Binary files /dev/null and b/test/image/baselines/zz-insiderange-x-narrow.png differ diff --git a/test/image/baselines/zz-insiderange-x.png b/test/image/baselines/zz-insiderange-x.png new file mode 100644 index 00000000000..fb804bbbc26 Binary files /dev/null and b/test/image/baselines/zz-insiderange-x.png differ diff --git a/test/image/baselines/zz-insiderange-y-narrow.png b/test/image/baselines/zz-insiderange-y-narrow.png new file mode 100644 index 00000000000..b963f0928f2 Binary files /dev/null and b/test/image/baselines/zz-insiderange-y-narrow.png differ diff --git a/test/image/baselines/zz-insiderange-y.png b/test/image/baselines/zz-insiderange-y.png new file mode 100644 index 00000000000..71fdcb33ad0 Binary files /dev/null and b/test/image/baselines/zz-insiderange-y.png differ diff --git a/test/image/mocks/zz-insiderange-x-narrow.json b/test/image/mocks/zz-insiderange-x-narrow.json new file mode 100644 index 00000000000..861f09b75e9 --- /dev/null +++ b/test/image/mocks/zz-insiderange-x-narrow.json @@ -0,0 +1,99 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x2", + "yaxis": "y2", + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [2000, 2001, 2002, 2003], + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [2000, 2001, 2002, 2003], + "y": [1000, 10, 100, 1] + }], + "layout": { + "xaxis": { + "insiderange": [1, 2], + "anchor": "y", + "domain": [0, 0.45], + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.45], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis2": { + "insiderange": [2, 1], + "anchor": "y2", + "domain": [0, 0.45], + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis3": { + "type": "date", + "insiderange": ["2001-01", "2002-01"], + "anchor": "y3", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0, 0.45], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis4": { + "type": "date", + "insiderange": ["2002-01", "2001-01"], + "anchor": "y4", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 300, + "height": 900, + "margin": { + "t": 60, + "b": 60, + "l": 60, + "r": 60 + } + } +} diff --git a/test/image/mocks/zz-insiderange-x.json b/test/image/mocks/zz-insiderange-x.json new file mode 100644 index 00000000000..f542af04c01 --- /dev/null +++ b/test/image/mocks/zz-insiderange-x.json @@ -0,0 +1,99 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x2", + "yaxis": "y2", + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [2000, 2001, 2002, 2003], + "y": [1000, 10, 100, 1] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [2000, 2001, 2002, 2003], + "y": [1000, 10, 100, 1] + }], + "layout": { + "xaxis": { + "insiderange": [1, 2], + "anchor": "y", + "domain": [0, 0.45], + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.45], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis2": { + "insiderange": [2, 1], + "anchor": "y2", + "domain": [0, 0.45], + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis3": { + "type": "date", + "insiderange": ["2001-01", "2002-01"], + "anchor": "y3", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0, 0.45], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "xaxis4": { + "type": "date", + "insiderange": ["2002-01", "2001-01"], + "anchor": "y4", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 900, + "height": 900, + "margin": { + "t": 60, + "b": 60, + "l": 60, + "r": 60 + } + } +} diff --git a/test/image/mocks/zz-insiderange-y-narrow.json b/test/image/mocks/zz-insiderange-y-narrow.json new file mode 100644 index 00000000000..9d204e82eb3 --- /dev/null +++ b/test/image/mocks/zz-insiderange-y-narrow.json @@ -0,0 +1,99 @@ +{ + "data": [{ + "yaxis": "y", + "xaxis": "x", + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y2", + "xaxis": "x2", + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y3", + "xaxis": "x3", + "y": [2000, 2001, 2002, 2003], + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y4", + "xaxis": "x4", + "y": [2000, 2001, 2002, 2003], + "x": [1000, 10, 100, 1] + }], + "layout": { + "yaxis": { + "insiderange": [1, 2], + "anchor": "x", + "domain": [0, 0.475], + "gridcolor": "white" + }, + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis2": { + "insiderange": [2, 1], + "anchor": "x2", + "domain": [0, 0.475], + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis3": { + "type": "date", + "insiderange": ["2001-01", "2002-01"], + "anchor": "x3", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis4": { + "type": "date", + "insiderange": ["2002-01", "2001-01"], + "anchor": "x4", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 900, + "height": 300, + "margin": { + "t": 60, + "b": 60, + "l": 60, + "r": 60 + } + } +} diff --git a/test/image/mocks/zz-insiderange-y.json b/test/image/mocks/zz-insiderange-y.json new file mode 100644 index 00000000000..7d3b0210084 --- /dev/null +++ b/test/image/mocks/zz-insiderange-y.json @@ -0,0 +1,99 @@ +{ + "data": [{ + "yaxis": "y", + "xaxis": "x", + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y2", + "xaxis": "x2", + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y3", + "xaxis": "x3", + "y": [2000, 2001, 2002, 2003], + "x": [1000, 10, 100, 1] + }, { + "yaxis": "y4", + "xaxis": "x4", + "y": [2000, 2001, 2002, 2003], + "x": [1000, 10, 100, 1] + }], + "layout": { + "yaxis": { + "insiderange": [1, 2], + "anchor": "x", + "domain": [0, 0.475], + "gridcolor": "white" + }, + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis2": { + "insiderange": [2, 1], + "anchor": "x2", + "domain": [0, 0.475], + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis3": { + "type": "date", + "insiderange": ["2001-01", "2002-01"], + "anchor": "x3", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "yaxis4": { + "type": "date", + "insiderange": ["2002-01", "2001-01"], + "anchor": "x4", + "domain": [0.55, 1], + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0.55, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "ticklen": 8, + "tickwidth": 3, + "gridcolor": "white" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 900, + "height": 900, + "margin": { + "t": 60, + "b": 60, + "l": 60, + "r": 60 + } + } +} diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index d0a0e2ffc5d..d128072a307 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -1703,6 +1703,36 @@ describe('Test axes', function() { }); }); + describe('insiderange relayout', function() { + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + it('can relayout insiderange', function(done) { + Plotly.newPlot(gd, [{ + y: [1, 3, 2, 4]} + ], { + xaxis: {insiderange: [0, 2]}, + yaxis: {ticklabelposition: 'inside'}, + plot_bgcolor: 'lightgray', + width: 600, + height: 600 + }).then(function() { + expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.110, 2]); + + return Plotly.relayout(gd, { + 'xaxis.insiderange': [1, 3] + }); + }).then(function() { + expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0.889, 3]); + }).then(done, done.fail); + }); + }); + describe('constraints relayout', function() { var gd; @@ -8021,6 +8051,40 @@ describe('more react tests', function() { }) .then(done, done.fail); }); + + it('insiderange react to new data', function(done) { + var layout = { + xaxis: { + insiderange: [0, 2] + }, + yaxis: { + ticklabelposition: 'inside' + }, + plot_bgcolor: 'lightgray', + width: 600, + height: 600 + }; + + var data1 = [{ + y: [1, 3, 2] + }]; + + var data2 = [{ + y: [1000, 3000, 2000] + }]; + + var fig1 = {data: data1, layout: layout}; + var fig2 = {data: data2, layout: layout}; + + Plotly.newPlot(gd, fig1) + .then(function() { + expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.110, 2]); + + return Plotly.react(gd, fig2); + }).then(function() { + expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.164, 2]); + }).then(done, done.fail); + }); }); describe('category preservation tests on gd passed to Plotly.react()', function() { diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index 9ae83eab8fe..1ce7cddb122 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -1047,31 +1047,29 @@ describe('Test click interactions:', function() { .then(done, done.fail); }); - it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (case of partial ranges reversed)', function(done) { + it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (insiderange and inside tick lables)', function(done) { mockCopy = setRanges(mockCopy); Plotly.newPlot(gd, [{ - y: [1, 2, 3, 4]} + y: [0, 1, 2, 3]} ], { - xaxis: {range: [null, 1], autorange: 'max reversed'}, - yaxis: {range: [3, null], autorange: 'min reversed'}, + xaxis: {insiderange: [1, 2]}, + yaxis: {ticks: 'inside', ticklabelposition: 'inside', side: 'right'}, + plot_bgcolor: 'lightgray', width: 600, height: 600 }).then(function() { - expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, 1]); - expect(gd.layout.yaxis.range).toBeCloseToArray([3, 0.8]); + expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.068]); return doubleClick(300, 300); }) .then(function() { - expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, -0.2]); - expect(gd.layout.yaxis.range).toBeCloseToArray([4.2, 0.8]); + expect(gd.layout.xaxis.range).toBeCloseToArray([-0.2019, 3.249]); return doubleClick(300, 300); }) .then(function() { - expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, 1]); - expect(gd.layout.yaxis.range).toBeCloseToArray([3, 0.8]); + expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.068]); }) .then(done, done.fail); }); diff --git a/test/plot-schema.json b/test/plot-schema.json index 60fbf07937d..f5fd90c3b6f 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -10892,6 +10892,21 @@ "editType": "none", "valType": "string" }, + "insiderange": { + "description": "Could be used to set the desired inside range of this axis (excluding the labels) when `ticklabelposition` of the anchored axis has *inside*. Not implemented for axes with `type` *log*. This would be ignored when `range` is provided.", + "editType": "plot", + "items": [ + { + "editType": "plot", + "valType": "any" + }, + { + "editType": "plot", + "valType": "any" + } + ], + "valType": "info_array" + }, "labelalias": { "description": "Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash. That means you need to use −1 instead of -1. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax.", "dflt": false, @@ -12217,6 +12232,21 @@ "editType": "none", "valType": "string" }, + "insiderange": { + "description": "Could be used to set the desired inside range of this axis (excluding the labels) when `ticklabelposition` of the anchored axis has *inside*. Not implemented for axes with `type` *log*. This would be ignored when `range` is provided.", + "editType": "plot", + "items": [ + { + "editType": "plot", + "valType": "any" + }, + { + "editType": "plot", + "valType": "any" + } + ], + "valType": "info_array" + }, "labelalias": { "description": "Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash. That means you need to use −1 instead of -1. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax.", "dflt": false,