XYGraphScope

A scope for XY plots providing axis and state context.

Properties

Link copied to clipboard
abstract val xAxisModel: AxisModel<X>
Link copied to clipboard
abstract val xAxisState: AxisState
Link copied to clipboard
abstract val yAxisModel: AxisModel<Y>
Link copied to clipboard
abstract val yAxisState: AxisState

Functions

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.AreaPlot(data: List<Point<X, Y>>, areaBaseline: AreaBaseline<X, Y>, areaStyle: AreaStyle, modifier: Modifier = Modifier, lineStyle: LineStyle? = null, symbol: @Composable HoverableElementAreaScope.(Point<X, Y>) -> Unit? = null, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

An area plot that draws data as points and lines with a filled area to a baseline.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.GroupedVerticalBarPlot(modifier: Modifier = Modifier, maxBarGroupWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec, content: GroupedVerticalBarPlotScope<X, Y>.() -> Unit)
fun <X, Y, E : VerticalBarPlotGroupedPointEntry<X, Y>> XYGraphScope<X, Y>.GroupedVerticalBarPlot(data: List<E>, modifier: Modifier = Modifier, bar: @Composable BarScope.(dataIndex: Int, groupIndex: Int, entry: E) -> Unit = { i, g, _ -> val colors = remember(data) { generateHueColorPalette(data.maxOf { it.y.size }) } DefaultVerticalBar( brush = SolidColor(colors[g]), modifier = Modifier.fillMaxWidth(KoalaPlotTheme.sizes.barWidth) ) }, maxBarGroupWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A Vertical Bar Plot to be used in an XYGraph and that plots multiple series side-by-side.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.HorizontalLineAnnotation(location: Y, lineStyle: LineStyle)

Places a vertical line marker on the plot at the specified x-axis location styled using the provided lineStyle.

Link copied to clipboard
abstract fun Modifier.hoverableElement(element: @Composable () -> Unit): Modifier
Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.LinePlot(data: List<Point<X, Y>>, modifier: Modifier = Modifier, lineStyle: LineStyle? = null, symbol: @Composable HoverableElementAreaScope.(Point<X, Y>) -> Unit? = null, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A line plot that draws data as points and lines on an XYGraph.

Link copied to clipboard
open fun scale(point: Point<X, Y>, size: Size): Offset

Transforms point from AxisModel space to display coordinates provided a plot area size.

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

A Stacked Area Plot is like a line plot but with filled areas between lines, and where each successive line is added to all of the lines before it, so they stack.

Link copied to clipboard
fun <X> XYGraphScope<X, Float>.StackedVerticalBarPlot(modifier: Modifier = Modifier, barWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec, content: StackedVerticalBarPlotScope<X>.() -> Unit)

A Vertical Bar Plot to be used in an XYGraph and that plots multiple series as a stack of bars.

fun <X, Y, E : VerticalBarPlotStackedPointEntry<X, Y>> XYGraphScope<X, Y>.StackedVerticalBarPlot(data: List<E>, modifier: Modifier = Modifier, bar: @Composable BarScope.(xIndex: Int, barIndex: Int) -> Unit, barWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

Composes a stacked vertical bar plot. This is a convenience method which defers to VerticalBarPlot. A stacked bar plot can be also achieved by placing multiple VerticalBarPlots on an io.github.koalaplot.core.xygraph.XYGraph, one for each "layer" of bars.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.StairstepPlot(data: List<Point<X, Y>>, lineStyle: LineStyle, modifier: Modifier = Modifier, symbol: @Composable HoverableElementAreaScope.(Point<X, Y>) -> Unit? = null, areaStyle: AreaStyle? = null, areaBaseline: AreaBaseline<X, Y>? = null, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

An XY Chart that draws series as points and stairsteps between points.

fun <X, Y> XYGraphScope<X, Y>.StairstepPlot(data: List<Point<X, Y>>, lineStyle: LineStyle, levelLineStyle: (Y) -> LineStyle, cap: StrokeCap = StrokeCap.Square, modifier: Modifier = Modifier, symbol: @Composable HoverableElementAreaScope.(Point<X, Y>) -> Unit? = null, areaStyle: (Y) -> AreaStyle? = null, areaBaseline: AreaBaseline<X, Y>? = null, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A StairstepPlot that differentiate lineStyle&areaBaseline at each Y-values based on levelLineStyle.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.VerticalBarPlot(defaultBar: @Composable BarScope.() -> Unit = solidBar(Color.Blue), modifier: Modifier = Modifier, barWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec, content: VerticalBarPlotScope<X, Y>.() -> Unit)

Creates a Vertical Bar Plot.

fun <X, Y, E : VerticalBarPlotEntry<X, Y>> XYGraphScope<X, Y>.VerticalBarPlot(data: List<E>, modifier: Modifier = Modifier, bar: @Composable BarScope.(index: Int) -> Unit, barWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A VerticalBarPlot to be used in an XYGraph and that plots data points as vertical bars.

fun <X> XYGraphScope<X, Float>.VerticalBarPlot(xData: List<X>, yData: List<Float>, modifier: Modifier = Modifier, bar: @Composable BarScope.(index: Int) -> Unit, barWidth: Float = 0.9f, animationSpec: AnimationSpec<Float> = KoalaPlotTheme.animationSpec)

A VerticalBarPlot to be used in an XYGraph and that plots a single series of data points as vertical bars.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.VerticalLineAnnotation(location: X, lineStyle: LineStyle)

Places a vertical line marker on the plot at the specified x-axis location styled using the provided lineStyle.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.XYAnnotation(location: Point<X, Y>, anchorPoint: AnchorPoint, modifier: Modifier = Modifier, content: @Composable () -> Unit)

Places a Composable as an annotation on an XYGraph with the Composable's anchorPoint placed at the provided location.