Skip to content

Commit d6823a5

Browse files
authored
Merge pull request #1223 from ropensci/scattergl
turn off the selected/unselected API
2 parents 38f447f + ed7d6fd commit d6823a5

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

NEWS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## NEW FEATURES & IMPROVEMENTS
44

5-
* Upgraded to plotly.js v1.35.2. A _huge_ amount of features and improvements have been made since v1.29.2 (i.e., the version included in the last CRAN release of the R package - v4.7.1). Highlights include a complete re-write of `scattergl` to make it nearly feature complete with `scatter`, localization of text rendering (i.e., international translations), and two new trace types (`violin` & `table`). Read more about the v1.32.0 release [here](https://codeburst.io/notes-from-the-latest-plotly-js-release-b035a5b43e21) and the complete list of changes [here](https://github.com/plotly/plotly.js/releases).
5+
* Upgraded to plotly.js v1.37.0. A _huge_ amount of features and improvements have been made since v1.29.2 (i.e., the version included in the last CRAN release of the R package - v4.7.1). Highlights include a complete re-write of `scattergl` to make it nearly feature complete with `scatter`, localization of text rendering (i.e., international translations), and two new trace types (`violin` & `table`). Read more about the v1.32.0 release [here](https://codeburst.io/notes-from-the-latest-plotly-js-release-b035a5b43e21) and the complete list of changes [here](https://github.com/plotly/plotly.js/releases).
66
* Support for **sf** (simple feature) data structures was added to `plot_ly()`, `plot_mapbox()`, and `plot_geo()` (via the new `add_sf()` function). See [this blog post](https://blog.cpsievert.me/2018/03/30/visualizing-geo-spatial-data-with-sf-and-plotly) for an overview.
77
* New "special arguments" `stroke`, `strokes`, `alpha_stroke`, `span`, and `spans` were added for easier control over the stroke (i.e., outline) appearance of various (filled) graphical marks. For an overview, see the **sf** blog post linked to in the bullet point above and the new package demos (list all demos with `demo(package = "plotly")`).
88
* The selection (i.e., linked-brushing) mode can now switch from 'transient' to 'persistent' by holding the 'shift' key. It's still possible to _force_ persistent selection by setting `persistent = TRUE` in `highlight()`, but `persistent = FALSE` (the default) is now recommended since it allows one to switch between [persistent/transient selection](https://plotly-book.cpsievert.me/linking-views-without-shiny.html#transient-versus-persistent-selection) in the browser, rather than at the command line.

R/plotly.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ typedArrayPolyfill <- function() {
422422
# and bundle size at print time.
423423
plotlyMainBundle <- function() {
424424
htmltools::htmlDependency(
425-
"plotlyjs", "1.35.2",
425+
"plotlyjs", "1.37.0",
426426
src = depPath("plotlyjs"),
427427
script = "plotly-latest.min.js",
428428
stylesheet = "plotly-htmlwidgets.css"

R/sysdata.rda

4.76 KB
Binary file not shown.

inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js

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

inst/htmlwidgets/plotly.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ HTMLWidgets.widget({
3333

3434
// Enable persistent selection when shift key is down
3535
// https://stackoverflow.com/questions/1828613/check-if-a-key-is-down
36-
var persistOnShift = function(e) {
36+
var persistOnShift = function(e) {
3737
if (!e) window.event;
3838
if (e.shiftKey) {
3939
x.highlight.persistent = true;
@@ -626,7 +626,7 @@ TraceManager.prototype.updateSelection = function(group, keys) {
626626
/ (2) highlight(selected = attrs_selected(...))
627627
*/
628628
// TODO: it would be neat to have a dropdown to dynamically specify these!
629-
$.extend(true, trace, this.highlight.selected, d.selected);
629+
$.extend(true, trace, this.highlight.selected);
630630

631631
// if it is defined, override color with the "dynamic brush color""
632632
if (d.marker) {
@@ -742,9 +742,8 @@ TraceManager.prototype.updateSelection = function(group, keys) {
742742

743743
if (tracesToDim.length > 0) {
744744
Plotly.restyle(this.gd, {"opacity": opacities}, tracesToDim);
745-
// this is an unfortunate consequence of the selected/unselected API
746-
// https://codepen.io/cpsievert/pen/opOawp
747-
Plotly.restyle(this.gd, {"unselected": {"marker": {"opacity": 1}}});
745+
// turn off the selected/unselected API
746+
Plotly.restyle(this.gd, {"selectedpoints": null});
748747
}
749748

750749
}

0 commit comments

Comments
 (0)