Repository navigation
Conversation
Time charts spanning a year or more now place x-axis ticks on month starts
labelled like 'Mar 2024', and tooltips include the year ('2024-03-18' for
daily or coarser buckets). Shorter ranges keep their existing formats.
Co-authored-by: Mike Shi <mike@hyperdx.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| if (!isYearScaleRange(dateRange)) { | ||
| return 'normal'; | ||
| } | ||
| return convertGranularityToSeconds(granularity) >= SECONDS_PER_DAY |
There was a problem hiding this comment.
🔴 P1 — isoDate tooltip shows the wrong day for UTC-aligned daily buckets in zones west of UTC
Buckets are UTC-aligned (see the getXAxisTickDateFormat doc and its midnight check just below). So in America/New_York the 1 day bucket at 2025-11-08T00:00Z gets the tooltip 2025-11-07, with no time to show the shift, where main showed Nov 7 7:00:00 PM. Apply the same midnight-in-zone check the x-axis uses: return isoDate only when the label is at local midnight, otherwise withYear. That means getTooltipDateFormat needs the label seconds and the time zone, or it should return a formatter. Also add a non-UTC test case; the current tests only use dateRange and granularity.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
There was a problem hiding this comment.
Fixed in a250f8b. The tooltip now uses isoDate only when the bucket starts at midnight in the display zone, using the same check as the x-axis. Otherwise it shows withYear, so a New York user sees Nov 7 2025 7:00:00 PM. I added non-UTC test cases.
| minTickGap={100} | ||
| minTickGap={xAxisTicks ? MONTH_TICK_MIN_GAP_PX : 100} | ||
| tick={ | ||
| compactXAxisLabels |
There was a problem hiding this comment.
🟡 P2 — Compact x-axis anchoring assumes the first and last ticks sit at the plot edges, which month-start ticks do not
renderCompactXTick uses compactTickAnchor, which left-anchors the first tick and right-anchors the last. With getMonthStartTicks those ticks are inside the plot (e.g. Jan 2025 on a Nov 2024–Nov 2026 range), so their labels drift off their tick marks. This is used via compactXAxisLabels (TraceRedMetricsChart). Center the labels when xAxisTicks is set, or anchor only ticks that fall on the domain bounds.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Fixed in a250f8b. Compact labels stay centered when month-start ticks are in use. Recharts' preserveStartEnd still shifts an edge label inward if it would overflow.
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 1 P3 1 posted as inline comment(s) on the changed lines. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
AI review gate — AI review passedClean review from: Cursor Bugbot. |
E2E Test Results✅ All tests passed • 478 passed • 1 skipped • 1064s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. This is a presentation-only change (x-axis tick + tooltip date labels for charts spanning ≥ 1 year) with no auth, data, query, or contract surface touched. Both prior Cursor Bugbot findings (year-scale tooltip date, compact-tick edge clipping) are confirmed resolved in the current HEAD. The new date math is well covered by unit tests, including DST and non-UTC zones. 🟡 P2 — recommended
🔵 P3 nitpicks (5)
Reviewers (10): correctness, adversarial, testing, maintainability, project-standards, agent-native, learnings-researcher, kieran-typescript, julik-frontend-races, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
…cal midnight UTC-aligned daily buckets start before midnight in zones west of UTC, so a date-only tooltip named the previous day. Show the date only when the bucket starts at midnight in the display zone, and center compact x-axis labels on month-start ticks. Co-authored-by: Mike Shi <mike@hyperdx.io>
🦋 Changeset detectedLatest commit: fa6af2f The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| granularity, | ||
| timeZone: displayTimeZone, | ||
| }), | ||
| [dateRange, granularity, displayTimeZone], |
There was a problem hiding this comment.
🟡 P2 — Making the tooltip callback depend on the dateRange array undoes the memoized tooltip element
getTooltipLabelDateFormat depends on dateRange. DBTimeChart.tsx:224 notes the tile config is a fresh object on every render, and useTimeChartSettings memoizes on that config, so dateRange is a new array each time the parent renders. That rebuilds the tooltip content element whose memo exists to avoid exactly this (comment at MemoChart.tsx:613). Fix: depend on the yearScale boolean (already computed at line 468) plus granularity and time zone, and pass yearScale to the helper instead of dateRange.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Fixed in fa6af2f. getTooltipDateFormat now takes the yearScale boolean, and the resolver depends on yearScale, granularity and time zone instead of the dateRange array.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a250f8b. Configure here.
…emo stable Compact month-start labels that land on a domain bound are anchored to it again so they don't clip. The tooltip format resolver now depends on the year-scale flag rather than the dateRange array, which is a new array on each parent render. Co-authored-by: Mike Shi <mike@hyperdx.io>
| }: XAxisTickContentProps) => { | ||
| const textAnchor = compactTickAnchor(index, visibleTicksCount); | ||
| const tickSeconds = Number(payload.value); | ||
| const textAnchor = |
There was a problem hiding this comment.
🟡 P2 — Compact mode centres month ticks that sit near, but not on, a domain bound, so edge labels clip on narrow charts
Compact mode exists so edge labels stay inside narrow plots, such as the side-by-side RED tiles. With month ticks, only a tick exactly equal to xAxisDomain[0] or xAxisDomain[1] keeps the start/end anchor. Take "Last 1 year" ending Nov 25: the last tick is Nov 1, about 6% of the plot width from the right edge, roughly 18px on a 300px plot. A centred label like Nov 2026 (about 55px) then runs past the SVG's right edge. Fix: keep compactTickAnchor for the first and last ticks whenever the tick is within half a label width (or about 50px) of the plot bound, and centre only the interior ticks.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Auto-approved by the AI review gate on fa6af2f. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|

Summary
Time charts covering a year or more were hard to read. X-axis ticks left out the year and sometimes included a time of day, because Recharts' automatic time ticks land at arbitrary instants on our seconds-valued axis. Hover and pinned tooltips also left out the year.
When the chart's date range is at least a year:
Mar 2024. The step (1/2/3/6/12… months) is the smallest one that fits the plot width. Recharts'minTickGapis lowered for these ticks so it doesn't drop some of them and leave the rest unevenly spaced. Compact-mode labels stay centered on these ticks.2024-03-18for daily or coarser buckets that start at midnight in the display zone. Otherwise they show the date, year, and time, for exampleNov 7 2025 7:00:00 PMfor a UTC-aligned bucket viewed in New York. A date alone would name the previous day there without saying so.Shorter ranges keep their current formats. The new
monthYearandisoDateformats are added toformatDatein common-utils.Screenshots or video
Dashboard tile, count of 2 years of synthetic logs, auto granularity, UTC:
Same point in America/New_York (after), where the bucket starts at 7 PM local time:
Expanded tile (after):
Last 7 days, unchanged (after):
How to reproduce
Starting point:
yarn devwith synthetic logs spread over 2 years inotel_logs. The local table has a 1-day TTL, so remove it first (ALTER TABLE default.otel_logs REMOVE TTL). Any source with data covering a year or more also works.On
main:Nov 13,Jul 11with no year, and hovering showsNov 8 12:00:00 AM.On this branch:
Jan 2025,Jul 2025,Jan 2026, … and in UTC the hover and pinned tooltips read2025-11-08.Nov 7 2025 7:00:00 PM.main.How to test on Vercel preview
Preview routes: /chart
Steps:
Jan 2026) and no time of day.References
Fixes HDX-6198
Note
Low Risk
Chart labeling and formatting only; shorter time ranges keep existing behavior, with substantial unit test coverage for timezone and tick logic.
Reviewed by Cursor Bugbot for commit fa6af2f. Bugbot is set up for automated code reviews on this repo. Configure here.