0
我在R中創建了多個DyGraph(其中10個),我想將它們嵌入HTML頁面(我已經使用<iframe id="iframe"
- 也許是最簡單的方法)並將它們從我的DROPBOX(主要的ISSUE)。我嘗試了Rdrop2,但無法讓我的頭。誰能幫助??`DyGraph和Dropbox
R代碼裏面的位置
dygraph(cbind1, main = "General and Acute Bed Capacity") %>%
dySeries("East_and_North_Hertfordshire", axis = 'y', strokeWidth = 2, strokePattern = "dotted") %>%
dySeries("Hertfordshire_Community", axis = 'y', strokeWidth = 2, strokePattern = "dotdash") %>%
dySeries("Luton_and_Dunstable", axis = 'y', strokeWidth = 2, strokePattern = 3:7) %>%
dySeries("West_Hertfordshire", axis = 'y', strokeWidth = 2, strokePattern = "dashed") %>%
dySeries("Overall_Bed_Capacity", axis = 'y2', strokeWidth = 2, fillGraph = TRUE) %>%
dyAxis("y", label = "Individual Trust - Bed Capacity", c(100, 1200)) %>%
dyAxis("y2", label = "Health Economy - Bed Capacity", independentTicks = TRUE, , valueRange = c(1500, 2600)) %>%
dyAxis("x", label = "Data source: Quarterly Bed Availability and Occupancy www.england.nhs.uk") %>%
dyLegend(show = "always", labelsSeparateLines = TRUE, hideOnMouseOut = TRUE, width = 250)%>%
dyOptions(fillAlpha = 0.3, digitsAfterDecimal = 0, colors = c('darkorange', 'magenta', 'darkred', 'yellowgreen','steelblue'), drawPoints = TRUE, pointSize = 3, drawGrid = FALSE)
HTML代碼(部分)
<iframe id="iframe" width=1300 height=520 src="file:///C:/Users/Owner/Dropbox/NHS.htm" style="border:5px dotted red"></iframe>
由於R代碼需要R後端來處理 –
您只能將其嵌入到Shiny應用程序中,而不是常規網頁。您可以使用'knitr'或'htmlwidgets'將它們渲染爲HTML,但Dropbox不是很善於渲染結果文件,可能是因爲他們不想運行人們上傳的JavaScript(與Github Pages相同)。人們仍然可以下載這些文件並在瀏覽器中打開它們,但這些圖形在網絡上不可見。如果你想要它們,可以在[rpubs](http://rpubs.com/)上使用'knitr'(簡單),或者用[shinyapps.io](http://www.shinyapps.io/)使用'shiny' (可以製作花式)。 – alistaire