ChartGradient

sealed interface ChartGradient(source)

A gradient that paints a chart shape, such as a bar or stacked area layer.

Positions are fractions of the gradient's bounds, which span picks, so a gradient reads the same on every shape size and screen. A chart clamps a gradient it cannot draw as given, as stops describes. One with non-finite positions, or the same start and end, draws the shape without it.

Inheritors

Types

Link copied to clipboard
data class Linear(val stops: ImmutableList<GradientStop>, val start: GradientPoint, val end: GradientPoint, val span: GradientSpan, val tileMode: TileMode) : ChartGradient

A gradient along the line from start to end.

Properties

Link copied to clipboard
abstract val span: GradientSpan

The bounds the gradient's positions are fractions of.

Link copied to clipboard
abstract val stops: ImmutableList<GradientStop>

The colors along the gradient, with offsets in 0..1. Offsets outside that range are clamped, stops out of order are sorted, and a stop with a non-finite offset is dropped. A single stop paints its color solid, and no stops draw the shape without a gradient.

Functions

Link copied to clipboard

Returns this made drawable, or null when it cannot be drawn, so the shape is solid.