Open ldboyghg opened 8 years ago
可以贴下你的代码么?
It seems good so far~
runApp(list(
ui = bootstrapPage(
numericInput('n', 'Number of obs', 100),
eChartOutput('plot')
),
server = function(input, output) {
mapData <- head(mapTestData_chs, 5)
map = eMap(mapData, namevar=~stdName, datavar = ~val1 + val2)
output$plot <- renderEChart({ map})
}
))
同样碰到,在RStudio里正常,但是在shiny里就不正常
贴一下代码?
library(shiny)
library(shinydashboard)
testUI <- function(id) {
ns <- NS(id)
tagList(
fluidRow(
valueBoxOutput(ns('box1'), width = 6),
valueBoxOutput(ns('box2'), width = 6)
),
fluidRow(
box(title = 'title',
width = '6',
eChartOutput(ns('op_map'))
)
)
)
}
test <- function(input, output, session) {
output$box1 <- renderValueBox(valueBox(12345, 'test1'))
output$box2 <- renderValueBox(valueBox(54321, 'test2'))
output$plot_map <- renderEChart({ eMap(mapTestData_chs, namevar=~name, datavar = ~value)})
}
shinyApp(
ui =dashboardPage(
header = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody(
testUI('moduletest')
)
),
server = function(input, output) {
callModule(module = test, id = 'moduletest')
}
)
shiny module
有几个小地方调了一下, 没有问题啊
library(shiny)
library(shinydashboard)
testUI <- function(id) {
ns <- NS(id)
tagList(
fluidRow(
valueBoxOutput(ns('box1'), width = 6),
valueBoxOutput(ns('box2'), width = 6)
),
fluidRow(
box(title = 'title',
width = '6',
eChartOutput(ns('plot_map'))
)
)
)
}
test <- function(input, output, session) {
output$box1 <- renderValueBox(valueBox(12345, 'test1'))
output$box2 <- renderValueBox(valueBox(54321, 'test2'))
output$plot_map <- renderEChart({ eMap(mapTestData_chs, namevar=~stdName, datavar = ~val1)})
}
shinyApp(
ui =dashboardPage(
header = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody(
testUI('moduletest')
)
),
server = function(input, output) {
callModule(module = test, id = 'moduletest')
}
)
求指教