Learn R Programming

ECharts2Shiny (version 0.2.13)

renderRadarChart: Render the Radar Chart Plotted by ECharts into Shiny Application

Description

renderRadarChart() function helps render the Radar chart into Shiny application.

Usage

renderRadarChart(div_id, data, theme = "default",
                  shape = "default", line.width = 2,
                  show.legend = TRUE, show.tools = TRUE,
                  font.size.legend = 12,
                  animation = TRUE,
                  running_in_shiny = TRUE)

Arguments

div_id

The division id users specified for this chart. The division will be specified in ui.R.

data

The data used for the plotting. It should be a data.frame. For radar chart, the data must have row names and column names specified.

theme

Which ECharts theme to use. Valid values include "default", "roma", "infographic", "macarons", "vintage", "shine", "caravan", "dark-digerati", "jazz", and "london".

shape

The shape of the radar chart. Valid values include "default" and "circle".

line.width

The width of the lines in the radar chart.

show.legend

If display the legends. The default value is TRUE.

show.tools

If display the tool bar. The default value is TRUE.

font.size.legend

The font size of legend bar. The default value is 12.

animation

Whether display the chart with animation. The default value is TRUE.

running_in_shiny

If we're actually running this in a Shiny library, or we're simply doing testing. Default valus is "TRUE". If "FALSE", the function will print what it's supposed to evaluate.

Examples

Run this code
# NOT RUN {
if (interactive()) {
  library(shiny)
  library(ECharts2Shiny)


  dat <- data.frame(Type.A = c(4300, 10000, 25000, 35000, 50000),
                    Type.B = c(5000, 14000, 28000, 31000, 42000),
                    Type.C = c(4000, 2000, 9000, 29000, 35000))
  row.names(dat) <- c("Feture 1", "Feature 2", "Feature 3", "Feature 4", "Feature 5")


  # Server function -------------------------------------------
  server <- function(input, output) {
    renderRadarChart(div_id = "test",
                    data = dat)
  }

  # UI layout -------------------------------------------------
  ui <- fluidPage(
    # We MUST load the ECharts javascript library in advance
    loadEChartsLibrary(),

    tags$div(id="test", style="width:50%;height:400px;"),
    deliverChart(div_id = "test")
  )

  # Run the application --------------------------------------
  shinyApp(ui = ui, server = server)
}
# }

Run the code above in your browser using DataLab