Skip to content

Commit bd3b6d0

Browse files
also resize the canvas when redrawing for #1596
1 parent 09ae06a commit bd3b6d0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/charts/scatter-plot.js

+14
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ export class ScatterPlot extends CoordinateGridMixin {
161161
}
162162
}
163163

164+
_resizeCanvas () {
165+
const width = this.effectiveWidth();
166+
const height = this.effectiveHeight();
167+
168+
var devicePixelRatio = window.devicePixelRatio || 1;
169+
this._canvas
170+
.attr('width', (width) * devicePixelRatio)
171+
.attr('height', (height) * devicePixelRatio)
172+
.style('width', width + 'px')
173+
.style('height', height + 'px');
174+
}
175+
176+
164177
/**
165178
* Set or get whether to use canvas backend for plotting scatterPlot. Note that the
166179
* canvas backend does not currently support
@@ -209,6 +222,7 @@ export class ScatterPlot extends CoordinateGridMixin {
209222
// currently being highlighted and modifies opacity/size of symbols accordingly
210223
// @param {Object} [legendHighlightDatum] - Datum provided to legendHighlight method
211224
_plotOnCanvas (legendHighlightDatum) {
225+
this._resizeCanvas();
212226
const context = this.context();
213227
context.clearRect(0, 0, (context.canvas.width + 2) * 1, (context.canvas.height + 2) * 1);
214228
const data = this.data();

0 commit comments

Comments
 (0)