R FlexDashboard ggiraph chart not showing on secon

2019-09-13 22:43发布

问题:

I have a multi-page R FlexdashBoard and I am trying to use ggiraph to create some interactive charts. They show up fine on the first page of the dashboard, however on the second page the SVG graphics do not show up until I hit refresh then the charts on the first page disappear. Also the text in the SVG graphics seems to only display intermittently. I only have this error in Internet Explorer - everything works fine in Chrome. The following code should recreate this error.

Any help would be greatly appreciated event a hint on which package or piece of java script to look at.

---
title: "Please Help Me!"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(ggiraph)
```

Works {data-orientation=rows}
=====================================  

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)

```

Column {data-width=350}
-----------------------------------------------------------------------

### Chart B

```{r}

myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)
```

### Chart C

```{r}
myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)

```

Does Not Work {data-orientation=rows}
=====================================  

### Chart C

```{r}
myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)

```

### Chart D

```{r}
myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)

```
### Chart E

```{r}
myIris <- iris
myIris$DataId<- row.names(iris)
g2 <- ggplot(data=myIris, aes(x=Sepal.Length, y=Sepal.Width, data_id=DataId)) + geom_point_interactive(fill = "green", alpha=.5)
ggiraph(code = print(g2), width_svg = 8, height_svg=4,
        hover_css="fill-opacity:1",flexdashboard =TRUE)

```