battery applet: add wattage history sparkline, sparkline supports signed data with auto-range

This commit is contained in:
Damocles 2026-04-24 21:14:32 +02:00
parent b5be146619
commit 42d11e7a14
4 changed files with 67 additions and 26 deletions

View file

@ -152,6 +152,24 @@ Column {
valueColor: root._stateColor
}
// Wattage history sparkline
SparklineCanvas {
visible: S.BatteryService.rateHistory.length > 1
anchors.left: parent.left
anchors.leftMargin: 12
anchors.right: parent.right
anchors.rightMargin: 12
height: 24
history: S.BatteryService.rateHistory
color: root._stateColor
active: root.active
maxSamples: 60
maxValue: null
minValue: null
backgroundTint: 0.08
colorFunction: v => v >= 0 ? S.Theme.base0B : root._stateColor
}
// Health row
InfoRow {
visible: S.BatteryService.healthSupported