feat: show total kWh instead of charge count in histograms

The charges screen histograms now display total energy charged (kWh)
per day/week/month instead of the number of charging sessions.

This is more useful for users with smart charging systems (like Octopus)
that optimize costs by splitting charging into multiple partial sessions.

Fixes #18

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Davide Ferrari
2026-01-10 11:54:57 +01:00
parent cff3ee95a4
commit 5c1bd0a509
@@ -606,9 +606,9 @@ private fun ChargesChart(
palette: CarColorPalette
) {
val title = when (granularity) {
ChartGranularity.DAILY -> "Charges per Day"
ChartGranularity.WEEKLY -> "Charges per Week"
ChartGranularity.MONTHLY -> "Charges per Month"
ChartGranularity.DAILY -> "Energy per Day"
ChartGranularity.WEEKLY -> "Energy per Week"
ChartGranularity.MONTHLY -> "Energy per Month"
}
Card(
@@ -641,8 +641,8 @@ private fun ChargesChart(
val barData = chartData.map { data ->
BarChartData(
label = data.label,
value = data.count.toDouble(),
displayValue = "${data.count} charges"
value = data.totalEnergy,
displayValue = "%.1f kWh".format(data.totalEnergy)
)
}
@@ -655,7 +655,7 @@ private fun ChargesChart(
barColor = palette.accent,
labelColor = palette.onSurfaceVariant,
showEveryNthLabel = labelInterval,
valueFormatter = { "%.0f charges".format(it) }
valueFormatter = { "%.1f kWh".format(it) }
)
}
}