I'm trying to plot a radar chart in r shiny, but But the chart draws the average scores.
How I can attach names to scores() ?
library(shiny) library(shinydashboard) library("DT") library(ECharts2Shiny) ui <- fluidPage( ui <- fluidPage( table <- "responses", titlePanel("Wheel of life"), sidebarLayout( sidebarPanel( sliderInput("jesm1", "Q1", min = 1, max = 5, value = 1), sliderInput("jesm2", "Q2", min = 1, max = 5, value = 1), sliderInput("ravabet1", "Q3", min = 1, max = 5, value = 1), sliderInput("ravabet2", "Q4", min = 1, max = 5, value = 1), sliderInput("job1", "Q5", min = 1, max = 5, value = 1), sliderInput("job2", "Q6", min = 1, max = 5, value = 1), sliderInput("mali1", "Q7", min = 1, max = 5, value = 1), sliderInput("mali2", "Q8", min = 1, max = 5, value = 1), sliderInput("enter1", "Q9", min = 1, max = 5, value = 1), sliderInput("enter2", "Q10", min = 1, max = 5, value = 1), actionButton("submit", "Submit") ), mainPanel( tableOutput("values"), # plotOutput("pe"), loadEChartsLibrary(), tags$div(id="test", style="width:100%;height:400px;"), deliverChart(div_id = "test"), textOutput("he") )) ) ) server <- function(input, output, session) { sliderValues <- reactive({ data.frame( Name = c("jesmani", "ravabet", "job", "mail", "enter"), Value = as.character(c((input$jesm1 + input$jesm2)/2, (input$ravabet1 + input$ravabet2)/2, (input$job1 + input$job2)/2, (input$mali1 + input$mali2)/2, (input$enter1 + input$enter2)/2))) }) scores <- reactive({ data.frame((c((input$jesm1 + input$jesm2)/2, (input$ravabet1 + input$ravabet2)/2, (input$job1 + input$job2)/2, (input$mali1 + input$mali2)/2, (input$enter1 + input$enter2)/2))) }) #names(scores) <- c("jesmani","ravabet","job","mail","enter") jesmi <- reactive({data.frame(input$jesm1 + input$jesm2)/2}) ravabet <- reactive({data.frame(input$ravabet1 +input$ravabet2)/2}) job <- reactive({data.frame(input$job1 + input$job2)/2}) mali <- reactive({data.frame(input$mali1 + input$mali2)/2}) enter <- reactive({data.frame(input$enter1 + input$enter2)/2}) observeEvent(input$submit, { output$values <- renderTable({ sliderValues() }) # output$pe <- renderPlot({ renderRadarChart(div_id = "test", data = scores()) # }) output$he <- renderText({ 'High: Extraverts get their energy from interacting with others, while introverts get their energy from within themselves. Extraversion includes the traits of energetic, talkative, and assertive. They enjoy being with people, participating in social gatherings, and are full of energy.' }) }) } shinyApp(ui = ui, server = server) Thanks...
https://stackoverflow.com/questions/67138289/how-i-can-each-number-to-be-on-one-side-of-the-radar-chart April 17, 2021 at 08:40PM
没有评论:
发表评论