Skip to content

fix(insights): adaptive Y-axis on the Brand vs Competitors chart - #37

Merged
gkhngyk merged 1 commit into
mainfrom
feat/insights-adaptive-y-axis
May 18, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feat/insights-adaptive-y-axis

Conversation

@gkhngyk

@gkhngyk gkhngyk commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Visibility scores are theoretically 0–100 but realistic values for most brands cluster in the 5–30 band. Pinning the Y-axis to 100 made every bar look uniformly stubby and killed the perceived difference between, say, 8 and 22.
  • The chart now rescales the Y-axis upward with 30% headroom, snapped to a "nice" tick value so gridlines stay clean. A floor of 20 keeps very low values from looking absurdly zoomed (a 3-point chart shouldn't fill the canvas either).

Before / after

Scenario Old Y-axis New Y-axis
All brands 5–15 pts 0–100 (bars use ~15% of canvas) 0–20 (bars use ~75% of canvas)
One brand at 45 pts 0–100 0–60 (45 × 1.3 = 58.5 → snaps to 60)
Highest brand 75 pts 0–100 0–100 (75 × 1.3 = 97.5 → snaps to 100)
No data 0–100 0–20 (floor protects against absurd zoom)

Scope

  • Touches only `CompetitorChart` (`AI Visibility — Brand vs Competitors` card on /dashboard/insights) — that's the one with visible squish.
  • `VisibilityTrend` and `SoVTrend` charts still pin to 0–100 and can adopt the new `niceVisibilityYMax` helper as a follow-up.
  • "%" suffix on tick labels is kept as-is for this change — that label is a separate copy concern (visibility score is a 0–100 weighted score, not strictly a percentage).

Test plan

  • Open /dashboard/insights with a brand where competitor scores are all under 20 → bars are visibly proportional, Y-axis maxes at 20.
  • Same page with a brand where at least one score is in the 40s → Y-axis maxes at 60.
  • Empty/loading state still renders cleanly without zero-division weirdness.
  • Tooltip values unchanged; sorting / legend unaffected.

Visibility scores are theoretically 0-100 but realistic values for most
brands cluster in the 5-30 band. Pinning the Y-axis to 100 made every
bar look uniformly stubby and killed the perceived difference between,
say, 8 and 22 — the chart was filling ~15% of its canvas and bar-to-bar
comparison was effectively unreadable.

Now the Y-axis rescales upward with 30% headroom, snapped to a "nice"
tick (20 / 25 / 30 / 40 / 50 / 60 / 80 / 100) so gridlines stay clean.
A floor of 20 keeps very low values from looking absurdly zoomed (a
3-point chart shouldn't fill the canvas either). The "%" suffix on
tick labels is kept as-is for this change — that label is a separate
copy concern.

Only applies to CompetitorChart for now; VisibilityTrend and
SoVTrend still pin to 0-100 and can adopt the same helper later.
@gkhngyk
gkhngyk merged commit d72dcf0 into main May 18, 2026
2 checks passed
@gkhngyk gkhngyk mentioned this pull request May 26, 2026

This branch was successfully deployed

1 active deployment
Preview — aebb22a2 Deployed May 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant