Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

fix: stop grouping assets in the pie chart into "others"group when there is only one asset. (#387)

Geovane Pereira10a5e6a7214e
diff --git a/frontend/src/pages/reports.tsx b/frontend/src/pages/reports.tsx
index eb366168..644f5888 100644
--- a/frontend/src/pages/reports.tsx
+++ b/frontend/src/pages/reports.tsx
@@ -437,12 +437,16 @@ export default function ReportsPage() {
const otherValue = Math.round((innerTotal - topSum) * 100) / 100
for (const item of significant) result.push(item)
if (otherValue > 0.005) {
- result.push({
- name: otherLabel(g),
- value: otherValue,
- color: OTHER_SLICE_COLOR,
- children: rest.length > 0 ? rest : undefined,
- })
+ if (rest.length === 1) {
+ result.push(rest[0])
+ } else {
+ result.push({
+ name: otherLabel(g),
+ value: otherValue,
+ color: OTHER_SLICE_COLOR,
+ children: rest.length > 0 ? rest : undefined,
+ })
+ }
}
}