使用iframe嵌入Google图表

问题描述 投票:0回答:1

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

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

基本上我有一个必须tabBoxes的fluidRow

                  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个回答
0
投票

所以,这并不像我想象的那么难。要嵌入图表,您必须先将其发布,然后选择嵌入选项。然后,您复制所有内容

<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>')

                               )
© www.soinside.com 2019 - 2024. All rights reserved.