如何在shinyapp中使用Google Motionchart的函数getstate()

如何在shinyapp中使用Google Motionchart的函数getstate(),r,shiny,google-visualization,googlevis,R,Shiny,Google Visualization,Googlevis,我搜索了一下,谷歌Motionchart的API似乎不允许自定义工具提示等等。但是我认为有一种方法可以使用getstate()检索表中的信息,然后使用所选的项来创建交互式按钮,这是我无法直接在工具提示中执行的 getstate的文档可从以下网址获得: 我查看了googleVis软件包的文档,但没有相关信息。所以我的问题是有一种方法可以在R?中使用这个getdata功能 提前谢谢 这就是守则的结构: library(shiny) library(DT) library(googleVis) lib

我搜索了一下,谷歌Motionchart的API似乎不允许自定义工具提示等等。但是我认为有一种方法可以使用getstate()检索表中的信息,然后使用所选的项来创建交互式按钮,这是我无法直接在工具提示中执行的

getstate的文档可从以下网址获得:

我查看了googleVis软件包的文档,但没有相关信息。所以我的问题是有一种方法可以在R?中使用这个getdata功能

提前谢谢

这就是守则的结构:

library(shiny)
library(DT)
library(googleVis)
library(RJSONIO)

shinyApp(
ui = fluidPage( 
    column(width=7,
            htmlOutput("Plot_Fruits"),
            actionButton("Current", label = "Get current fruits")),
    column(width=5, dataTableOutput('Current_Fruits')
               )),
server = function(input, output) {

    output$Plot_Fruits <- renderGvis({
        FinalPlot <- gvisMotionChart(Fruits, "Fruit", "Year") 
        FinalPlot
    })

    observe(input$Current,{}
        #Here use the getState() as it is explained at: 
        #https://google-developers.appspot.com/chart/interactive/docs/gallery/motionchart#getstate
        #To update myState dynamically and render the table appropiately
    )

    output$Current_Fruits <- renderDataTable({
        #myState should be updated dynamically when the button is pressed. 
        myState <- '
        {"uniColorForNonSelected":false,"yLambda":1,
        "xZoomedDataMin":71,"nonSelectedAlpha":0,
        "dimensions":{"iconDimensions":["dim0"]},"xZoomedDataMax":91,
        "iconType":"BUBBLE","duration":{"timeUnit":"Y","multiplier":1},
        "playDuration":15000,"sizeOption":"_UNISIZE","xLambda":1,
        "yZoomedDataMax":91,"yAxisOption":"4","xZoomedIn":false,
        "xAxisOption":"4","iconKeySettings":[{"trailStart":"2010",
        "key":{"dim0":"Apples"}},{"trailStart":"2010",
        "key":{"dim0":"Oranges"}}],
        "yZoomedDataMin":71,"time":"2010","yZoomedIn":false,
        "orderedByY":false,"colorOption":"2","showTrails":true,"orderedByX":false}
        '
        json_file <- fromJSON(myState)
        json_file <- lapply(json_file, function(x) {
            x[sapply(x, is.null)] <- NA
            unlist(x)
        })
        Current_F <- as.data.frame(do.call("rbind", json_file),stringsAsFactors = FALSE)

        datatable(Current_F,escape = FALSE, rownames = TRUE,
                  selection = 'single')
    })



}
库(闪亮)
图书馆(DT)
图书馆(谷歌)
图书馆(RJSONIO)
shinyApp(
ui=fluidPage(
列(宽度=7,
htmlOutput(“绘图结果”),
actionButton(“当前”,label=“获取当前水果”),
列(宽度=5,dataTableOutput('Current_'))
)),
服务器=功能(输入、输出){
输出$Plot_