diff --git a/src/plots/cartesian/constraints.js b/src/plots/cartesian/constraints.js index 249154fa6a4..895c9fffccb 100644 --- a/src/plots/cartesian/constraints.js +++ b/src/plots/cartesian/constraints.js @@ -20,6 +20,7 @@ var FROM_BL = require('../../constants/alignment').FROM_BL; exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { var allAxisIds = opts.allAxisIds; var layoutOut = opts.layoutOut; + var scaleanchorDflt = opts.scaleanchorDflt; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; var axId = containerOut._id; @@ -55,14 +56,17 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // 'matches' wins over 'scaleanchor' (for now) var scaleanchor, scaleOpts; - if(!matches && (containerIn.scaleanchor || opts.scaleanchorDflt) && !(containerOut.fixedrange && constrain !== 'domain')) { + if(!matches && + !(containerOut.fixedrange && constrain !== 'domain') && + (containerIn.scaleanchor || scaleanchorDflt) + ) { scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { valType: 'enumerated', values: scaleOpts.linkableAxes || [] } - }, 'scaleanchor', opts.scaleanchorDflt); + }, 'scaleanchor', scaleanchorDflt); } if(matches) { diff --git a/src/plots/cartesian/layout_defaults.js b/src/plots/cartesian/layout_defaults.js index cce05296e94..6063f6f9641 100644 --- a/src/plots/cartesian/layout_defaults.js +++ b/src/plots/cartesian/layout_defaults.js @@ -82,8 +82,10 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } yaMustNotScaleanchor[yaName] = true; } else if(trace.type === 'image') { - if(yaName) yaMayReverse[yaName] = true; - if(yaName) yaMayScaleanchor[yaName] = true; + if(yaName) { + yaMayReverse[yaName] = true; + yaMayScaleanchor[yaName] = true; + } } else { if(yaName) { yaMustDisplay[yaName] = true; diff --git a/test/image/baselines/image_axis_type.png b/test/image/baselines/image_axis_type.png index 09750ff77e8..f7bf648fd58 100644 Binary files a/test/image/baselines/image_axis_type.png and b/test/image/baselines/image_axis_type.png differ diff --git a/test/image/baselines/image_colormodel.png b/test/image/baselines/image_colormodel.png index 3e00f14cc1c..576268e60b7 100644 Binary files a/test/image/baselines/image_colormodel.png and b/test/image/baselines/image_colormodel.png differ diff --git a/test/image/baselines/image_opacity.png b/test/image/baselines/image_opacity.png index d24e9a08da9..4875b3d8e4a 100644 Binary files a/test/image/baselines/image_opacity.png and b/test/image/baselines/image_opacity.png differ diff --git a/test/image/baselines/image_with_gaps.png b/test/image/baselines/image_with_gaps.png index 658bf22470d..d8b21fadd4c 100644 Binary files a/test/image/baselines/image_with_gaps.png and b/test/image/baselines/image_with_gaps.png differ diff --git a/test/image/baselines/image_zmin_zmax.png b/test/image/baselines/image_zmin_zmax.png index d286b9a9f6e..44c7b816113 100644 Binary files a/test/image/baselines/image_zmin_zmax.png and b/test/image/baselines/image_zmin_zmax.png differ diff --git a/test/image/mocks/image_axis_type.json b/test/image/mocks/image_axis_type.json index 46726d0a086..85c021927b2 100644 --- a/test/image/mocks/image_axis_type.json +++ b/test/image/mocks/image_axis_type.json @@ -28,7 +28,6 @@ "width": 400, "height": 600, "title": {"text": "Image on categorical and log axes"}, "grid": {"rows": 2, "columns": 1, "pattern": "independent"}, "xaxis2": {"type": "log"}, - "yaxis": {"scaleanchor": null}, - "yaxis2": {"type": "log", "scaleanchor": null} + "yaxis2": {"type": "log"} } } diff --git a/test/image/mocks/image_colormodel.json b/test/image/mocks/image_colormodel.json index b611d7a9456..4aa9bd7084a 100644 --- a/test/image/mocks/image_colormodel.json +++ b/test/image/mocks/image_colormodel.json @@ -2,12 +2,14 @@ "data": [{ "type": "image", "colormodel": "rgb", - "dy": 10, + "hoverinfo": "all", + "dy": 1, "dx": 0.5, "z": [[[255, 0, 0], [0, 255, 0], [0, 0, 255]]] }, { "type": "image", "colormodel": "hsl", + "hoverinfo": "all", "z": [ [[0, 33, 50], [0, 66, 50], [0, 100, 50]], [[90, 33, 50], [90, 66, 50], [90, 100, 50]], @@ -18,9 +20,7 @@ "yaxis": "y2" }], "layout": { - "grid": {"rows": 2, "columns": 1, "pattern": "independent"}, - "yaxis": {"scaleanchor": null}, - "yaxis2": {"scaleanchor": null}, + "grid": {"rows": 1, "columns": 2, "pattern": "independent"}, "width": 600, "height": 400 } diff --git a/test/image/mocks/image_opacity.json b/test/image/mocks/image_opacity.json index 635300d0417..c4d5153bc76 100644 --- a/test/image/mocks/image_opacity.json +++ b/test/image/mocks/image_opacity.json @@ -5,7 +5,6 @@ "z": [[[255, 0, 0], [0, 255, 0], [0, 0, 255]]] }], "layout": { - "yaxis": {"scaleanchor": null}, "width": 400, "height": 400, "title": { "text": "image with opacity 0.1" diff --git a/test/image/mocks/image_with_gaps.json b/test/image/mocks/image_with_gaps.json index 0f2770a7992..cd9e9950a1c 100644 --- a/test/image/mocks/image_with_gaps.json +++ b/test/image/mocks/image_with_gaps.json @@ -9,7 +9,6 @@ "zmax": [1, 1, 1] }], "layout": { - "yaxis": {"scaleanchor": null}, "width": 400, "height": 400, "title": {"text": "Image with missing pixels"} } } diff --git a/test/image/mocks/image_zmin_zmax.json b/test/image/mocks/image_zmin_zmax.json index 5880cc3191f..8dd9a252ebf 100644 --- a/test/image/mocks/image_zmin_zmax.json +++ b/test/image/mocks/image_zmin_zmax.json @@ -60,14 +60,6 @@ "layout": { "width": 400, "height": 800, - "yaxis": {"scaleanchor": null}, - "yaxis2": {"scaleanchor": null}, - "yaxis3": {"scaleanchor": null}, - "yaxis4": {"scaleanchor": null}, - "yaxis5": {"scaleanchor": null}, - "yaxis6": {"scaleanchor": null}, - "yaxis7": {"scaleanchor": null}, - "yaxis8": {"scaleanchor": null}, "grid": { "rows": 4, "columns": 2, diff --git a/test/jasmine/tests/image_test.js b/test/jasmine/tests/image_test.js index 8d7ae829410..93045a1831e 100644 --- a/test/jasmine/tests/image_test.js +++ b/test/jasmine/tests/image_test.js @@ -500,10 +500,10 @@ describe('image hover:', function() { zmax: [1, 1, 1], text: [['A', 'B', 'C'], ['D', 'E', 'F']], hovertemplate: '%{text}' - }], layout: {width: 400, height: 400, yaxis: {scaleanchor: null}}}; + }], layout: {width: 400, height: 400}}; Plotly.newPlot(gd, mockCopy) - .then(function() {_hover(140, 200);}) + .then(function() {_hover(140, 180);}) .then(function() { assertHoverLabelContent({ nums: 'E',