diff --git a/src/plots/cartesian/position_defaults.js b/src/plots/cartesian/position_defaults.js index c999c576643..41a4ed24ec3 100644 --- a/src/plots/cartesian/position_defaults.js +++ b/src/plots/cartesian/position_defaults.js @@ -72,7 +72,11 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer // in the axes popover to hide domain for the overlaying axis. // perhaps I should make a private version _domain that all axes get??? var domain = coerce('domain', dfltDomain); - if(domain[0] > domain[1] - 0.01) containerOut.domain = dfltDomain; + + // according to https://www.npmjs.com/package/canvas-size + // the minimum value of max canvas width across browsers and devices is 4096 + // which applied in the calculation below: + if(domain[0] > domain[1] - 1 / 4096) containerOut.domain = dfltDomain; Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain); } diff --git a/test/image/baselines/heatmap_small_aspect-ratio.png b/test/image/baselines/heatmap_small_aspect-ratio.png new file mode 100644 index 00000000000..847ac23550b Binary files /dev/null and b/test/image/baselines/heatmap_small_aspect-ratio.png differ diff --git a/test/image/mocks/heatmap_small_aspect-ratio.json b/test/image/mocks/heatmap_small_aspect-ratio.json new file mode 100644 index 00000000000..e801cc19e21 --- /dev/null +++ b/test/image/mocks/heatmap_small_aspect-ratio.json @@ -0,0 +1,70 @@ +{ + "data": [ + { + "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 ], + "y": [ 0, 1 ], + "z": [ + [ 3.7658, 2.5011, 2.0717, 1.6752, 0.8733, 1.2222, 0.7331, 0.5498, -1.0785, -0.059, -0.5587, -0.5076, -0.5458, -1.1039, -0.8066, -1.4149, -0.9971, -0.8106, -0.7879, -0.184, 0.1769, -0.2717, 1.3303, 0.8172, 0.8381, 0.8871, 0.2036, 0.293, 0.548, 0.6277, 0.4906, 0.5462, -0.7781, -0.6629, -0.9717, -0.7959, -0.565, -0.4884, -0.3175, -0.5329, -0.8867, -0.84, -1.1034, -1.0113, -0.5979, -0.3069, -0.698, -0.3803, -0.4226, 0.3691, 0.1195, 0.087, -0.2156, -0.0252 ], + [ 0.1593, 0.479, 0.1225, 0.2636, 1.6744, 1.413, 0.9552, 0.4606, 3.1634, 1.5594, 1.4996, 1.5349, 1.574, 1.8937, 0.9506, 0.8693, -1.5682, -1.3773, -1.3742, -1.7599, -1.0759, -0.9985, -0.3828, -0.2164, -1.0315, -0.8436, -0.5653, -0.7393, -0.5814, -0.8789, -0.8505, -0.8635, -0.1919, -0.2593, -0.1742, 0.032, -0.8122, -0.7263, -0.6634, -0.474, -0.9601, -0.6542, -0.553, -0.4579, 0.6746, 0.5849, 0.3134, 0.249, 0.3188, 0.0872, -0.0814, -0.0393, -0.0385, 0.3602 ] + ], + "type": "heatmap", + "showscale": true, + "colorbar": { + "thicknessmode": "fraction", + "thickness": 0.01, + "lenmode": "fraction", + "len": 0.3, + "outlinecolor": "white", + "nticks": 2, + "ticklen": 0, + "tickvals": [ -1.7599, -0.2037, 3.7658 ], + "ticktext": [ "low", "median", "high" ], + "tickcolor": "black", + "tickfont": { + "family": "Dorid Sans", + "color": "black", + "size": 10 + } + }, + "colorscale": "Portland", + "showlegend": false, + "xaxis": "x", + "yaxis": "y", + "hoverinfo": "text", + "name": "", + "xgap": 1, + "ygap": 1, + "zmin": -1.7599, + "zmax": 3.7658, + "zauto": true + }, + { + "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 ], + "y": [ 0, 1 ], + "z": [ + [ 3.7658, 2.5011, 2.0717, 1.6752, 0.8733, 1.2222, 0.7331, 0.5498, -1.0785, -0.059, -0.5587, -0.5076, -0.5458, -1.1039, -0.8066, -1.4149, -0.9971, -0.8106, -0.7879, -0.184, 0.1769, -0.2717, 1.3303, 0.8172, 0.8381, 0.8871, 0.2036, 0.293, 0.548, 0.6277, 0.4906, 0.5462, -0.7781, -0.6629, -0.9717, -0.7959, -0.565, -0.4884, -0.3175, -0.5329, -0.8867, -0.84, -1.1034, -1.0113, -0.5979, -0.3069, -0.698, -0.3803, -0.4226, 0.3691, 0.1195, 0.087, -0.2156, -0.0252 ], + [ 0.1593, 0.479, 0.1225, 0.2636, 1.6744, 1.413, 0.9552, 0.4606, 3.1634, 1.5594, 1.4996, 1.5349, 1.574, 1.8937, 0.9506, 0.8693, -1.5682, -1.3773, -1.3742, -1.7599, -1.0759, -0.9985, -0.3828, -0.2164, -1.0315, -0.8436, -0.5653, -0.7393, -0.5814, -0.8789, -0.8505, -0.8635, -0.1919, -0.2593, -0.1742, 0.032, -0.8122, -0.7263, -0.6634, -0.474, -0.9601, -0.6542, -0.553, -0.4579, 0.6746, 0.5849, 0.3134, 0.249, 0.3188, 0.0872, -0.0814, -0.0393, -0.0385, 0.3602 ] + ], + "type": "heatmap", + "showscale": false, + "xaxis": "x2", + "yaxis": "y2" + } + ] + ,"layout": { + "width": 600, + "height": 1200, + "xaxis": { + "domain": [ 0, 0.9 ] + }, + "yaxis": { + "domain": [ 0.5, 0.9 ] + }, + "xaxis2": { + "domain": [ 0.0, 0.9 ] + }, + "yaxis2": { + "domain": [ 0.445, 0.45 ] + } + } +}