Skip to content

Commit 3ea5c82

Browse files
authored
Merge pull request #3301 from plotly/issue-3258
Prevent scatter3d to only display the first point on hover: issue 3258
2 parents 8ce56d7 + a8b181b commit 3ea5c82

File tree

5 files changed

+74
-11
lines changed

5 files changed

+74
-11
lines changed

package-lock.json

+3-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"gl-plot2d": "^1.4.0",
8181
"gl-plot3d": "^1.6.1",
8282
"gl-pointcloud2d": "^1.0.1",
83-
"gl-scatter3d": "^1.1.0",
83+
"gl-scatter3d": "^1.1.2",
8484
"gl-select-box": "^1.0.2",
8585
"gl-spikes2d": "^1.0.1",
8686
"gl-streamtube3d": "^1.1.1",
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"data": [
3+
{
4+
"type": "scatter3d",
5+
"mode": "markers",
6+
"marker": {"opacity": 1.0},
7+
"x": [-1, 0, 1],
8+
"y": [0, 0, 0],
9+
"z": [0, 0, 0]
10+
},
11+
{
12+
"type": "scatter3d",
13+
"mode": "markers",
14+
"marker": {"opacity": 1.0},
15+
"x": [-1, 0, 1],
16+
"y": [0, 0, 0],
17+
"z": [10, 10, 10]
18+
},
19+
{
20+
"type": "scatter3d",
21+
"mode": "markers",
22+
"marker": {"opacity": 1.0},
23+
"x": [-1, 0, 1],
24+
"y": [0, 0, 0],
25+
"z": [-10, -10, -10]
26+
}
27+
],
28+
"layout": {
29+
"title": "Hovering over data points of multiple scatter3d traces",
30+
"width": 600,
31+
"height": 400,
32+
"scene": {
33+
"camera": {
34+
"eye": {"x": 1, "y": 1, "z": 1},
35+
"center": {"x": 0, "y": 0, "z": 0},
36+
"up": {"x": 0, "y": 0, "z": 1}
37+
}
38+
}
39+
}
40+
}

test/jasmine/tests/gl3d_plot_interact_test.js

+30
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('Test gl3d plots', function() {
2525
var gd, ptData;
2626

2727
var mock = require('@mocks/gl3d_marker-arrays.json');
28+
var multipleScatter3dMock = require('@mocks/gl3d_multiple-scatter3d-traces.json');
2829

2930
// lines, markers, text, error bars and surfaces each
3031
// correspond to one glplot object
@@ -74,6 +75,35 @@ describe('Test gl3d plots', function() {
7475
destroyGraphDiv();
7576
});
7677

78+
it('@noCI @gl should display correct hover labels of the second point of the very first scatter3d trace', function(done) {
79+
var _mock = Lib.extendDeep({}, multipleScatter3dMock);
80+
81+
function _hover() {
82+
mouseEvent('mouseover', 300, 200);
83+
return delay(20)();
84+
}
85+
86+
Plotly.plot(gd, _mock)
87+
.then(delay(20))
88+
.then(function() {
89+
gd.on('plotly_hover', function(eventData) {
90+
ptData = eventData.points[0];
91+
});
92+
})
93+
.then(_hover)
94+
.then(delay(20))
95+
.then(function() {
96+
assertHoverLabelContent(
97+
{
98+
nums: ['x: 0', 'y: 0', 'z: 0'].join('\n'),
99+
name: 'trace 0'
100+
}
101+
);
102+
})
103+
.catch(failTest)
104+
.then(done);
105+
});
106+
77107
it('@noCI @gl should display correct hover labels and emit correct event data (scatter3d case)', function(done) {
78108
var _mock = Lib.extendDeep({}, mock2);
79109

0 commit comments

Comments
 (0)