renderHeatMap: Render Heat Map Plotted by ECharts into Shiny Applications

Description Usage Arguments Note Author(s) References Examples

Description

renderHeatMap() function helps render heat map charts into Shiny applications.

Usage

1
2
3
4
5
renderHeatMap(div_id, data,
              theme = "default",
              show.tools = TRUE,
              grid_left = "3%", grid_right = "4%", grid_top = "16%", grid_bottom = "3%",
              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 input must be a matrix containing numeric or integer values. Users can choose to have or not have row names or columns names.

From version 2.10, the data input (matrix) must be with row names and column names.

theme

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

show.tools

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

grid_left

Distance between grid component and the left side of the container. Default value is "3%".

grid_right

Distance between grid component and the right side of the container. Default value is "4%".

grid_top

Distance between grid component and the top side of the container. Default value is "16%".

grid_bottom

Distance between grid component and the bottom side of the container. Default value is "3%".

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)

References

https://github.com/ecomfe/echarts-wordcloud

Examples

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


  # Server function -------------------------------------------
  server <- function(input, output) {
    dat <- volcano
    row.names(dat) <- 1:dim(dat)[1]
    colnames(dat) <- 1:dim(dat)[2]

    renderHeatMap(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)
}

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