我已将窗口分为两部分。在这两个部分上,我都有一个下拉列表和一个朝阳图。现在,我想通过下拉菜单更改森伯斯特。我有数据框,例如data_pie和data_pie2,应该从下拉列表中更改它。我知道我应该使用反应性函数,但是我不知道如何更改数据框。
server.R
output$sunburst <- renderSunburst({sunburst(data_pie, count = TRUE, legend = list(w = 150,h = 50, s = 15 , t = 1 ), breadcrumb = list(w = 150,h = 75, s = 15 , t = 10))})
output$sunburst2 <- renderSunburst({sunburst(data_pie2, count = TRUE, legend = list(w = 150,h = 50, s = 15 , t = 1 ), breadcrumb = list(w = 150,h = 75, s = 15 , t = 10))})
ui.R
tabItem(tabName = "sunbrust",
h2("Sunbrust Visualization"),
fluidRow(
box(
selectInput("input_pie_links", choices = c("Model 1", "Model 2", "Model 3"), label = "Model Auswahl"),
sunburstOutput("sunburst", width = "1200", height = "1200")),
box(
selectInput("input_pie_rechts", choices = c("Model 1", "Model 2", "Model 3"), label = "Model Auswahl"),
sunburstOutput("sunburst2", width = "1200", height = "1200"))
答案 0 :(得分:0)
我不确定您要做什么。通过使用slideInput选择数据集,仅显示一个图表,而不显示两个图表?也许下面的代码有帮助。如果不是,请指定您要执行的操作,并提供更多代码,以便可以复制仪表板。
ui.R
tabItem(tabName = "sunbrust",
h2("Sunbrust Visualization"),
fluidRow(
box(
selectInput("input_pie", choices = c("Model 1" = 1, "Model 2" = 2),
label = "Model Auswahl"),
sunburstOutput("sunburst", width = "1200", height = "1200"))
)
server.R
data = reactive({
if (input$input_pie == 1) {
data <- data_pie
} else {
data <- data_pie2
}
})
output$sunburst <- renderSunburst({sunburst(data(), count = TRUE, legend = list(w = 150,h = 50, s = 15 , t = 1 ), breadcrumb = list(w = 150,h = 75, s = 15 , t = 10))})
答案 1 :(得分:0)
我已经创建了以下解决方案:
ui.R
tabItem(tabName = "sunbrust",
h2("Sunbrust Visualization"),
fluidRow(
#column(10, align="center",
# sunburstOutput("sunburst", width = "1200", height = "1200")
box(
uiOutput("sunburst_auswahl_links"),
sunburstOutput("sunburst", width = "1200", height = "1200")),
box(
uiOutput("sunburst_auswahl_rechts"),
sunburstOutput("sunburst2", width = "1200", height = "1200"))
)
server.R
output$sunburst_auswahl_links <- renderUI({
selectInput("auswahl_sunburst_links", "Model Auswahl:", c(1,2,3))
})
sunbrylinks <- reactive({sunburst(datapielist[as.integer(input$auswahl_sunburst_links)][[1]], count = TRUE, legend = list(w = 150,h = 50, s = 15 , t = 1 ), breadcrumb = list(w = 150,h = 75, s = 15 , t = 10))})
output$sunburst <- renderSunburst({sunbrylinks()})
output$sunburst_auswahl_rechts <- renderUI({
selectInput("auswahl_sunburst_rechts", "Model Auswahl:", c(1,2,3))
})
sunbryrechts <- reactive({sunburst(datapielist[as.integer(input$auswahl_sunburst_rechts)][[1]], count = TRUE, legend = list(w = 150,h = 50, s = 15 , t = 1 ), breadcrumb = list(w = 150,h = 75, s = 15 , t = 10))})
output$sunburst2 <- renderSunburst({sunbryrechts()})