微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 echarts4r 中使用 `e_dispatch_action_p` 的 `brush` 动作不起作用

如何解决在 echarts4r 中使用 `e_dispatch_action_p` 的 `brush` 动作不起作用

我想在一个echart中显示几个拉丝区域。在 the example in the documentation 中,dataZoom 按预期工作,brush 没有:

library(shiny)
library(echarts4r)

ui <- fluidPage(
  fluidRow(
    column(8,echarts4rOutput("chart")),column(4,actionButton("zoom","Zoom"))
  )
)

server <- function(input,output,session) {
  output$chart <- renderEcharts4r({
    cars %>%
      e_charts(speed) %>%
      e_scatter(dist) %>%
      e_brush()
  })
  
  # this works
  observeEvent(input$zoom,{
    echarts4rProxy("chart") %>%
      e_dispatch_action_p("dataZoom",startValue = 1,endValue = 10)
  })
  
  # this does not work
  observeEvent(input$zoom,{
    echarts4rProxy("chart") %>%
      e_dispatch_action_p(
        "brush",areas = list(
          brushType = 'lineX',range = list(1,10)
        )
      )
  })
}

shinyApp(ui,server) 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。