Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix error on clearing crosstalk selection #2098

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from
Open
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
fix error on clearing crosstalk selection
  • Loading branch information
casperhart committed Apr 24, 2022
commit cd634244a13a75b576d808192b97cbb4c56c8b9c
2 changes: 2 additions & 0 deletions 2 NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* `ggplotly()` now respects `guide(aes = "none")` (e.g., `guide(fill = "none")`) when constructing legend entries. (#2067)
* Fixed an issue with translating `GGally::ggcorr()` via `ggplotly()`. (#2012)
* Fixed an issue where clearing a crosstalk filter would raise an error in the JS console (#2087)
* Fixed an issue with `{crosstalk}` where running `selectionHandle.clear()` from another visual causes plotly to throw an error. (#2098)


## Improvements

Expand Down
8 changes: 4 additions & 4 deletions 8 inst/htmlwidgets/plotly.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,15 @@ TraceManager.prototype.updateFilter = function(group, keys) {
};

TraceManager.prototype.updateSelection = function(group, keys) {
if (keys !== null && !Array.isArray(keys)) {

if (keys !== null && keys !== undefined && !Array.isArray(keys)) {
throw new Error("Invalid keys argument; null or array expected");
}

// if selection has been cleared, or if this is transient
// selection, delete the "selection traces"
var nNewTraces = this.gd.data.length - this.origData.length;
if (keys === null || !this.highlight.persistent && nNewTraces > 0) {
if (keys === null || keys === undefined || !this.highlight.persistent && nNewTraces > 0) {
var tracesToRemove = [];
for (var i = 0; i < this.gd.data.length; i++) {
if (this.gd.data[i]._isCrosstalkTrace) tracesToRemove.push(i);
Expand All @@ -655,7 +655,7 @@ TraceManager.prototype.updateSelection = function(group, keys) {
}
}

if (keys === null) {
if (keys === null || keys === undefined) {

Plotly.restyle(this.gd, {"opacity": this.origOpacity});

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.