I want to add Plotly chart renderers to the rpivotTable()
function from the
R package rpivotTable. I followed the instructions given in the Javascript Pivot Table Wiki to add optional extra renderers. Unfortunatey, following these instructions will lead to the default behaviour. Maybe I assigned the Java code to the wrong arguments.
Here is a small example:
library(rpivotTable)
library(shiny)
server <- function(input, output){
output$mypivot = renderRpivotTable({
rpivotTable(
Titanic,
renderers = htmlwidgets::JS("$.extend($.pivotUtilities.renderers,
$.pivotUtilities.plotly_renderers)"),
rendererName = "Horizontal Stacked Bar Chart"
)
})
}
ui <- shinyUI(fluidPage(
tags$head(tags$script(src = "https://cdn.plot.ly/plotly-latest.min.js")),
rpivotTableOutput("mypivot"))
)
shinyApp(ui = ui, server = server)