Author: Xiaodong DENG
Date: 2017-02-24

# Introduction to ECharts2Shiny

#### Xiaodong DENG

#### February 24, 2017

As an R package, ECharts2Shiny can help embed the interactive charts plotted by ECharts library into our Shiny application. Currently, we can support

- Pie charts
- Line charts
- Bar charts
- Scatter plots
- Radar chart
- Gauge
- Word Cloud
- Heat Map

### Contents

- How to Install
- Examples
- Note
- License

## How to Install

From CRAN,

    install.packages("ECharts2Shiny")

For the latest development version, please install from GitHub

    library(devtools)
    install_github("XD-DENG/ECharts2Shiny")

## Examples

    library(shiny)
    library(ECharts2Shiny)

    # Prepare sample data for plotting --------------------------
    dat <- data.frame(c(1, 2, 3),
                      c(2, 4, 6))
    names(dat) <- c("Type-A", "Type-B")
    row.names(dat) <- c("Time-1", "Time-2", "Time-3")

    # Server function -------------------------------------------
    server <- function(input, output) {
      # Call functions from ECharts2Shiny to render charts
      renderBarChart(div_id = "test", grid_left = '1%', direction = "vertical",
                     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)

(For more examples, please refer to the `/examples` folder of the repo on GitHub)

### List of Examples (up to 2 August 2016)

- 1. Basic
- 2. Diverse Plots
- 3. More Options in Basic Charts
- 4. Scatter
- 5. Use Reactive Values as Data Input
- 6. Radar Chart
- 7. Word Cloud - Basic
- 8. Word Cloud - More Shapes
- 9. Word Cloud - Use Vector as Data Input
- 10. Line Chart with Diverse Options
- 11. Scatter with point.type Argument
- 12. Step Line Chart
- 13. Deal with Missing Values
- 14. Heat Map
- 15. Add Hyperlinks

## Note

For each type of charts, you need to prepare the data to be in specific format for EChart2Shiny.

Please refer to the document of each function and the examples for details

## License

ECharts2Shiny package itself is under GPL-2.

The ECharts JS library is under BSD license (ECharts).