Skip to content

Commit 546b97c

Browse files
committed
Fix scatterpolargl point snapping
1 parent 0316e60 commit 546b97c

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎src/traces/scatterpolargl/calc.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ module.exports = function calc(gd, trace) {
2727
// only compute 'style' options in calc, as position options
2828
// depend on the radial range and must be set in plot
2929
var opts = stash.opts = convert.style(gd, trace);
30+
if(opts.marker) {
31+
opts.marker.snap = len;
32+
}
3033

3134
// For graphs with very large number of points and array marker.size,
3235
// use average marker size instead to speed things up.

‎test/jasmine/tests/scatterpolargl_test.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,26 @@ describe('Test scatterpolargl interactions:', function() {
171171
});
172172
}
173173

174+
it('@gl should set marker.snap to the number of points', function(done) {
175+
gd = createGraphDiv();
176+
177+
Lib.seedPseudoRandom();
178+
var N = 12000;
179+
var r = [];
180+
var theta = [];
181+
for(var i = 0; i < N; i++) {
182+
r.push(Lib.pseudoRandom());
183+
theta.push(Lib.pseudoRandom() * 360);
184+
}
185+
186+
Plotly.newPlot(gd, [{type: 'scatterpolargl', mode: 'markers', r: r, theta: theta}])
187+
.then(function() {
188+
var scene = gd._fullLayout.polar._subplot._scene;
189+
expect(scene.markerOptions[0].snap).toBe(N);
190+
})
191+
.then(done, done.fail);
192+
});
193+
174194
it('@gl should be able to toggle from svg to gl', function(done) {
175195
gd = createGraphDiv();
176196

0 commit comments

Comments
 (0)