Skip to content

Commit 96b3bac

Browse files
committed
feat(web): have lines start at zero
1 parent 9fe0a24 commit 96b3bac

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎ledger/cmd/webHandlerReport.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,14 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
442442
}
443443
sort.Strings(lData.AccountNames[1:])
444444

445+
// For line, set origin value
446+
if rConf.Chart == "line" && len(rangeBalances) > 0 {
447+
lData.Labels = append([]string{rangeBalances[0].Start.Format(time.DateOnly)}, lData.Labels...)
448+
for dIdx := range lData.DataSets {
449+
lData.DataSets[dIdx].Values = append([]decimal.Decimal{decimal.Zero}, lData.DataSets[dIdx].Values...)
450+
}
451+
}
452+
445453
// Radar chart flips everything. Dates are each dataset and the accounts become the labels
446454
if rConf.Chart == "radar" {
447455
dates := lData.Labels

0 commit comments

Comments
 (0)