GithubHelp home page GithubHelp logo

happy-ferret / echarts4r Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johncoene/echarts4r

0.0 2.0 0.0 23.53 MB

๐Ÿณ ECharts 4 for R

Home Page: http://echarts4r.john-coene.com/

License: Other

R 100.00%

echarts4r's Introduction

echarts4r

Travis-CI Build Status

echarts

ECharts 4 for R. Official documentation:

Installation

You can install echarts4r from github with:

# install.packages("devtools")
devtools::install_github("JohnCoene/echarts4r")

website

Features

Chart types

  • Bar
  • Line
  • Area
  • Step
  • Scatter
  • Effect Scatter
  • Candlestick
  • Funnel
  • Sankey
  • Graph
  • Heatmap
  • Parallel
  • Pie
  • Tree
  • Treemap
  • River (streamgraph)
  • Sunburst
  • Boxplot
  • Calendar
  • Gauge
  • Polar
  • wordcloud
  • liquidFill
  • Map
  • Line 3D
  • Bar 3D
  • Scatter 3D
  • Map 3D
  • Geo 3D
  • Globe 3D
  • Flow GL
  • Graph GL
  • Scatter GL

Other

  • Proxies (*_p)
  • Themes
  • Animations

Examples

Some examples

library(echarts4r)

#' ol' mtcars example
mtcars %>%
  e_charts(mpg) %>% 
  e_line(drat)

# with negative
USArrests %>% 
  dplyr::mutate(
    State = row.names(.),
    Rape = -Rape
  ) %>% 
  e_charts(State) %>% 
  e_area(Murder) %>%
  e_bar(Rape, name = "Sick basterd", x.index = 1) %>% # second y axis 
  e_mark_line("Sick basterd", data = list(type = "average")) %>% 
  e_mark_point("Murder", data = list(type = "max"))

# Sankey
sankey <- data.frame(
  source = c("a", "b", "c", "d", "c"),
  target = c("b", "c", "d", "e", "e"),
  value = ceiling(rnorm(5, 10, 1)),
  stringsAsFactors = FALSE
)
 
sankey %>%
  e_charts() %>% 
  e_sankey(source, target, value) %>% 
  e_title("Sankey") %>% 
  e_theme("dark")

# Graph
nodes <- data.frame(
  name = paste0(LETTERS, 1:1000),
  value = rnorm(1000, 10, 2),
  size = rnorm(1000, 10, 2),
  grp = rep(c("grp1", "grp2"), 500),
  stringsAsFactors = FALSE
)
 
edges <- data.frame(
  source = sample(nodes$name, 2000, replace = TRUE),
  target = sample(nodes$name, 2000, replace = TRUE),
  stringsAsFactors = FALSE
)
 
e_charts() %>%
  e_graph_gl() %>% 
  e_graph_nodes(nodes, name, value, size, grp) %>% 
  e_graph_edges(edges, source, target)
  
# globe
url <- paste0("https://ecomfe.github.io/echarts-examples/",
              "public/data-gl/asset/data/population.json")
data <- jsonlite::fromJSON(url)
data <- as.data.frame(data)
names(data) <- c("lon", "lat", "value")

data %>% 
  e_charts(lon) %>% 
  e_globe(
    environment = e_stars_texture(),
    base.texture = e_globe_texture()
  ) %>% 
  e_bar_3d(lat, value, coord.system = "globe") %>% 
  e_visual_map()
  
# Flow GL
# coordinates
vectors <- expand.grid(0:9, 0:9)
names(vectors) <- c("x", "y")
vectors$sx <- rnorm(100)
vectors$sy <- rnorm(100)
vectors$color <- log10(runif(100, 1, 10))

vectors %>% 
  e_charts(x) %>% 
  e_flow_gl(y, sx, sy, color) %>% 
  e_visual_map(
    min = 0, max = 1, # log 10
    dimension = 4, # x = 0, y = 1, sx = 3, sy = 4
    show = FALSE, # hide
    inRange = list(
      color = c('#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8',
                '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026')
    )
  ) %>% 
  e_x_axis(
    splitLine = list(show = FALSE)
  ) %>% 
  e_y_axis(
    splitLine = list(show = FALSE)
  ) 

echarts4r's People

Contributors

johncoene avatar jpcoene avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.