Skip to content

Commit a9a26db

Browse files
committed
backend: adjust chart display to start from zero after first tx
This commit modifies the chart display after the initial transaction. Previously, the chart would begin at the first fiat value of the transaction, resulting in only one data point visible in the middle of the chart. With this update, the chart now starts at zero, providing a better view of the data.
1 parent 7443c53 commit a9a26db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

backend/chart.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,13 @@ func (backend *Backend) ChartData() (*Chart, error) {
282282
FormattedValue: coin.FormatAsCurrency(currentTotal, isFiatBtc, formatBtcAsSat),
283283
})
284284
}
285-
286-
// Truncate leading zeroes.
285+
// Truncate leading zeroes, if there are any keep the first one to start the chart with 0
287286
for i, e := range result {
288287
if e.Value > 0 {
289-
return result[i:]
288+
if i == 0 {
289+
return result
290+
}
291+
return result[i-1:]
290292
}
291293
}
292294
// Everything was zeroes.

0 commit comments

Comments
 (0)