diff --git a/src/core/core.scale.js b/src/core/core.scale.js index c04899d25a1..7eaa656c6ce 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -1620,7 +1620,7 @@ export default class Scale extends Element { const me = this; const opts = me.options; const tz = opts.ticks && opts.ticks.z || 0; - const gz = opts.grid && opts.grid.z || 0; + const gz = valueOrDefault(opts.grid && opts.grid.z, -1); if (!me._isVisible() || me.draw !== Scale.prototype.draw) { // backward compatibility: draw has been overridden by custom scale diff --git a/test/fixtures/core.scale/border-behind-elements.js b/test/fixtures/core.scale/border-behind-elements.js new file mode 100644 index 00000000000..c5d17182383 --- /dev/null +++ b/test/fixtures/core.scale/border-behind-elements.js @@ -0,0 +1,49 @@ +module.exports = { + config: { + type: 'bubble', + data: { + datasets: [ + { + label: '# of Votes', + data: [{x: 19, y: 3, r: 3}, {x: 2, y: 2, r: 60}], + radius: 100, + backgroundColor: 'pink' + } + ] + }, + options: { + plugins: { + legend: { + display: false + } + }, + scales: { + y: { + ticks: { + display: false + }, + grid: { + borderColor: 'red', + borderWidth: 5 + } + }, + x: { + ticks: { + display: false + }, + grid: { + borderColor: 'red', + borderWidth: 5 + } + } + } + } + }, + + options: { + canvas: { + height: 512, + width: 512 + } + } +}; diff --git a/test/fixtures/core.scale/border-behind-elements.png b/test/fixtures/core.scale/border-behind-elements.png new file mode 100644 index 00000000000..d3f37719d7e Binary files /dev/null and b/test/fixtures/core.scale/border-behind-elements.png differ