2
我試圖將RChart嵌入閃亮的應用程序中。我正在使用nPlot
函數創建type=scatterChart
NVD3樣式圖。在下面的NVD3網站例子,有兩個功能件我感興趣讓我RCharts工作閃亮的應用:RCharts scatterChart增強功能
http://nvd3.org/ghpages/scatter.html
- 看來,一個「地毯」是沿x軸包括上面的例子的軸和y軸,稍微證明了x和y點在它們各自的支撐物上最頻繁出現的位置。
- 此外,當點擊圖表並懸停在特定的點上時,會出現垂直和水平線,記下對應點的(x,y)位置。
有誰知道如何擴展我的代碼以實現這兩個功能。下面包含了閃亮的server.r和ui.r腳本。
## server.r
library(rCharts)
library(shiny)
x <- rnorm(100)
y <- rnorm(100)
dat <- as.data.frame(cbind(x,y))
shinyServer(function(input, output) {
output$myChart <- renderChart({
p1 <- nPlot(y ~ x, data = dat, type = "scatterChart")
p1$addParams(dom = 'myChart')
p1$params$height=400
p1$params$width=650
return(p1)
})
})
## ui.R
library(rCharts)
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("rCharts: Interactive Charts from R using NVD3.js"),
sidebarPanel(
wellPanel(
helpText( "Look at the pretty graph"
)
),
wellPanel(
helpText( "Look at the pretty graph"
)
),
wellPanel(
helpText( "Look at the pretty graph"
)
)
),
mainPanel(
div(class='wrapper',
tags$style(".Nvd3{ height: 400px;}"),
showOutput("myChart","Nvd3")
)
)
))
在此先感謝您提供的任何建議。
完美工作。謝謝您的幫助!! – Chris