2

I’m having a very specific problem with a plotly heatmap object inserted in a two tabbed flexdashboard rmarkdown. The MRE below, when rendered, displays an uncaught axis resizing javascript error. The error causes the datatable and heatmap to not render. However, if the heatmap is moved to the same tab both will render without a problem. The craziest part is that a hard refresh of the html document (ctrl+f5 in browser) with the second tab open causes the javascript error to disappear and everything renders just fine. I am having a very difficult time isolating this issue to the plotly R API, or the R package htmlwidgets. Any ideas?

---
title: "`r paste0('Test')`"
date: "`r Sys.Date()`"
output: 
  flexdashboard::flex_dashboard:
    vertical_layout: scroll
    orientation: rows
    self_contained: false
---

```{r setup, include=FALSE}
library(flexdashboard)
library(reshape2)
library(dplyr)
library(ggplot2)
library(plotly)
```



Tab1
===================================================

Row
-----------------------------------------------------------------------

### A scatter

```{r fig1}
df = data.frame(x = 1:5, y = 1:5, z = 1:5)
plot_ly(df, x = ~x, y = ~y, type = "scatter")
```

Row
-----------------------------------------------------------------------

### A table

```{r table1}
DT::datatable(df,
                filter="top",extensions = 'Buttons',
  options = list(
      dom = 'Bfrtip',
      buttons = c('copy', 'csv', 'excel'),
      pagelength=50,
      autoWidth=T,
      deferRender = T
  )
)
```

Tab2 
===================================================

Row
-----------------------------------------------------------------------

### A heatmap

```{r fig2}
plot_ly(df, x = ~x, y = ~y, z = ~z, type = "heatmap")
```
Ryan Haunfelder
  • 766
  • 3
  • 11
  • Hi. This renders for me with no issues on R version 3.5.1. I can't see the javascript error that you mention at all. Flexdashboard v0.5.1.1; tidyverse v.1.2.1; plotly v4.8.0 – olorcain May 07 '19 at 15:19
  • Hey @olorcain, I should have mentioned that this is using R version 3.6.0, plotly 4.9.0, flexdashboard 0.5.1.1, DT 0.5, and tidyverse 1.2.1, and htmlwidgets 1.3 so the most recent CRAN releases for everything as of today. This should be reproducible in all browsers including the RStudio built-in browser. I believe a recent release caused the issue as it was not present before updating R and packages. – Ryan Haunfelder May 07 '19 at 16:50
  • @olorcain I checked with an environment more similar to your's (3.5.2/ plotly 4.8.0.9000, flexdashboard 0.5.1.1) and confirmed that an update is a cause of this issue, as this environment does not reproduce the same error that the up-to-date environment does. I will post on the plotly github issue board to see if anyone has any ideas. – Ryan Haunfelder May 07 '19 at 16:55
  • 1
    [Github issue](https://github.com/ropensci/plotly/issues/1524) – Ryan Haunfelder May 07 '19 at 17:18
  • Hi Ryan. That's interesting. I hope the plotly guys can resolve this for you. – olorcain May 08 '19 at 08:41

0 Answers0