Skip to content

Commit 82c3d78

Browse files
committed
fix scatterpolar line axis expansion for >1e5 pts
1 parent 0308e51 commit 82c3d78

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

src/traces/scattergl/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ function calc(gd, trace) {
9292
// For graphs with very large number of points and array marker.size,
9393
// use average marker size instead to speed things up.
9494
setFirstScatter(fullLayout, trace);
95-
var ppad = len < TOO_MANY_POINTS ?
96-
calcMarkerSize(trace, len) :
97-
2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3));
95+
var ppad;
96+
if(len < TOO_MANY_POINTS) {
97+
ppad = calcMarkerSize(trace, len);
98+
} else if(opts.marker) {
99+
ppad = 2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3));
100+
}
98101
calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);
99102
if(opts.errorX) expandForErrorBars(trace, xa, opts.errorX);
100103
if(opts.errorY) expandForErrorBars(trace, ya, opts.errorY);

test/jasmine/tests/gl2d_plot_interact_test.js

+18-4
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,14 @@ describe('Test scattergl autorange:', function() {
13051305
});
13061306

13071307
describe('should return the approximative values for ~big~ data', function() {
1308+
var gd;
1309+
13081310
beforeEach(function() {
1311+
gd = createGraphDiv();
13091312
// to avoid expansive draw calls (which could be problematic on CI)
13101313
spyOn(ScatterGl, 'plot').and.callFake(function(gd) {
13111314
gd._fullLayout._plots.xy._scene.scatter2d = {draw: function() {}};
1315+
gd._fullLayout._plots.xy._scene.line2d = {draw: function() {}};
13121316
});
13131317
});
13141318

@@ -1327,8 +1331,6 @@ describe('Test scattergl autorange:', function() {
13271331
}
13281332

13291333
it('@gl - case scalar marker.size', function(done) {
1330-
var gd = createGraphDiv();
1331-
13321334
Plotly.newPlot(gd, [{
13331335
type: 'scattergl',
13341336
mode: 'markers',
@@ -1345,8 +1347,6 @@ describe('Test scattergl autorange:', function() {
13451347
});
13461348

13471349
it('@gl - case array marker.size', function(done) {
1348-
var gd = createGraphDiv();
1349-
13501350
Plotly.newPlot(gd, [{
13511351
type: 'scattergl',
13521352
mode: 'markers',
@@ -1361,5 +1361,19 @@ describe('Test scattergl autorange:', function() {
13611361
.catch(failTest)
13621362
.then(done);
13631363
});
1364+
1365+
it('@gl - case mode:lines', function(done) {
1366+
Plotly.newPlot(gd, [{
1367+
type: 'scattergl',
1368+
mode: 'lines',
1369+
y: y,
1370+
}])
1371+
.then(function() {
1372+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0, N - 1], 2, 'x range');
1373+
expect(gd._fullLayout.yaxis.range).toBeCloseToArray([-0.0555, 1.0555], 2, 'y range');
1374+
})
1375+
.catch(failTest)
1376+
.then(done);
1377+
});
13641378
});
13651379
});

0 commit comments

Comments
 (0)