I have been trying to render a chart using r2d3 package and RShiny. The code runs without an error but the chart doesn't get displayed. The D3 visualization works when implemented outside R. Can someone help me get this particular chart to work?
My app.R code is as below
library(shiny)
library(r2d3)
ui <- fluidPage(
d3Output("d3")
)
server <- function(input, output) {
output$d3 <- renderD3({
r2d3(
#runif(5, 0, input$bar_max),
data=data_C,
script = system.file("examples/mult2.js" , package = "r2d3", d3_version = c("3"))
)
})
}
shinyApp(ui = ui, server = server)
In the .js file, I replaced
d3.tsv("data.tsv", function(error, data) {
color.domain(d3.keys(data[0]).filter(function(key) { return key !== "date"; }));
with
d3.tsv(r2d3.data, function(error, data) {
color.domain(d3.keys(data[0]).filter(function(key) { return key !== "date"; }));
based on the example from the r2d3 page. The animated bar chart example, shown at the bottom of the page, works great for me. But this chart doesn't. Any help would be greatly appreciated