Package-level declarations
Types
Link copied to clipboard
data class BarLegend<UnitType : Dimension>(val id: String, var items: List<BarLegendItem<UnitType>> = emptyList(), val resample: EasingCurve? = null, var title: String? = null, var titleFontSize: TextUnit = LegendDefaults.titleFontSize, val titleFontWeight: FontWeight = FontWeight.Bold, var titleColorValue: Color = LegendDefaults().titleColor, val labelFontSize: TextUnit = BarLegendDefaults.labelFontSize, var labelColor: Color = BarLegendDefaults.labelColor, val labelFont: Typeface = BarLegendDefaults.labelFont, val measurement: MeasurementUnits.MeasurementType? = null, val units: MeasurementUnits = MeasurementUnits.IMPERIAL, var currentUnits: UnitType? = units.dimensions(measurement)) : Legend, ColorScaleUpdatable
A Legend type that renders a color bar with optional measurement-aware labels. It's a data class to promote immutability, common in Compose.
Link copied to clipboard
object BarLegendDefaults
Default styling values for a BarLegend.
Link copied to clipboard
data class BarLegendItem<UnitType : Dimension>(val colorScaleOptions: ColorScaleOptions, var labels: BarLegendLabels<UnitType>, val height: Dp = BarLegendDefaults.barHeight, val rounded: Boolean = BarLegendDefaults.rounded, val margins: Dp = BarLegendDefaults.barMargins)
Describes a single color bar rendered by BarLegend.
Link copied to clipboard
data class BarLegendLabels<UnitType : Dimension>(var values: BarLegendLabels.Values<UnitType>? = null, val placement: BarLegendLabels.Placement = Placement.MIDDLE, val textStroke: BarLegendLabels.TextStroke = TextStroke(), val textShadow: Shadow = BarLegendDefaults.textShadow, var normalized: Boolean = BarLegendDefaults.normalized, var currentUnits: UnitType?, val formatter: (measurement: Measurement<UnitType>, index: Int) -> String = { measurement, idx ->
// Use the property directly to avoid capturing an old value
val targetUnit = currentUnits
val displayMeasurement = if (targetUnit != null && measurement.unit != targetUnit) {
measurement.converted(to = targetUnit)
} else {
measurement
}
val intValue = displayMeasurement.value.toInt()
// FIX: Resolve the symbol from the converted unit (targetUnit)
val symbol = targetUnit?.symbol ?: measurement.unit.symbol
if (idx == 0) "$intValue$symbol" else "$intValue"
})
Configures value annotations drawn on a BarLegend.
Link copied to clipboard
class BarLegendView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View
A custom Android View that draws a color bar legend.
Link copied to clipboard
interface ColorScaleUpdatable
A lightweight capability interface for legend types that can update their color scale at runtime.