Skip to content

Selection on choropleth to work even if an invisible trace is present #2099

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

Merged
merged 5 commits into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions src/traces/choropleth/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ module.exports = function selectPoints(searchInfo, polygon) {
}
}

node3.selectAll('path').style('opacity', function(d) {
return d.dim ? DESELECTDIM : 1;
});
if(node3) {
node3.selectAll('path').style('opacity', function(d) {
return d.dim ? DESELECTDIM : 1;
});
}

return selection;
};
6 changes: 6 additions & 0 deletions test/jasmine/tests/select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,12 @@ describe('Test select box and lasso per trace:', function() {
fig.layout.dragmode = 'select';
fig.layout.geo.scope = 'europe';

// add a trace with no locations which will then make trace invisible, lacking DOM elements
fig.data.push(Lib.extendDeep({}, fig.data[0]));
fig.data[1].text = [];
fig.data[1].locations = [];
fig.data[1].z = [];

Plotly.plot(gd, fig)
.then(function() {
return _run(
Expand Down