Skip to content

Commit 40159f8

Browse files
committed
Fix scatterpolar clustering
1 parent b7016da commit 40159f8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
"glslify": "^6.1.1",
8787
"has-hover": "^1.0.1",
8888
"has-passive-events": "^1.0.0",
89-
"kdgrass": "^1.0.1",
9089
"mapbox-gl": "0.44.1",
9190
"matrix-camera-controller": "^2.1.3",
9291
"mouse-change": "^1.4.0",

src/traces/scatterpolargl/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
'use strict';
1010

11-
var kdtree = require('kdgrass');
11+
var cluster = require('point-cluster');
1212
var isNumeric = require('fast-isnumeric');
1313

1414
var ScatterGl = require('../scattergl');
@@ -101,6 +101,12 @@ function plot(container, subplot, cdata) {
101101

102102
var options = ScatterGl.sceneOptions(container, subplot, trace, positions);
103103

104+
stash.tree = cluster(positions);
105+
106+
if (options.marker) {
107+
options.marker.cluster = stash.tree;
108+
}
109+
104110
// set flags to create scene renderers
105111
if(options.fill && !scene.fill2d) scene.fill2d = true;
106112
if(options.marker && !scene.scatter2d) scene.scatter2d = true;
@@ -133,7 +139,6 @@ function plot(container, subplot, cdata) {
133139
stash.theta = thetaArray;
134140
stash.positions = positions;
135141
stash.count = count;
136-
stash.tree = kdtree(positions, 512);
137142
});
138143

139144
return ScatterGl.plot(container, subplot, cdata);

0 commit comments

Comments
 (0)