feat(market): optional price-trend sparkline per portfolio group

Add a per-group "Sparkline" toggle (live-market bases only, like 24h). When on,
the group card draws a faint price-trend line in its lower band — the group's
value tracks the DRGX price, so it plots the market price_history (normalized),
colored green/red by overall direction. Behind the text so amounts stay
readable. The editor's live preview reflects it too.

Persisted as show_sparkline in settings.json; wired through PortfolioEntry +
the editor working state + the pfDrawSparkline() helper shared by card+preview.

Full-node + Lite build clean; ctest 1/1; hygiene clean. Rendering change —
needs a screenshot check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-03 01:15:23 -05:00
parent b0ded528b1
commit b26aff392b
4 changed files with 51 additions and 0 deletions

View File

@@ -330,6 +330,8 @@ bool Settings::load(const std::string& path)
entry.showValue = e["show_value"].get<bool>();
if (e.contains("show_24h") && e["show_24h"].is_boolean())
entry.show24h = e["show_24h"].get<bool>();
if (e.contains("show_sparkline") && e["show_sparkline"].is_boolean())
entry.showSparkline = e["show_sparkline"].get<bool>();
if (!entry.label.empty()) portfolio_entries_.push_back(std::move(entry));
}
}
@@ -487,6 +489,7 @@ bool Settings::save(const std::string& path)
entry["show_drgx"] = e.showDrgx;
entry["show_value"] = e.showValue;
entry["show_24h"] = e.show24h;
entry["show_sparkline"] = e.showSparkline;
j["portfolio_entries"].push_back(std::move(entry));
}
j["font_scale"] = font_scale_;