【问题标题】:Embedding a Google Chart with iframe使用 iframe 嵌入 Google 图表
【发布时间】:2019-04-13 20:37:52
【问题描述】:

所以基本上我正在尝试使用 googleViz 包和/或只是将已发布的谷歌图表作为 iframe 嵌入到 tabPaenl 中,然后让它自动调整以适合嵌入在 R Shiny Web 中的相应 tabPanel 中的 tabPanel应用程序。任何想法和/或建议都会很棒。

所以我尝试只使用 googleVis 包,它会阻止 r-shiny 应用程序加载,因为 googleVis 想在单独的网页中打开图表。

基本上我有一个fluidRow,它必须是tabBoxes

                  fluidRow(
                    tabBox(
                      title = "Visualization Trends",
                      # The id lets us use input$tabset1 on the server to find the current tab
                      id = "tabset1", height = "500px",
                      tabPanel("First Response", 
                               "First Tab Content 1",
              I WANT TO EMBED THE CHART HERE
                               ),
                      tabPanel("Case Closure", "First Tab Content 2"),
                      tabPanel("SLA Met", "First Tab Content 3"),
                      tabPanel("SLA Missed", "Insert SLA Misses Content"),
                      tabPanel("Overall CR & MW", "Insert Google Chart")

实际结果没有用,我有点卡住了,所以我真的只需要一些方向。

【问题讨论】:

    标签: r shiny rstudio googlevis


    【解决方案1】:

    所以,这并没有我想象的那么难。 为了嵌入图表,您必须先发布它,然后选择嵌入选项。然后,您使用

    复制所有内容
    <iframe>some_embedded_content<iframe>
    

    复制后,您可以将其嵌入到 tabBox 面板中:

                          fluidRow(
                        tabBox(
                          title = "Visualization Trends",
                          # The id lets us use input$tabset1 on the server to find the current tab
                          id = "tabset1", height = "500px",
                          tabPanel("First Response",
                                   HTML('<iframe width="600" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/e/2PACX-1vRNxLt1gp1TRc7sB83xjGpXLcLLUq8xH0B9iv1/pubchart?oid=1201606802&amp;format=interactive"></iframe>')
    
                                   )
    

    【讨论】:

    • 您可以通过在 tabPanel 中嵌入“HTML”组件来获得它。
    猜你喜欢
    • 1970-01-01
    • 2015-05-30
    • 2014-02-28
    • 2017-11-05
    • 2017-04-12
    • 2014-04-05
    • 1970-01-01
    • 2016-07-08
    • 1970-01-01
    相关资源
    最近更新 更多