feat: Liniendiagramm mit Nulllinie, runden Schritten und wählbarem Zeitraum

Die Achse richtete sich rein nach den Daten: Beschriftungen wie „-3'065.06" sind
nicht ablesbar, und ohne feste Null sah man die Bewegung, aber nicht, ob man im
Plus oder Minus steht.

- Die Skala schließt die Null immer ein und ist optisch hervorgehoben
- Runde Schritte (1, 2, 2.5, 5 x Zehnerpotenz): 0 / 2'000 / 4'000 … statt
  krummer Werte; nie feiner als ein Rappen, sonst entstünden bei leerem Konto
  Zwischenwerte wie 0,0025
- Vermögensverlauf: Zeitraum als Karten-Option (30 T / 90 T / 6 M / 1 J)

Gilt für jedes Liniendiagramm, nicht nur den Vermögensverlauf.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Guido
2026-08-21 09:59:36 +02:00
co-authored by Claude Opus 4.8
parent 511cf1abe0
commit ec0aa62017
4 changed files with 66 additions and 16 deletions
+16 -3
View File
@@ -63,9 +63,10 @@ function BudgetDonut({ props }) {
return <Donut segmente={data.segments} gesamtLabel={label} fmt={(v) => formatMoney(v, data.currency)} />;
}
function NetWorth() {
function NetWorth({ props }) {
const { t } = useTranslation();
const data = useData(() => api.cardNetWorth(90));
const tage = Number(props?.tage) || 90;
const data = useData(() => api.cardNetWorth(tage));
if (!data) return <Loading />;
const labels = (data.labels || []).map(shortDate);
const serien = [{ name: t("cards.assets"), color: tokenFarbe("--accent", "#3f51b5"), werte: data.values || [] }];
@@ -202,6 +203,17 @@ const AUFSCHLUESSELUNG = {
],
};
// Zeitraum des Vermögensverlaufs.
const ZEITRAUM = {
key: "tage", labelKey: "cards.range", def: "90",
choices: [
{ v: "30", labelKey: "cards.days30" },
{ v: "90", labelKey: "cards.days90" },
{ v: "180", labelKey: "cards.days180" },
{ v: "365", labelKey: "cards.days365" },
],
};
// Liste oder Kreis – dieselben Zahlen, zwei Lesarten: die Liste nennt jeden
// Anteil genau, der Kreis zeigt die Verteilung auf einen Blick.
const DARSTELLUNG = {
@@ -217,7 +229,8 @@ const DARSTELLUNG = {
export const KARTEN = {
"account-balances": { titleKey: "cards.balances", Comp: AccountBalances, w: 4, h: 5, minW: 3, minH: 3 },
"budget-donut": { titleKey: "cards.budgetDonut", Comp: BudgetDonut, w: 4, h: 5, minW: 3, minH: 4, options: [AUFSCHLUESSELUNG] },
"net-worth": { titleKey: "cards.netWorth", Comp: NetWorth, w: 8, h: 4, minW: 4, minH: 3 },
"net-worth": { titleKey: "cards.netWorth", Comp: NetWorth, w: 8, h: 4, minW: 4, minH: 3,
options: [ZEITRAUM] },
"budget-progress": { titleKey: "cards.budgetProgress", Comp: BudgetProgress, w: 4, h: 3, minW: 3, minH: 2, options: [AUFSCHLUESSELUNG] },
"expense-share": { titleKey: "cards.expenseShare", Comp: ExpenseShare, w: 4, h: 5, minW: 3, minH: 3,
options: [{ ...AUFSCHLUESSELUNG, def: "category" }, DARSTELLUNG] },