Repository navigation
Conversation
β¦y granularity
Below daily granularity only the first x-axis tick carried the date, so on a
range longer than a day (e.g. last 7 days at 12 hour granularity) every later
tick repeated a bare time of day. getXAxisTickDateFormat now takes the chart's
range and, when it spans more than a day, formats every tick after the first
with the date and time ('short'). Ranges within a day are unchanged.
Follow-up to ClickHouse#3779, which fixed daily granularity and left this case out of
scope.
Fixes ClickHouse#3867
|
@jplorier is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @jplorier, thanks for the pull request! Before we review code from a first-time contributor, a maintainer vouches for them, and you're not on our list yet. There's nothing else to file and this PR stays open β a maintainer will look at it, usually within a day or two, and vouch for you right here if it's a genuine attempt at the problem. To make that quick, check the PR description has:
More detail in our contributing guide. |
π¦ Changeset detectedLatest commit: f6ca101 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
| }): DateFormat { | ||
| if (convertGranularityToSeconds(granularity) < SECONDS_PER_DAY) { | ||
| return index === 0 ? 'normal' : 'time'; | ||
| if (index === 0) return 'normal'; |
There was a problem hiding this comment.
π‘ P2 β On a multi-day range the first tick uses a different date-time format from every other tick
In the multi-day branch, return 'short' for index 0 as well, so the whole axis uses one date-time format. The daily-or-coarser branch below already does this. As written, the first tick still returns 'normal' (with seconds and a space before AM/PM), so the axis reads Nov 23 12:00:00 AM, Nov 23 12:00PM, Nov 24 12:00AM, β¦ (the PR description's own 'After' row shows this). Update the test at HDXMultiSeriesTimeChart.test.ts:1398 to expect 'short' for index 0.
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
PR Review
1 finding(s): π΄ 0 P0/P1 Β· π‘ 1 P2 Β· π΅ 0 P3 1 posted as inline comment(s) on the changed lines. 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. |
Deep Reviewβ No critical issues found. This is a small, well-scoped fix. Below daily granularity, π΅ P3 nitpicks (1)
Reviewers (6): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races. Testing gaps: none substantive β the new 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 |
Summary
Fixes #3867.
Below daily granularity, only the first x-axis tick of a time chart carried the date. On a range longer than a day (e.g. last 7 days at 12 hour granularity), every later tick repeated a bare time of day, so you had to hover to tell which day a point belongs to. #3779 fixed the daily-granularity case and called this one out as a separate follow-up.
getXAxisTickDateFormattakes an optionalrangeSeconds. Below daily granularity, when the range spans more than a day, every tick after the first uses the existingshortformat (date and time, e.g.Nov 24 12:00PM). The first tick keepsnormal. Ranges within a day, and every granularity of a day or coarser, are unchanged.MemoChartpasses the chart'sdateRangespan, so this covers every time chart (chart explorer, dashboard tiles, compact tiles).@hyperdx/apppatch.Screenshots or video
I couldn't capture screenshots from my setup. Tick labels as formatted, 12h clock, UTC, last 7 days at 12 hour granularity:
Nov 23 12:00:00 AM,12:00:00 PM,12:00:00 AM,12:00:00 PM, β¦Nov 23 12:00:00 AM,Nov 23 12:00PM,Nov 24 12:00AM,Nov 24 12:00PM, β¦How to reproduce
yarn app:dev:localconnected to the demo server.main, every tick after the first shows only a time. On this branch, every tick shows the date and time.Tests
npx jest src/HDXMultiSeriesTimeChart/__tests__/HDXMultiSeriesTimeChart.test.ts: 125 passed.yarn tsc --noEmitandyarn lint(oxlint + oxfmt) inpackages/app: pass.Note
Low Risk
UI-only label formatting in the time chart component with optional parameter preserving prior behavior when range is omitted or β€ one day.
Overview
Fixes ambiguous x-axis labels on time charts when the selected range spans more than one day at sub-daily granularity (e.g. last 7 days at 12-hour buckets). Previously, only the first tick showed the date; later ticks showed bare times that repeated across days.
getXAxisTickDateFormatnow accepts optionalrangeSeconds. For granularities finer than one day, if the range exceeds a day, every tick after the first uses theshortformat (date + time) instead oftimeonly. The first tick still usesnormal; single-day ranges and daily-or-coarser granularities are unchanged.MemoChartcomputes the span fromdateRangeand passes it into the x-axis tick formatter so chart explorer, dashboards, and compact tiles all pick up the behavior. Unit tests cover multi-day and within-a-day cases; changeset is a patch on@hyperdx/app.Reviewed by Cursor Bugbot for commit f6ca101. Bugbot is set up for automated code reviews on this repo. Configure here.