StackedAreaPlot

fun <X, Y> XYGraphScope<X, Y>.StackedAreaPlot(stacks: List<StackArea<X, Y>>, baseline: AreaBaseline<X, Y>, modifier: Modifier = Modifier.Companion, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A plot that renders multiple stacked series of data as lines with filled areas between them.

This function provides a flexible way to construct a stacked area chart, allowing each layer to be defined individually with its own data and drawing style (e.g., linear or cubic Bézier). The plot automatically uses the top of the previous layer as the baseline for the next, creating the stacked effect.

Parameters

X

The type of the x-axis values.

Y

The type of the y-axis values.

stacks

A list of StackArea instances, where each defines a layer of the chart. The layers are rendered in the order provided, with the first item at the bottom of the stack.

baseline

The AreaBaseline for the very first (bottom) layer of the stack.

modifier

A Modifier for the plot.

animationSpec

The AnimationSpec to use for animating the plot when it is first composed or when data changes.


fun <X, Y> XYGraphScope<X, Y>.StackedAreaPlot(data: List<StackedAreaPlotEntry<X, Y>>, styles: List<StackedAreaStyle>, firstBaseline: AreaBaseline<X, Y>, modifier: Modifier = Modifier.Companion, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A Stacked Area Plot is like a line plot but with filled areas between lines.

Parameters

X

Data type of x-axis values

Y

Data type of y-axis values

data

List of StackedAreaPlotEntry data items for the plot. Each must hold the same number of y-axis values.

styles

A list of StackedAreaStyles to be applied to each series in the data. The size of this list must match the number of data series provided by data

firstBaseline

Provides the value for the bottom of the first line's area, in units of Y. Typically this will be the 0 value for Y's data type. Note: If the y-axis is logarithmic this value cannot be 0.

animationSpec

The animation to provide to the graph when it is created or changed.