Skip to content

feat(creator-economy): hover values on trend lines#1075

Merged
feruzm merged 4 commits into
developfrom
feature/ce-chart-hover
Jul 3, 2026
Merged

feat(creator-economy): hover values on trend lines#1075
feruzm merged 4 commits into
developfrom
feature/ce-chart-hover

Conversation

@feruzm

@feruzm feruzm commented Jul 3, 2026

Copy link
Copy Markdown
Member

Hovering a trend line on /creator-economy now reveals the exact values for the quarter under the cursor: a hairline, ringed dots on each series, and a fixed readout (quarter plus formatted values) at the chart's top left.

Pure-CSS visibility on the server-rendered SVG - no client JS added, and deliberately no svg title tooltips (this page's document title streams late, so naive first-title parsers would read a tooltip as the page title). Touch and keyboard users keep the full-precision tables as the accessible view.

Includes a LineChart spec covering the hover bands, readout contents, multi-series naming, and the no-title invariant. Suite green (1973).

Hovering a line chart now reveals the exact values for the quarter under the
cursor: a per-point hit band shows a hairline, ringed dots on each series and
a fixed readout (quarter plus formatted values) at the chart's top left.

Implementation is CSS-only visibility on server-rendered SVG - no client JS,
and no svg title tooltips (the document title streams late on this page, so a
first-title parser would read a tooltip as the page title; same reasoning as
the aria-hidden marks). Touch/keyboard users keep the full-precision tables,
which remain the accessible view of every chart.

Adds a LineChart spec (hover band per point, readout contents, multi-series
naming, no-title invariant).
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@feruzm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c26ab6a9-2f83-45d0-a524-2738562298f7

📥 Commits

Reviewing files that changed from the base of the PR and between 1e65b19 and 55f2b70.

📒 Files selected for processing (3)
  • apps/web/src/app/(staticPages)/creator-economy/_components/charts.tsx
  • apps/web/src/app/(staticPages)/creator-economy/page.tsx
  • apps/web/src/specs/features/creator-economy/line-chart.spec.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ce-chart-hover

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 289a9c8b94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +291 to +294
{series.map((s) =>
series.length > 1
? ` · ${s.name} ${valueFormatter(s.values[i] ?? 0)}`
: ` · ${valueFormatter(s.values[i] ?? 0)}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use full values in hover readouts

When the new hover labels render the current creator-economy trend charts, they reuse the same compact formatter as the sparse line labels (and the USD chart passes a compact formatter too). For any non-round value at or above 1,000, such as 119,762 posts or 1,051,139 comments in the bundled quarterly data, the hover readout shows rounded text like 120K/1.05M instead of the exact quarter value the feature advertises, so users still have to leave the chart for the table to see the precise value. Use a separate full-value hover formatter or bypass formatCompact for this readout.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a pure-CSS hover interaction to the LineChart component on the /creator-economy page. Hovering a trend-line band reveals a hairline crosshair, ringed dots on each series, and a fixed readout showing the exact quarter values — all implemented as server-rendered SVG with no client JS added.

  • Hover bands: one transparent <rect> per data point acts as the hit target; CSS :hover on the parent .ce-hband flips .ce-hlbl from opacity: 0 to opacity: 1, revealing the crosshair and readout text.
  • Readout formatting: a separate readoutFormatter prop (defaulting to formatFull) decouples the full-precision hover text from the compact on-chart labels; the USD chart in page.tsx prefixes it with $.
  • Spec: new line-chart.spec.tsx covers band count, readout contents, multi-series naming, and the no-SVG-title invariant.

Confidence Score: 5/5

Safe to merge — changes are limited to static SVG rendering with pure-CSS hover logic and no runtime data mutations.

All changes are additive SVG/CSS with zero client-side JS. The hover mechanism relies on a well-understood CSS :hover + opacity pattern on server-rendered markup. The new spec suite validates the key invariants. The only finding is a stale JSDoc string that no longer matches the no-title design documented throughout the rest of the file.

The file-level JSDoc in charts.tsx still references SVG title tooltips and should be updated to match the rest of the file's documented intent.

Important Files Changed

Filename Overview
apps/web/src/app/(staticPages)/creator-economy/_components/charts.tsx Adds pure-CSS hover bands (ce-hband/ce-hlbl) to LineChart; renders one transparent rect per data point and reveals a hairline, ringed dots, and a fixed readout on :hover. The file-level JSDoc still says marks carry title tooltips, contradicting the design decision this PR documents everywhere else.
apps/web/src/app/(staticPages)/creator-economy/page.tsx Adds CSS rules for hover-band visibility and passes readoutFormatter to the USD LineChart for full-precision dollar formatting. Minimal and clean.
apps/web/src/specs/features/creator-economy/line-chart.spec.tsx New spec covers hover-band count, per-point readout content, multi-series name rendering, and the no-title invariant. All assertions are well-targeted.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    SSR["Server renders SVG\n(LineChart)"]
    SSR --> BANDS["N x ce-hband groups\n(one per label)"]
    BANDS --> RECT["transparent rect\nfill='transparent'\n captures pointer events"]
    BANDS --> HLBL["ce-hlbl group\nopacity:0, pointer-events:none\n invisible, non-interactive"]
    HLBL --> HAIRLINE["vertical hairline\nat px(i)"]
    HLBL --> DOTS["series dots\ncircle r=4 per series"]
    HLBL --> READOUT["readout text\nquarter + readoutFormatter(value)"]
    HOVER["cursor enters rect"]
    HOVER --> CSSHOVER[".ce-hband:hover"]
    CSSHOVER --> SHOW["ce-hlbl: opacity 1\n(transition 0.1s)"]
    SHOW --> VISIBLE["hairline + dots + readout visible"]
    LEAVE["cursor leaves rect"]
    LEAVE --> HIDE["ce-hlbl: opacity 0"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    SSR["Server renders SVG\n(LineChart)"]
    SSR --> BANDS["N x ce-hband groups\n(one per label)"]
    BANDS --> RECT["transparent rect\nfill='transparent'\n captures pointer events"]
    BANDS --> HLBL["ce-hlbl group\nopacity:0, pointer-events:none\n invisible, non-interactive"]
    HLBL --> HAIRLINE["vertical hairline\nat px(i)"]
    HLBL --> DOTS["series dots\ncircle r=4 per series"]
    HLBL --> READOUT["readout text\nquarter + readoutFormatter(value)"]
    HOVER["cursor enters rect"]
    HOVER --> CSSHOVER[".ce-hband:hover"]
    CSSHOVER --> SHOW["ce-hlbl: opacity 1\n(transition 0.1s)"]
    SHOW --> VISIBLE["hairline + dots + readout visible"]
    LEAVE["cursor leaves rect"]
    LEAVE --> HIDE["ce-hlbl: opacity 0"]
Loading

Reviews (2): Last reviewed commit: "docs: chart header no longer claims titl..." | Re-trigger Greptile

Comment thread apps/web/src/app/(staticPages)/creator-economy/_components/charts.tsx Outdated
ecency added 3 commits July 3, 2026 11:34
- Readouts now show full-precision values (readoutFormatter, default
  formatFull; USD keeps its dollar prefix) - the compact formatter defeated
  the point of the feature (Codex).
- Hover dot r=4 matches the permanent end dot, removing the layered-radius
  mismatch on the last point (Greptile).
- Readout drops to y=20 and wears a surface-color halo (paint-order stroke)
  so it stays legible even when a long readout crosses the peak label
  (Greptile).
- ColumnChart accepts-and-ignores readoutFormatter for Trend prop parity.
@feruzm feruzm merged commit eb39f8f into develop Jul 3, 2026
6 checks passed
@feruzm feruzm deleted the feature/ce-chart-hover branch July 3, 2026 11:40
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