Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e_band and proxy #244

Closed
helgasoft opened this issue Dec 3, 2020 · 2 comments
Closed

e_band and proxy #244

helgasoft opened this issue Dec 3, 2020 · 2 comments

Comments

@helgasoft
Copy link
Contributor

helgasoft commented Dec 3, 2020

Identified 3 problems with e_band and Shiny proxy. They are marked in the code as (1), (2) and (3).
To replicate - uncomment only one at a time and rerun.

runApp( list( 
  ui = fluidPage( 
    actionButton("pxy", "Proxy"),
    echarts4rOutput("plot")
  ),
  server = function(input, output, session){
    df <- data.frame(
      x = 1:10,
      y = runif(10, 5, 10)
    ) %>%
      dplyr::mutate(
        lwr = y - runif(10, 1, 3),
        upr = y + runif(10, 2, 4)
      )
    
    output$plot <- renderEcharts4r({
      df %>%
        e_charts(x) %>%
        e_scatter(y) %>%
        e_band(lwr, upr) %>%
# (1) Error in [[: subscript out of bounds; 
#     e_band cannot take extra parameters like color, name, etc.
#       e_band(lwr, upr, color='cyan') %>%
        e_datazoom()
    })
    
    observeEvent(input$pxy, {
      echarts4rProxy("plot", data=df, x=x) %>% 
# this is ok, but comment out when testing (2) or (3)
        e_line(y) %>% e_execute()
        
# (2) Error in proxy$session$sendCustomMessage: attempt to apply non-function
#        e_band(lwr, upr) %>% e_execute()

# (3) wrong display
#        e_dispatch_action_p("dataZoom", startValue=3, endValue=6)
    })
  })
)
@helgasoft
Copy link
Contributor Author

Maybe not a fix, but a workaround for (3)

output$plot <- renderEcharts4r({
    ...
   e_datazoom() %>%
   e_toolbox(show=FALSE)     # add this line

@helgasoft
Copy link
Contributor Author

Found solutions to problems (1) and (2) as well. Fixes will be coming in a Pull Request, when ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant