diff --git a/package-lock.json b/package-lock.json index 0bcfd6213d6..900096d81a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4949,9 +4949,9 @@ } }, "gl-surface3d": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.5.2.tgz", - "integrity": "sha512-rWSQwEQDkB0T5CDEDFJwJc4VgwwJaAyFRSJ92NJlrTSwDlsEsWdzG9+APx6FWJMwkOpIoZGWqv+csswK2kMMLQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.6.0.tgz", + "integrity": "sha512-x15+u4712ysnB85G55RLJEml6mOB4VaDn0VTlXCc9JcjRl5Es10Tk7lhGGyiPtkCfHwvhnkxzYA1/rHHYN7Y0A==", "requires": { "binary-search-bounds": "^2.0.4", "bit-twiddle": "^1.0.2", @@ -10854,9 +10854,9 @@ } }, "tinycolor2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", - "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" }, "tinyqueue": { "version": "2.0.3", diff --git a/package.json b/package.json index 41ba8abbe27..0dc3a5a1edb 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "gl-select-box": "^1.0.4", "gl-spikes2d": "^1.0.2", "gl-streamtube3d": "^1.4.1", - "gl-surface3d": "^1.5.2", + "gl-surface3d": "^1.6.0", "gl-text": "^1.1.8", "glslify": "^7.1.1", "has-hover": "^1.0.1", @@ -117,7 +117,7 @@ "strongly-connected-components": "^1.0.1", "superscript-text": "^1.0.0", "svg-path-sdf": "^1.1.3", - "tinycolor2": "^1.4.1", + "tinycolor2": "^1.4.2", "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", diff --git a/src/components/colorbar/attributes.js b/src/components/colorbar/attributes.js index 8c34b050b17..9246d98fa26 100644 --- a/src/components/colorbar/attributes.js +++ b/src/components/colorbar/attributes.js @@ -173,6 +173,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { diff --git a/src/components/colorbar/draw.js b/src/components/colorbar/draw.js index a952f78340d..1cb4a8e68a4 100644 --- a/src/components/colorbar/draw.js +++ b/src/components/colorbar/draw.js @@ -683,6 +683,7 @@ function mockColorBarAxis(gd, opts, zrange) { tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, diff --git a/src/components/legend/draw.js b/src/components/legend/draw.js index b56ecf4f448..945067b5a40 100644 --- a/src/components/legend/draw.js +++ b/src/components/legend/draw.js @@ -89,7 +89,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -410,7 +409,6 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); diff --git a/src/components/rangeselector/draw.js b/src/components/rangeselector/draw.js index 7fe49cd98b4..8cad51424be 100644 --- a/src/components/rangeselector/draw.js +++ b/src/components/rangeselector/draw.js @@ -144,8 +144,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) diff --git a/src/components/sliders/draw.js b/src/components/sliders/draw.js index dff30e5d2bd..b6c1c25f5bd 100644 --- a/src/components/sliders/draw.js +++ b/src/components/sliders/draw.js @@ -302,11 +302,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -357,11 +356,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; diff --git a/src/components/updatemenus/draw.js b/src/components/updatemenus/draw.js index d5a160432c0..d74e312b74b 100644 --- a/src/components/updatemenus/draw.js +++ b/src/components/updatemenus/draw.js @@ -195,8 +195,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -435,11 +434,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; diff --git a/src/lib/gl_format_color.js b/src/lib/gl_format_color.js index a0176a58321..2e5a47a61b6 100644 --- a/src/lib/gl_format_color.js +++ b/src/lib/gl_format_color.js @@ -76,14 +76,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -91,7 +88,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 4baa8a329e5..aa0715ca8d0 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -3717,13 +3717,15 @@ function makePlotFramework(gd) { // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index f2280d48c58..eb6d7a675a2 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -1103,7 +1103,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -1586,6 +1587,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 3e732dda964..d62b424256a 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -680,6 +680,17 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'ticks', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number.', + 'This only has an effect when `tickformat` is *SI* or *B*.' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, diff --git a/src/plots/cartesian/tick_label_defaults.js b/src/plots/cartesian/tick_label_defaults.js index ad3a1d166a1..959b200d828 100644 --- a/src/plots/cartesian/tick_label_defaults.js +++ b/src/plots/cartesian/tick_label_defaults.js @@ -72,6 +72,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } diff --git a/src/plots/gl2d/scene2d.js b/src/plots/gl2d/scene2d.js index 79d6bc48de0..06d5ccd9863 100644 --- a/src/plots/gl2d/scene2d.js +++ b/src/plots/gl2d/scene2d.js @@ -145,11 +145,6 @@ proto.makeFramework = function() { this.updateSize(canvas); - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; - // create SVG container for hover text var svgContainer = this.svgContainer = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/src/plots/gl3d/layout/axis_attributes.js b/src/plots/gl3d/layout/axis_attributes.js index 4a805ff8dbb..76081cc764f 100644 --- a/src/plots/gl3d/layout/axis_attributes.js +++ b/src/plots/gl3d/layout/axis_attributes.js @@ -108,6 +108,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, diff --git a/src/plots/polar/layout_attributes.js b/src/plots/polar/layout_attributes.js index fc296524e34..c9cf34ecf29 100644 --- a/src/plots/polar/layout_attributes.js +++ b/src/plots/polar/layout_attributes.js @@ -47,6 +47,7 @@ var axisTickAttrs = overrideAll({ ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, diff --git a/src/plots/ternary/layout_attributes.js b/src/plots/ternary/layout_attributes.js index d451a6d729d..aa763b38b8e 100644 --- a/src/plots/ternary/layout_attributes.js +++ b/src/plots/ternary/layout_attributes.js @@ -40,6 +40,7 @@ var ternaryAxesAttrs = { ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, diff --git a/src/traces/carpet/axis_attributes.js b/src/traces/carpet/axis_attributes.js index 16b03ee3c48..a6e1ea53cfb 100644 --- a/src/traces/carpet/axis_attributes.js +++ b/src/traces/carpet/axis_attributes.js @@ -284,6 +284,16 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'calc', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, diff --git a/src/traces/carpet/axis_defaults.js b/src/traces/carpet/axis_defaults.js index 680a787a6c8..f6ae5e36344 100644 --- a/src/traces/carpet/axis_defaults.js +++ b/src/traces/carpet/axis_defaults.js @@ -78,6 +78,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) coerce('separatethousands'); coerce('tickformat'); coerce('exponentformat'); + coerce('minexponent'); coerce('showexponent'); coerce('categoryorder'); @@ -186,6 +187,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) delete containerOut.tickangle; delete containerOut.showexponent; delete containerOut.exponentformat; + delete containerOut.minexponent; delete containerOut.tickformat; delete containerOut.showticksuffix; delete containerOut.showtickprefix; diff --git a/src/traces/carpet/plot.js b/src/traces/carpet/plot.js index 2e61c63d578..7d45bddcbb2 100644 --- a/src/traces/carpet/plot.js +++ b/src/traces/carpet/plot.js @@ -239,7 +239,6 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat 'rotate(' + orientation.angle + ') ' + 'translate(0,' + offset + ')' ) - .classed('user-select-none', true) .attr('text-anchor', 'middle') .call(Drawing.font, axis.title.font); }); diff --git a/src/traces/indicator/attributes.js b/src/traces/indicator/attributes.js index e9bd0ab5c92..452f9665f1a 100644 --- a/src/traces/indicator/attributes.js +++ b/src/traces/indicator/attributes.js @@ -355,6 +355,7 @@ module.exports = { showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, editType: 'plot' }, 'plot'), diff --git a/src/traces/parcoords/parcoords.js b/src/traces/parcoords/parcoords.js index d314f9ad4c8..9a20e792043 100644 --- a/src/traces/parcoords/parcoords.js +++ b/src/traces/parcoords/parcoords.js @@ -350,8 +350,7 @@ function styleExtentTexts(selection) { selection .classed(c.cn.axisExtentText, true) .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); } function parcoordsInteractionState() { @@ -655,8 +654,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axis.selectAll('text') .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) .data(repeat, keyFun); @@ -673,7 +671,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisTitle, true) .attr('text-anchor', 'middle') .style('cursor', 'ew-resize') - .style('user-select', 'none') .style('pointer-events', 'auto'); axisTitle diff --git a/src/traces/sankey/render.js b/src/traces/sankey/render.js index 031d31ebdb1..3bd24ebc205 100644 --- a/src/traces/sankey/render.js +++ b/src/traces/sankey/render.js @@ -1026,7 +1026,6 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .append('text') .classed(c.cn.nodeLabel, true) .attr('transform', textFlip) - .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); diff --git a/src/traces/sunburst/attributes.js b/src/traces/sunburst/attributes.js index 4ccd65b80d9..02735365099 100644 --- a/src/traces/sunburst/attributes.js +++ b/src/traces/sunburst/attributes.js @@ -203,6 +203,7 @@ module.exports = { 'this option won\'t have any effect and `insidetextfont` would be used.' ].join(' ') }), + sort: pieAttrs.sort, domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'}) }; diff --git a/src/traces/sunburst/calc.js b/src/traces/sunburst/calc.js index e8a9a90d676..d1e5b27ac76 100644 --- a/src/traces/sunburst/calc.js +++ b/src/traces/sunburst/calc.js @@ -192,7 +192,9 @@ exports.calc = function(gd, trace) { if(failed) return; // TODO add way to sort by height also? - hierarchy.sort(function(a, b) { return b.value - a.value; }); + if(trace.sort) { + hierarchy.sort(function(a, b) { return b.value - a.value; }); + } var pullColor; var scaleColor; diff --git a/src/traces/sunburst/defaults.js b/src/traces/sunburst/defaults.js index cd034ca75fb..201867ef3d2 100644 --- a/src/traces/sunburst/defaults.js +++ b/src/traces/sunburst/defaults.js @@ -73,6 +73,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('insidetextorientation'); + coerce('sort'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now diff --git a/src/traces/surface/convert.js b/src/traces/surface/convert.js index 06bb723eb58..b65bd345730 100644 --- a/src/traces/surface/convert.js +++ b/src/traces/surface/convert.js @@ -433,8 +433,7 @@ proto.update = function(data) { var scene = this.scene; var sceneLayout = scene.fullSceneLayout; var surface = this.surface; - var alpha = data.opacity; - var colormap = parseColorScale(data, alpha); + var colormap = parseColorScale(data); var scaleFactor = scene.dataScale; var xlen = data.z[0].length; var ylen = data._ylength; @@ -679,10 +678,6 @@ proto.update = function(data) { if('lightposition' in data) { surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; } - - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } }; proto.dispose = function() { diff --git a/src/traces/treemap/attributes.js b/src/traces/treemap/attributes.js index c2f121237b2..0188e564957 100644 --- a/src/traces/treemap/attributes.js +++ b/src/traces/treemap/attributes.js @@ -268,6 +268,7 @@ module.exports = { 'Sets the positions of the `text` elements.' ].join(' ') }, + sort: pieAttrs.sort, domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}), }; diff --git a/src/traces/treemap/defaults.js b/src/traces/treemap/defaults.js index 017fe0a6013..4a2315fa7bb 100644 --- a/src/traces/treemap/defaults.js +++ b/src/traces/treemap/defaults.js @@ -114,6 +114,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pathbar.edgeshape'); } + coerce('sort'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now diff --git a/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png b/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png new file mode 100644 index 00000000000..5e961685774 Binary files /dev/null and b/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png differ diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 6ab557722dc..715fcf39340 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -102,9 +102,8 @@ if(allMock || argv.filter) { var FLAKY_LIST = [ 'treemap_coffee', - 'treemap_textposition', - 'treemap_sunburst_marker_colors', 'treemap_with-without_values', + 'gl3d_directions-streamtube1', ]; console.log(''); diff --git a/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json b/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json new file mode 100644 index 00000000000..ae2ab8d8540 --- /dev/null +++ b/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json @@ -0,0 +1,159 @@ +{ + "data": [ + { + "type": "treemap", + "labels": [ + "Alpha", + "Bravo", + "Charlie", + "Delta", + "Echo", + "Foxtrot", + "Golf", + "Hotel", + "India", + "Juliet", + "Kilo", + "Lima", + "Mike", + "November", + "Oscar", + "Papa", + "Quebec", + "Romeo", + "Sierra", + "Tango", + "Uniform", + "Victor", + "Whiskey", + "X ray", + "Yankee", + "Zulu" + ], + "parents": [ + "", + "Alpha", + "Alpha", + "Charlie", + "Charlie", + "Charlie", + "Foxtrot", + "Foxtrot", + "Foxtrot", + "Foxtrot", + "Juliet", + "Juliet", + "Juliet", + "Juliet", + "Juliet", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Uniform", + "Uniform", + "Uniform", + "Uniform", + "Uniform", + "Uniform" + ], + "level": "Juliet", + "count": "leaves+branches", + "textinfo": "label", + "insidetextorientation": "horizontal", + "marker": { + "line": { + "color": "#777" + }, + "colorscale": [ + [0, "rgba(0,0,255,1)"], + [0.5, "rgba(0,255,0,0.0)"], + [1, "rgba(255,0,0,1)"] + ], + "showscale": false + }, + "domain": { + "x": [0, 0.3] + } + }, + { + "type": "heatmap", + "zsmooth": "best", + "coloraxis": "coloraxis", + "contours": { + "z": { + "show": true + } + }, + "x": [0, 0.25, 0.5, 0.75, 1], + "y": [0, 0.25, 0.5, 0.75, 1], + "z": [ + [0, 0, 0, 0, 0], + [0, 0.1, 0.8, 0.7, 0], + [0, 0.2, 0, 0.6, 0], + [0, 0.3, 0.4, 0.5, 0], + [0, 0, 0, 0, 0] + ] + }, + { + "type": "surface", + "coloraxis": "coloraxis", + "contours": { + "z": { + "show": true + } + }, + "x": [0, 0.25, 0.5, 0.75, 1], + "y": [0, 0.25, 0.5, 0.75, 1], + "z": [ + [0, 0, 0, 0, 0], + [0, 0.1, 0.8, 0.7, 0], + [0, 0.2, 0, 0.6, 0], + [0, 0.3, 0.4, 0.5, 0], + [0, 0, 0, 0, 0] + ] + } + ], + "layout": { + "width": 1000, + "height": 350, + "title": { + "text": "treemap, heatmap & surface plots with transparent colorscale" + }, + "coloraxis": { + "colorscale": [ + [0, "rgba(0,0,255,1)"], + [0.5, "rgba(0,255,0,0.0)"], + [1, "rgba(255,0,0,1)"] + ] + }, + "margin": { + "t": 75, + "l": 25, + "r": 25, + "b": 25 + }, + "xaxis": { + "domain": [0.35, 0.65] + }, + "scene": { + "domain": { + "x": [0.7, 1] + }, + "camera": { + "eye": { + "x": 0, + "y": 0, + "z": 2 + }, + "up": { + "x": 0, + "y": 1, + "z": 0 + } + } + } + } +} diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 94c2d74c762..49d8ccb0948 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -2851,6 +2851,58 @@ describe('Test axes', function() { ]); }); + it('Does not use SI prefixes for 10^n with |n| < minexponent', function() { + var textOut = mockCalc({ + type: 'log', + tickmode: 'linear', + exponentformat: 'SI', + minexponent: 5, + showexponent: 'all', + tick0: 0, + dtick: 1, + range: [-18.5, 18.5] + }); + + expect(textOut).toEqual([ + '10\u221218', + '10\u221217', + '10\u221216', + '1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n', + '1μ', '0.00001', '0.0001', '0.001', '0.01', '0.1', '1', '10', '100', + '1000', '10,000', '100,000', '1M', '10M', '100M', '1G', '10G', '100G', + '1T', '10T', '100T', + '1015', + '1016', + '1017', + '1018' + ]); + + textOut = mockCalc({ + type: 'log', + tickmode: 'linear', + exponentformat: 'SI', + minexponent: 0, + showexponent: 'all', + tick0: 0, + dtick: 1, + range: [-18.5, 18.5] + }); + + expect(textOut).toEqual([ + '10\u221218', + '10\u221217', + '10\u221216', + '1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n', + '1μ', '10μ', '100μ', '1m', '10m', '100m', '1', '10', '100', + '1k', '10k', '100k', '1M', '10M', '100M', '1G', '10G', '100G', + '1T', '10T', '100T', + '1015', + '1016', + '1017', + '1018' + ]); + }); + it('supports e/E format on log axes', function() { ['e', 'E'].forEach(function(e) { var textOut = mockCalc({ diff --git a/test/jasmine/tests/mock_test.js b/test/jasmine/tests/mock_test.js index d68c3604bd2..a176476e869 100644 --- a/test/jasmine/tests/mock_test.js +++ b/test/jasmine/tests/mock_test.js @@ -562,6 +562,7 @@ var list = [ 'gl3d_surface_transparent-with-contours', 'gl3d_surface-circular-colorscale', 'gl3d_surface-circular-opacityscale', + 'gl3d_surface-heatmap-treemap_transparent-colorscale', 'gl3d_surface-lighting', 'gl3d_tetrahedra', 'gl3d_text-weirdness', @@ -1614,6 +1615,7 @@ figs['gl3d_surface_opacity_match_mesh3d'] = require('@mocks/gl3d_surface_opacity figs['gl3d_surface_transparent-with-contours'] = require('@mocks/gl3d_surface_transparent-with-contours'); figs['gl3d_surface-circular-colorscale'] = require('@mocks/gl3d_surface-circular-colorscale'); figs['gl3d_surface-circular-opacityscale'] = require('@mocks/gl3d_surface-circular-opacityscale'); +// figs['gl3d_surface-heatmap-treemap_transparent-colorscale'] = require('@mocks/gl3d_surface-heatmap-treemap_transparent-colorscale'); // figs['gl3d_surface-lighting'] = require('@mocks/gl3d_surface-lighting'); figs['gl3d_tetrahedra'] = require('@mocks/gl3d_tetrahedra'); figs['gl3d_text-weirdness'] = require('@mocks/gl3d_text-weirdness');