Skip to content

Commit a54e70d

Browse files
committed
Fix log errors
1 parent 889237f commit a54e70d

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

src/traces/scattergl/index.js

+30-12
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
233233
var count = positions.length / 2;
234234
var markerOpts = trace.marker;
235235
var i, ptrX = 0, ptrY = 0;
236+
var xaxis = Axes.getFromId(container, trace.xaxis);
237+
var yaxis = Axes.getFromId(container, trace.yaxis);
236238

237239
var hasLines, hasErrorX, hasErrorY, hasError, hasMarkers, hasFill;
238240

@@ -263,18 +265,26 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
263265
errorXOptions.positions = positions;
264266
var errorsX = new Float64Array(4 * count);
265267

266-
for(i = 0; i < count; ++i) {
267-
errorsX[ptrX++] = positions[i * 2] - errorVals[i].xs || 0;
268-
errorsX[ptrX++] = errorVals[i].xh - positions[i * 2] || 0;
269-
errorsX[ptrX++] = 0;
270-
errorsX[ptrX++] = 0;
268+
if(xaxis.type === 'log') {
269+
for(i = 0; i < count; ++i) {
270+
errorsX[ptrX++] = positions[i * 2] - xaxis.d2l(errorVals[i].xs) || 0;
271+
errorsX[ptrX++] = xaxis.d2l(errorVals[i].xh) - positions[i * 2] || 0;
272+
errorsX[ptrX++] = 0;
273+
errorsX[ptrX++] = 0;
274+
}
275+
} else {
276+
for(i = 0; i < count; ++i) {
277+
errorsX[ptrX++] = positions[i * 2] - errorVals[i].xs || 0;
278+
errorsX[ptrX++] = errorVals[i].xh - positions[i * 2] || 0;
279+
errorsX[ptrX++] = 0;
280+
errorsX[ptrX++] = 0;
281+
}
271282
}
272283

273284
if(trace.error_x.copy_ystyle) {
274285
trace.error_x = trace.error_y;
275286
}
276287

277-
errorXOptions.positions = positions;
278288
errorXOptions.errors = errorsX;
279289
errorXOptions.capSize = trace.error_x.width * 2;
280290
errorXOptions.lineWidth = trace.error_x.thickness;
@@ -286,14 +296,22 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
286296
errorYOptions.positions = positions;
287297
var errorsY = new Float64Array(4 * count);
288298

289-
for(i = 0; i < count; ++i) {
290-
errorsY[ptrY++] = 0;
291-
errorsY[ptrY++] = 0;
292-
errorsY[ptrY++] = positions[i * 2 + 1] - errorVals[i].ys || 0;
293-
errorsY[ptrY++] = errorVals[i].yh - positions[i * 2 + 1] || 0;
299+
if(yaxis.type === 'log') {
300+
for(i = 0; i < count; ++i) {
301+
errorsY[ptrY++] = 0;
302+
errorsY[ptrY++] = 0;
303+
errorsY[ptrY++] = positions[i * 2 + 1] - yaxis.d2l(errorVals[i].ys) || 0;
304+
errorsY[ptrY++] = yaxis.d2l(errorVals[i].yh) - positions[i * 2 + 1] || 0;
305+
}
306+
} else {
307+
for(i = 0; i < count; ++i) {
308+
errorsY[ptrY++] = 0;
309+
errorsY[ptrY++] = 0;
310+
errorsY[ptrY++] = positions[i * 2 + 1] - errorVals[i].ys || 0;
311+
errorsY[ptrY++] = errorVals[i].yh - positions[i * 2 + 1] || 0;
312+
}
294313
}
295314

296-
errorYOptions.positions = positions;
297315
errorYOptions.errors = errorsY;
298316
errorYOptions.capSize = trace.error_y.width * 2;
299317
errorYOptions.lineWidth = trace.error_y.thickness;

0 commit comments

Comments
 (0)