我正在尝试在 R Shiny 中使用 tableau javascript api。我使用 shinyjs 包来简化闪亮的调用。涉及的js来自tableau的教程页面。
单击“调用 Tableau Viz”按钮后,什么也没发生,浏览器控制台显示 Uncaught [object Object] 错误
(index):7504 Uncaught [object Object]VizImpl$Create@(index):7504$tableauSoftware_Viz@(index):4829initializeViz@(index):8644shinyjs.init@(index):34(匿名函数)@(index): 33_sendMessagesToHandlers@shinyapp.js:515(匿名函数)@shinyapp.js:626_sendMessagesToHandlers@shinyapp.js:515dispatchMessage@shinyapp.js:501c.onmessage@shinyapp.js:114
这应该是一个非常直接的问题,但是我不知道如何解决它。
library(shiny)
library(shinyjs)
jsCode <- "shinyjs.init = function(){initializeViz();}"
shinyApp(
ui = fluidPage(
includeScript("https://public.tableau.com/javascripts/api/tableau-2.1.0.js"),
includeScript("http://onlinehelp.tableau.com/samples/en-us/js_api/tutorial.js"),
useShinyjs(),
extendShinyjs(text = jsCode),
actionButton('trigger','Call Tableau Viz'),
tags$div(id = 'tableauViz')
),
server = function(input, output) {
observeEvent(input$trigger, {
js$init()
})
}
)