ecr.band {echarty}R Documentation

Area band

Description

A 'custom' serie with lower and upper boundaries

Usage

ecr.band(df = NULL, lower = NULL, upper = NULL, two = FALSE, ...)

Arguments

df

A data.frame with lower and upper numerical columns.

lower

The column name of band's lower boundary, a string.

upper

The column name of band's upper boundary, a string.

two

Type of rendering - by polygon (FALSE,default), or by two stacked lines (TRUE)

...

More parameters for serie

Details

When two=FALSE, the coordinates of the two boundaries are chained into a polygon and displayed as one. Uses absolute cartesian coordinates.
When two=TRUE, two smooth stacked lines are drawn, one with customizable areaStyle. The upper boundary coordinates represent values on top of the lower boundary coordinates.

Value

One list serie when two=FALSE, or a list of two list series when two=TRUE

Examples

myList <- list(x=LETTERS[1:7],
               d=c(140, 232, 101, 264, 90, 340, 250),
               u=c(120, 282, 111, 234, 220, 340, 310),
               l=c(200, 332, 151, 400, 190, 540, 450))
data <- as.data.frame(do.call(cbind, myList))
colnames(data) <- c('x','down','up','coord')
p <- ec.init(load='custom')
p$x$opts <- list(
  xAxis=list(list(type='category', boundaryGap=FALSE, data=data$x)),
  yAxis=list(list(scale=TRUE)),
  legend=list(ey=''),
  series = ecr.band(data, 'down', 'up', two=TRUE, name='band')   # two=TRUE
  #series = list(ecr.band(data, 'down', 'up', name='polyBand'))  # two=FALSE
)
p$x$opts$series <- append(p$x$opts$series, 
  list(list(name='line',type='line', lineStyle=list(width=2), data=data$coord)) )
p


[Package echarty version 0.2.0 Index]