Coder Social home page Coder Social logo

Javascript error about ggiraph HOT 5 CLOSED

davidgohel avatar davidgohel commented on August 23, 2024
Javascript error

from ggiraph.

Comments (5)

davidgohel avatar davidgohel commented on August 23, 2024

Hello,

for now, I have no idea what is going on.

Can you provide a reproducible example (a code I could ship in a simple shiny app)?

Thanks
David

from ggiraph.

davidgohel avatar davidgohel commented on August 23, 2024

Here is what I tried (but it works):

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)
library(ggiraphExtra)
library(ggiraph)
xx <- ggPoints(aes(x=wt,y=mpg,color=am),data=mtcars,method="lm",interactive=TRUE)

ui <- fluidPage(

   # Sidebar with a slider input for number of bins
   sidebarLayout(
      sidebarPanel(),

      # Show a plot of the generated distribution
      mainPanel(
         ggiraphOutput("distPlot")
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

   output$distPlot <- renderggiraph({
     print(xx)
   })
}

# Run the application
shinyApp(ui = ui, server = server)

from ggiraph.

cardiomoon avatar cardiomoon commented on August 23, 2024

It is related to renderUI.
Followings are reproducible example.
I made a single file shiny app.

library(shiny)
library(ggiraph)

ui <- fluidPage(

uiOutput("test")

)

server <- function(input, output) {

output$test=renderUI({
tagList(
ggiraphOutput("Plot"),
plotOutput("Plot1")
)
})

output$Plot <- renderggiraph({
g <- ggplot(mpg, aes( x = displ, y = cty, color = hwy) ) + theme_minimal()
my_gg <- g + geom_point_interactive(aes(tooltip = model), size = 2)
ggiraph(code = print(my_gg), width = .7)
})

output$Plot1 <- renderPlot({
g <- ggplot(mpg, aes( x = displ, y = cty, color = hwy) ) + theme_minimal()
g+geom_point()
})
}

shinyApp(ui = ui, server = server)

from ggiraph.

davidgohel avatar davidgohel commented on August 23, 2024

Sorry, I can't reproduce, everything is ok on my local installation.

Do you have other informations that could help? Also in the link you sent (http://r-ggplot2.com:3838/explore), there is no error.

from ggiraph.

cardiomoon avatar cardiomoon commented on August 23, 2024

In large shiny app, you have to put one or more ggiraphoutput in ui.R. If you put all ggiraphoutput in server.ui(only uiOutput in ui.R), the ggiraphoutput is not able to be seen in certain circumstances.
I am not sure the reason.

from ggiraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.