Skip to content

Commit 5b83c64

Browse files
authored
Use Plotly.react() to redraw in Shiny if layout.transition is populated (#2001)
* Use Plotly.react() to redraw in Shiny if layout.transition is populated * update news
1 parent a938bf5 commit 5b83c64

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

NEWS.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# 4.9.4.9000
22

3-
## Changes to plotly.js
3+
## Breaking changes in JavaScript API
44

55
* This version of the R package upgrades the version of the underlying plotly.js library from v1.57.1 to v2.2.1. This includes many breaking changes, bug fixes, and improvements to the underlying JavaScript library. The [plotly.js release page](https://github.com/plotly/plotly.js/releases) has the full list of changes.
66

7-
## Breaking changes
7+
## Breaking changes in R API
88

99
* `ggplotly()` now uses the `layout.legend.title` (instead of `layout.annotations`) plotly.js API to convert guides for discrete scales. (#1961)
10+
* `renderPlotly()` now uses `Plotly.react()` (instead of `Plotly.newPlot()`) to redraw when `layout(transition = )` is specified. This makes it possible/easier to implement a smooth transitions when `renderPlotly()` gets re-executed. (#2001)
1011

1112
## New Features
1213

inst/htmlwidgets/plotly.js

+4
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ HTMLWidgets.widget({
162162
var plot = Plotly.newPlot(graphDiv, x);
163163
instance.plotly = true;
164164

165+
} else if (x.layout.transition) {
166+
167+
var plot = Plotly.react(graphDiv, x);
168+
165169
} else {
166170

167171
// this is essentially equivalent to Plotly.newPlot(), but avoids creating

0 commit comments

Comments
 (0)