Skip to content

Commit b4b60e4

Browse files
committed
Fix splom grid scaling
1 parent c755979 commit b4b60e4

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/traces/splom/base_plot.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ function updateGrid(gd) {
8686
}
8787

8888
function makeGridData(gd) {
89+
var plotGlPixelRatio = gd._context.plotGlPixelRatio;
8990
var fullLayout = gd._fullLayout;
9091
var gs = fullLayout._size;
91-
var fullView = [0, 0, fullLayout.width, fullLayout.height];
92+
var fullView = [
93+
0, 0,
94+
fullLayout.width * plotGlPixelRatio,
95+
fullLayout.height * plotGlPixelRatio
96+
];
9297
var lookup = {};
9398
var k;
9499

@@ -103,7 +108,7 @@ function makeGridData(gd) {
103108
lookup[key] = {
104109
data: [x0, x1, y0, y1],
105110
join: 'rect',
106-
thickness: lwidth,
111+
thickness: lwidth * plotGlPixelRatio,
107112
color: lcolor,
108113
viewport: fullView,
109114
range: fullView,
@@ -118,32 +123,38 @@ function makeGridData(gd) {
118123
var ya = sp.yaxis;
119124
var xVals = xa._gridVals;
120125
var yVals = ya._gridVals;
126+
var b = gs.b * plotGlPixelRatio;
127+
var h = gs.h * plotGlPixelRatio;
128+
var xoffset = xa._offset * plotGlPixelRatio;
129+
var xlength = xa._length * plotGlPixelRatio;
130+
var ylength = ya._length * plotGlPixelRatio;
131+
121132
// ya.l2p assumes top-to-bottom coordinate system (a la SVG),
122133
// we need to compute bottom-to-top offsets and slopes:
123-
var yOffset = gs.b + ya.domain[0] * gs.h;
134+
var yOffset = b + ya.domain[0] * h;
124135
var ym = -ya._m;
125136
var yb = -ym * ya.r2l(ya.range[0], ya.calendar);
126137
var x, y;
127138

128139
if(xa.showgrid) {
129140
for(k = 0; k < xVals.length; k++) {
130-
x = xa._offset + xa.l2p(xVals[k].x);
131-
push('grid', xa, x, yOffset, x, yOffset + ya._length);
141+
x = xoffset + xa.l2p(xVals[k].x);
142+
push('grid', xa, x, yOffset, x, yOffset + ylength);
132143
}
133144
}
134145
if(ya.showgrid) {
135146
for(k = 0; k < yVals.length; k++) {
136147
y = yOffset + yb + ym * yVals[k].x;
137-
push('grid', ya, xa._offset, y, xa._offset + xa._length, y);
148+
push('grid', ya, xoffset, y, xoffset + xlength, y);
138149
}
139150
}
140151
if(shouldShowZeroLine(gd, xa, ya)) {
141-
x = xa._offset + xa.l2p(0);
142-
push('zeroline', xa, x, yOffset, x, yOffset + ya._length);
152+
x = xoffset + xa.l2p(0);
153+
push('zeroline', xa, x, yOffset, x, yOffset + ylength);
143154
}
144155
if(shouldShowZeroLine(gd, ya, xa)) {
145156
y = yOffset + yb + 0;
146-
push('zeroline', ya, xa._offset, y, xa._offset + xa._length, y);
157+
push('zeroline', ya, xoffset, y, xoffset + xlength, y);
147158
}
148159
}
149160

0 commit comments

Comments
 (0)