diff --git a/src/components/colorscale/defaults.js b/src/components/colorscale/defaults.js index 2620ff873f9..569a43793e1 100644 --- a/src/components/colorscale/defaults.js +++ b/src/components/colorscale/defaults.js @@ -115,6 +115,9 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout if(prefix && inTrace) showScaleDflt = hasColorbar(containerIn); var showScale = coerce(prefix + 'showscale', showScaleDflt); - if(showScale) colorbarDefaults(containerIn, containerOut, layout); + if(showScale) { + if(prefix && template) containerOut._template = template; + colorbarDefaults(containerIn, containerOut, layout); + } } }; diff --git a/test/image/baselines/marker_colorscale_template.png b/test/image/baselines/marker_colorscale_template.png index a22df3b544a..7bf77870b71 100644 Binary files a/test/image/baselines/marker_colorscale_template.png and b/test/image/baselines/marker_colorscale_template.png differ diff --git a/test/image/baselines/parcats_colorscale_template.png b/test/image/baselines/parcats_colorscale_template.png new file mode 100644 index 00000000000..455c9107f19 Binary files /dev/null and b/test/image/baselines/parcats_colorscale_template.png differ diff --git a/test/image/baselines/treemap_coffee.png b/test/image/baselines/treemap_coffee.png index d283751e01c..bd29b4a7a76 100644 Binary files a/test/image/baselines/treemap_coffee.png and b/test/image/baselines/treemap_coffee.png differ diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index f8a1ca22f91..07848a385ad 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -101,6 +101,7 @@ if(allMock || argv.filter) { } var FLAKY_LIST = [ + 'treemap_coffee', 'treemap_textposition', 'treemap_with-without_values_template', 'trace_metatext', diff --git a/test/image/mocks/parcats_colorscale_template.json b/test/image/mocks/parcats_colorscale_template.json new file mode 100644 index 00000000000..2da7b688de2 --- /dev/null +++ b/test/image/mocks/parcats_colorscale_template.json @@ -0,0 +1,41 @@ +{ + "data": [ + { + "type": "parcats", + "line": { + "color": [ 0, 1, 1, 0, 1 ], + "showscale": true + }, + "dimensions": [ + { + "label": "Hair", + "values": [ "Black", "Black", "Black", "Brown", "Brown", "Brown", "Red", "Brown" ] + }, + { + "label": "Eye", + "values": [ "Brown", "Brown", "Brown", "Brown", "Brown", "Blue", "Blue", "Blue" ] + }, + { + "label": "Sex", + "values": [ "Female", "Female", "Female", "Male", "Female", "Male", "Male", "Male" ] + } + ] + } + ], + "layout": { + "template": { + "data": { + "parcats": [ + { + "line": { + "colorscale": [[0, "red"], [1, "blue"]], + "colorbar": { + "ypad": 100 + } + } + } + ] + } + } + } +}