Bar Legend Labels
constructor(values: BarLegendLabels.Values<UnitType>? = null, placement: BarLegendLabels.Placement = Placement.MIDDLE, textStroke: BarLegendLabels.TextStroke = TextStroke(), textShadow: Shadow = BarLegendDefaults.textShadow, normalized: Boolean = BarLegendDefaults.normalized, currentUnits: UnitType?, 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"
})