renderGauge: Render the Gauge Chart Plotted by ECharts into Shiny...

Description Usage Arguments Note Author(s) Examples

Description

renderGauge() function helps render the gauge chart into Shiny application.

Usage

1
2
3
4
renderGauge(div_id, theme = "default", gauge_name, rate,
            show.tools = TRUE,
            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.

theme

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

gauge_name

The title to show on the gauge. It can not be ignored.

rate

As the gauge helps show some kind of rate, users need to give this rate value. It must be numerical or integer values.

show.tools

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

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.

Note

Users need to state the division for the chart first, with tags$div() function of Shiny packages. Please note that the division id must keep unique (duplicated division id will cause error).

Author(s)

Xiaodong DENG

(ECharts library is authored by Baidu team)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (interactive()) {
  library(shiny)
  library(ECharts2Shiny)


  # Server function -------------------------------------------
  server <- function(input, output) {
    # Call functions from ECharts2Shiny to render charts
    renderGauge(div_id = "test",rate = 99, gauge_name = "Finish Rate")
  }

  # 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)
}

Example output



ECharts2Shiny documentation built on May 2, 2019, 8:57 a.m.