我有一个非常具体的问题,将可绘制的热图对象插入到两个选项卡式flexdashboard rmarkdown中。下方的MRE呈现后,会显示未捕获的轴,调整了javascript错误的大小。该错误导致数据表和热图无法渲染。但是,如果将热图移到相同的选项卡,则两者都将呈现而不会出现问题。最疯狂的部分是,在第二个标签页打开的情况下,硬刷新html文档(浏览器中为ctrl + f5)会导致javascript错误消失,并且一切正常。我很难将这个问题隔离到可疑的R API或R包htmlwidgets中。有什么想法吗?
---
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")
```