Вот что можно попробовать.
Я прокомментировал некоторые output
утверждения, поскольку у меня не было всех ваших данных.
Я также добавил:
loadEChartsLibrary(),
tags$div(id="pieChart", style="width:100%;height:400px;"),
Прежде чем позвонить deliverChart
.
library(shiny)
library(shinydashboard)
library(dplyr)
library(ECharts2Shiny)
Trends <- data.frame(
value = c(17,10,8,6,5,46),
name = c("Species", "Movies", "TV Series", "Games", "Food", "Random"),
stringsAsFactors = FALSE
)
ui <- dashboardPage(
dashboardHeader(title = "Catnames in Europe"),
skin = "red",
dashboardSidebar(
img(src = "cats_looking.jpg", height = 100, width = 150, align = "left"),
selectInput("countries",
"Choose country:",
choices = c("Netherlands","Germany","Turkey","Ireland",
"England","Belgium","Spain","Portugal",
"United Sates","Denmark","Sweden",
"Switzerland","Italy"),
selected = "Netherlands",
multiple = FALSE,
width = '400px'),
selectInput("years",
"Choose Year:",
choices = c("2017","2018","2019","2020"),
selected = "2019",
multiple = FALSE,
width = '400px'),
actionButton("button","Update view",style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
tags$div(div_id= "distPie", class ="plot-Output")
),
dashboardBody(fluidRow(
tabBox(
tabPanel("Countries",tableOutput("catnametable"),
style = "background-color: #ffffff;")),
tabBox(
tabPanel("Years",tableOutput("years"),
style = "background-color: #ffffff;"),
tabPanel("Trends in 2019",
loadEChartsLibrary(),
tags$div(id="pieChart", style="width:100%;height:400px;"),
deliverChart(div_id = "pieChart", running_in_shiny = TRUE),
style = "background-color: #ffffff;"))
)))
server <- function(input, output) {
output$catnametable <- renderTable({
#countrylist <- CatnamesEurope %>%
# filter(Country %in% input$countries)
})
output$years <- renderTable({
#yearlist <- Years2 %>%
# filter(Years_ordered %in% input$years)
})
output$pieChart <- renderPieChart(
div_id = "pieChart",
data = Trends,
radius = '75%',
center_x = '50%',
center_y = '50%',
show.label = TRUE,
show.legend = TRUE, show.tools = TRUE,
font.size.legend= 12
)
}
shinyApp(ui = ui, server = server)