Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/8159_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Set the marker snapping threshold for `scatterpolargl` traces to the number of points in the trace [[#8159](https://github.com/plotly/plotly.js/pull/8159)]
3 changes: 3 additions & 0 deletions src/traces/scatterpolargl/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ module.exports = function calc(gd, trace) {
// only compute 'style' options in calc, as position options
// depend on the radial range and must be set in plot
var opts = stash.opts = convert.style(gd, trace);
if(opts.marker) {
opts.marker.snap = len;
}

// For graphs with very large number of points and array marker.size,
// use average marker size instead to speed things up.
Expand Down
20 changes: 20 additions & 0 deletions test/jasmine/tests/scatterpolargl_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,26 @@ describe('Test scatterpolargl interactions:', function() {
});
}

it('@gl should set marker.snap to the number of points', function(done) {
gd = createGraphDiv();

Lib.seedPseudoRandom();
var N = 12000;
var r = [];
var theta = [];
for(var i = 0; i < N; i++) {
r.push(Lib.pseudoRandom());
theta.push(Lib.pseudoRandom() * 360);
}

Plotly.newPlot(gd, [{type: 'scatterpolargl', mode: 'markers', r: r, theta: theta}])
.then(function() {
var scene = gd._fullLayout.polar._subplot._scene;
expect(scene.markerOptions[0].snap).toBe(N);
})
.then(done, done.fail);
});

it('@gl should be able to toggle from svg to gl', function(done) {
gd = createGraphDiv();

Expand Down