Skip to content

Commit

Permalink
Merge pull request #3301 from plotly/issue-3258
Browse files Browse the repository at this point in the history
Prevent scatter3d to only display the first point on hover: issue 3258
  • Loading branch information
archmoj committed Dec 7, 2018
2 parents 8ce56d7 + a8b181b commit 3ea5c82
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 11 deletions.
13 changes: 3 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"gl-plot2d": "^1.4.0",
"gl-plot3d": "^1.6.1",
"gl-pointcloud2d": "^1.0.1",
"gl-scatter3d": "^1.1.0",
"gl-scatter3d": "^1.1.2",
"gl-select-box": "^1.0.2",
"gl-spikes2d": "^1.0.1",
"gl-streamtube3d": "^1.1.1",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions test/image/mocks/gl3d_multiple-scatter3d-traces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"data": [
{
"type": "scatter3d",
"mode": "markers",
"marker": {"opacity": 1.0},
"x": [-1, 0, 1],
"y": [0, 0, 0],
"z": [0, 0, 0]
},
{
"type": "scatter3d",
"mode": "markers",
"marker": {"opacity": 1.0},
"x": [-1, 0, 1],
"y": [0, 0, 0],
"z": [10, 10, 10]
},
{
"type": "scatter3d",
"mode": "markers",
"marker": {"opacity": 1.0},
"x": [-1, 0, 1],
"y": [0, 0, 0],
"z": [-10, -10, -10]
}
],
"layout": {
"title": "Hovering over data points of multiple scatter3d traces",
"width": 600,
"height": 400,
"scene": {
"camera": {
"eye": {"x": 1, "y": 1, "z": 1},
"center": {"x": 0, "y": 0, "z": 0},
"up": {"x": 0, "y": 0, "z": 1}
}
}
}
}
30 changes: 30 additions & 0 deletions test/jasmine/tests/gl3d_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Test gl3d plots', function() {
var gd, ptData;

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

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

it('@noCI @gl should display correct hover labels of the second point of the very first scatter3d trace', function(done) {
var _mock = Lib.extendDeep({}, multipleScatter3dMock);

function _hover() {
mouseEvent('mouseover', 300, 200);
return delay(20)();
}

Plotly.plot(gd, _mock)
.then(delay(20))
.then(function() {
gd.on('plotly_hover', function(eventData) {
ptData = eventData.points[0];
});
})
.then(_hover)
.then(delay(20))
.then(function() {
assertHoverLabelContent(
{
nums: ['x: 0', 'y: 0', 'z: 0'].join('\n'),
name: 'trace 0'
}
);
})
.catch(failTest)
.then(done);
});

it('@noCI @gl should display correct hover labels and emit correct event data (scatter3d case)', function(done) {
var _mock = Lib.extendDeep({}, mock2);

Expand Down

0 comments on commit 3ea5c82

Please sign in to comment.