fix(tradein/v2): polish АНАЛИТИКА — растянуть scatter, клэмп оси к 0, честные легенды/бакеты, убрать фейк-тренд #2479

Merged
bot-backend merged 1 commit from fix/v2-analytics-polish into main 2026-07-12 14:37:06 +00:00

1 commit

Author SHA1 Message Date
bot-backend
b2bd827507 fix(tradein/v2): polish АНАЛИТИКА ДОМА — растянуть scatter, клэмп оси к 0, честные легенды/бакеты, убрать фейк-тренд
All checks were successful
CI / changes (pull_request) Successful in 7s
CI Trade-In / changes (pull_request) Successful in 9s
CI Trade-In / backend-tests (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Successful in 1m1s
Overlay 06 "АНАЛИТИКА ДОМА" had several display/chart defects vs the design:

- scatter "Цена × срок продажи" letterboxed into a narrow column
  (missing preserveAspectRatio="none", unlike the price-history svg).
- Y-domain wasn't clamped to 0 in buildScatterDetail AND buildScatterMini
  (same root-cause bug in both), so a thin/high price cluster could show
  a negative "−1M" axis tick.
- "сделки" legend/series rendered even with 0 deal points (Rosreestr ДКП
  always have days_on_market=null → never plotted) — now gated like the
  avito/yandex conditional legend.
- the "линия тренда" was a literal hardcoded x1/y1/x2/y2 line, entirely
  data-independent — removed (a real regression is a separate feature).
- bargainColor sign was inverted: it greened a price RISE, but the
  displayed bargainSigned value negates the raw pct, and the fixture
  (kpis[1], "−3.0%") greens the price-DROP case actually shown on screen.
- sell-time buckets ignored the backend insufficient_data flag; threaded
  it through SellTimeBucket -> SellTimeTier -> sellTimeTierValid so a
  bucket the backend calls too thin renders as "—", not a confident value.
- subject scatter point silently used a hardcoded 90-day fallback with no
  marker when est_days_on_market was null; now flagged (subjectApprox)
  and rendered as a dashed/lower-opacity estimate instead of passing off
  as measured data.
- sold_rate_pct lacked a Number.isFinite guard like the other formatters.
- PH_GRID_Y gridlines were unevenly spaced (last gap 40px vs 45px
  elsewhere); evened out and exported as the single source of truth so
  AnalyticsView's background gridlines can no longer drift from the
  yTick label positions (they previously duplicated the same y's as a
  second hardcoded literal).
2026-07-12 17:32:32 +03:00