Area band

ecr.bandR Documentation

Area band


A 'custom' serie with lower and upper boundaries

Usage = NULL, lower = NULL, upper = NULL, type = "stack", ...)



A data.frame with lower and upper numerical columns and first column with X coordinates.


The column name of band's lower boundary (string).


The column name of band's upper boundary (string).


Type of rendering

  • 'stack' - by two stacked lines (default)

  • 'polygon' - by drawing a polygon as polyline from upper/lower points.


More parameters for serie


  • type='stack': two stacked lines are drawn, one with customizable areaStyle. The upper boundary coordinates are values added on top of the lower boundary coordinates.
    xAxis is required to be of type 'category'.

  • type='polygon': coordinates of the two boundaries are chained into a polygon and displayed as one. Tooltips do not show upper band values.

Optional parameter name, if given, will show up in legend. Legend will merge all series with the same name into one item.


A list of one serie when type='polygon', or two series when type='stack'


df <- airquality |> dplyr::mutate(
    lwr= round(Temp-Wind*2),
    upr= round(Temp+Wind*2),
      x= paste0(Month,'-',Day) ) |>
  dplyr::relocate(x, Temp)
bands <-, 'lwr', 'upr', # type='stack',
                  name= 'stak', areaStyle= list(opacity=0.4))
df |> ec.init( load= 'custom',
   legend= list(show= TRUE),
   dataZoom= list(type= 'slider'),
   toolbox= list(feature= list(dataZoom= list(show= TRUE))),
   xAxis= list(type= 'category', boundaryGap= FALSE),
   series= list(
     list(type='line', color='blue', name='line'),
     bands[[1]], bands[[2]]
   tooltip= list( trigger= 'axis',
     formatter= ec.clmn(
        'high <b>%@</b><br>line <b>%@</b><br>low <b>%@</b>',
                  3.3, 1.2, 2.2)
   )  # 3.3= upper_serie_index +.+ index_of_column_inside

echarty documentation built on Sept. 21, 2023, 1:06 a.m.

Related to in echarty...