JavaScript Stacked Mountains Chart

Also known as Stacked Area Graph or Stacked Areas

The stacked charts are a popular visual aid used for categorizing and comparing the parts of a whole using different colors to distinguish the categories.

This chart is created with custom stacking logic by using Area and AreaRange series and position each next data segment on top of the previous. Relying on characteristics and use cases of mountain series mentioned in previous examples, area is drawn on a Cartesian coordinate system and represents the quantitative data. Thus, in the example, the first data segment starts from a zero baseline and each next category would use the magnitude of previous segment as a low starting point.

// Create one Area series to be the base.
const areaFirst = chart.addAreaSeries()

// Create the next AreaRange series to be stacked on top of previous.
const areaNext1 = chart.addAreaRangeSeries()
const areaNext2 = chart.addAreaRangeSeries()