First, you should load recharts:

library(recharts)

1 Introduction

EventRiver plot contains 1 basic type: eventRiver.

The keys are:

  • x must be made of :
    • 2 compulsory columns: event slice time, events name
    • 3 optional columns: event slice title, event slice links, event slice images.
  • y must be made of:
    • 1 compulsory column: slice value
    • 1 optional column: slice weight (default 1)
  • series must be made of:
    • 2 optional columns: series, series weight (default 1)
  • The variables must be provided following the exact order above.

2 Function Call

echartr(data, x, y, <t>, <series>, <type>)
Arg Requirement

data

source data in the form of data.frame

x

character independent variable. It must contain 2 compulsory columns (event slice time, events name) and/or 3 optional columns (event slice title, event slice links, event slice images). The params list must exactly follow this order.

y

numeric dependent variable. It must contain 1 compulsory column (slice value) and/or 1 optional column (slice weight). The params list must exactly follow this order.

t

timeline variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.

series

data series variable processed as factors. It contains 2 optional columns (series, series weight). The params list must exactly follow this order.

type

‘eventRiver’

3 Showcase

3.1 Basic Plot

data(events)
events$link <- 'www.baidu.com'
events$img <- 'inst/favicon.png'
events$title <- paste(rownames(events), events$event)
echartr(events, c(time, event, title, link, img), c(value, weight), series, 
        type='eventRiver') %>% 
    setTitle('Event River', 'Ficticious Data') %>% setXAxis(name='Time') %>%
    setGrid(y2=80)

If you provide more details about each event slice (title, link and image) in x, the chart will be more informative.

4 Futher Setup

Then you can configure the widgets, add markLines and/or markPoints, fortify the chart.

You can refer to related functions to play around on your own.