proxies: echarts Shiny proxies

Description Usage Arguments Examples

Description

Shiny proxies for echarts.

Usage

1
2
3
4
5
6
7
8
9
eget_options_p(proxy)

edata_p(proxy, index, data, head = FALSE, grow = FALSE)

etheme_p(proxy, theme)

emark_point_p(proxy, index, data = list(), clickable = TRUE,
  symbol = "pin", symbol.size = 10, symbol.rotate = NULL, large = FALSE,
  effect = NULL)

Arguments

proxy

as returned by echartsProxy

theme

as passed in etheme.

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
## Not run: 
library(shiny)

ui <- fluidPage(
  titlePanel("echarts Proxies"),
  fluidRow(
    column(
      3,
      actionButton("getOptions", "get options")
    ),
    column(
      3,
      selectInput(
        "theme",
        "change theme",
        choices =
          c(
            "default",
            "red",
            "mint",
            "macarons",
            "macarons2",
            "green",
            "blue",
            "dark",
            "gray",
            "helianthus",
            "wef",
            "roma",
            "sakura",
            "shine",
            "infographic",
            "solarlight"
         )
      )
    ),
    column(
      3,
      actionButton("addData", "add data")
    ),
    column(
      3,
      numericInput(
        "markPoint",
        "Mark point",
        10
      )
    )
  ),
  fluidRow(
    echartsOutput("chart")
  )
)

server <- function(input, output){
  df <- data.frame(x = 1:50, y = runif(50, 5, 10), z = runif(50, 7, 12), w = runif(50, 10, 13))

  output$chart <- renderEcharts(
    df %>%
      echart(x) %>%
      earea(y, name = "Metric", stack = "grp1") %>%
      eline(w, name = "Variable", stack = "grp2") %>%
      eline(z, name = "Var", stack = "grp3") %>%
      etitle("echarts", "and its Shiny proxies")
  )

  reactive_1 <- eventReactive(input$addData, {
    runif(1, 5, 13)
  })

  reactive_2 <- eventReactive(input$addData, {
    runif(1, 5, 13)
  })

  reactive_3 <- eventReactive(input$addData, {
    runif(1, 5, 13)
  })

  observeEvent(input$getOptions, {
    echartsProxy("chart") %>%
      egetoptions_p()
  })

  observeEvent(input$theme, {
    echartsProxy("chart") %>%
      etheme_p(input$theme)
  })

  observeEvent(input$addData, {
    echartsProxy("chart") %>%
      edata_p(index = 0, reactive_1()) %>%
      edata_p(index = 1, reactive_2()) %>%
      edata_p(index = 2, reactive_3())
  })

  observeEvent(input$markPoint, {
    data = list(
      name = "point",
      value = input$markPoint,
      x = 20,
      y = 10
    )
  })
}

shinyApp(ui, server)

## End(Not run)

JohnCoene/echarts documentation built on May 7, 2019, 11:58 a.m.