Chartjs-Unable to display chartjs chart in Shiny UI

0๐Ÿ‘

โœ…

Ok for reasons unknown to me, i was using the wrong plot commands for output and render. The correct solution is:

testplot <- function(){
  chartjs(mtcars, mpg, qsec, labels = row.names(mtcars)) %>% 
    cjsBar
} 

ui <- fluidPage(
  tags$body(
    chartjsOutput("plot"))


)
server <- function(input, output) {
  output$plot <-renderChartjs({
    testplot()
  })
}
shinyApp(ui = ui, server = server)

Leave a comment