Нет возможности использовать клик / кисть в plotlyOutput - PullRequest
0 голосов
/ 26 сентября 2019

Я работаю на flexdashboard.Я использовал приведенный ниже код для одного из графиков.Что ж, когда я пытаюсь использовать щелчок или кисть в plotlyOutput, выдается ошибка, подобная той, которую я использовал во втором примере ниже.Есть ли способ использовать Click под plotlyOutput?Есть ли способ? ......................................

   ---
    title: "Untitled"
    output: 
    flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
runtime: shiny
source_code: embed
theme: cosmo
 ---

```{r setup, include=FALSE}
library(flexdashboard)
library(readxl)
library(tidyverse)
library(lubridate)
library(ggplot2)
library(reshape)
library(shiny)
library(plotly)
```

```{r}
df <- read_excel("E:/Analytics/Freelancing projects/New 
folder/df.xlsx")

 ```

 Summary
 =================

 Inputs {.sidebar}
 -----------------------------------------------------------------------

 ```{r}
 selectInput("p1",h5("Select"),choices = c("","Plot"))
 selectInput("f1",h5("Components"),choices = 
 c("ALL",levels(factor(Copy_of_mill_para1$variable))),selected = "ALL")
 ```


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

  ### Chart A

  ```{r}
  plotlyOutput("g1")
  output$g1 <- renderPlotly({
  if (input$p1 == "Plot") {
  s_data <- df
  }
  if (input$p1 == "Plot" && input$f1 != "ALL") {
  s_data <- s_data %>% filter(variable %in% input$f1)
  }
   p1 <- ggplot(s_data,aes(x=Date,y=value,color=variable))+geom_line(size =  
   .2)+theme(axis.text.y=element_text(angle=0,hjust=1,size=0.1))+theme(axis.title.y=element_blank(),axis.title.x=element_blank())+theme(ax 
   is.text.x=element_blank())+theme(legend.title = element_blank())+ 
   theme(legend.text=element_text(size=7.5))+theme(legend.position = "none")
   print(ggplotly(p1))
   })
   ```

  ### Table

  ```{r}
  verbatimTextOutput("click")
  output$click <- renderPrint({
  d <- event_data("plotly_click")
  if (is.null(d)) "Click events appear here (double-click to clear)"
  })
  ```

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...