The personal finance app for everyone (by everyone)
Ruby
fix(ds): chart flat-state — hairline trendline, not a bisecting rule (#2137) (#2150)
Guillem Arias Fauste6961c7ef41f4
diff --git a/app/javascript/controllers/time_series_chart_controller.js b/app/javascript/controllers/time_series_chart_controller.jsindex 1bf6f8d89c..1b8d672545 100644--- a/app/javascript/controllers/time_series_chart_controller.js+++ b/app/javascript/controllers/time_series_chart_controller.js@@ -140,7 +140,18 @@ export default class extends Controller {.attr("d", this._d3Line).attr("stroke-linejoin", "round").attr("stroke-linecap", "round")- .attr("stroke-width", this.strokeWidthValue);+ // A flat series (no variation across the period — a single valuation or an+ // unchanged balance) otherwise renders as a full-bleed near-black rule+ // bisecting the hero card. Draw it as a faint hairline so it reads as+ // "no change", consistent across light and dark (#2137).+ .attr("stroke-width", this._isFlatSeries ? 1 : this.strokeWidthValue)+ .attr("stroke-opacity", this._isFlatSeries ? 0.4 : 1);+ }++ get _isFlatSeries() {+ const min = d3.min(this._normalDataPoints, this._getDatumValue);+ const max = d3.max(this._normalDataPoints, this._getDatumValue);+ return min === max;}_installTrendlineSplit() {