Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent scatter3d to only display the first point on hover: issue 3258 #3301

Merged
merged 11 commits into from
Dec 7, 2018
Merged
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
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.0",
"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