Repository navigation
fix(app): show dates on x-axis ticks over multi-day ranges below daily granularity #3868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f6ca101
747d4cf
e623052
50d794b
3b40e14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: show the date on every x-axis tick of time charts below daily granularity | ||
| when the range spans more than a day (e.g. last 7 days at 12 hour granularity). | ||
| Those ticks repeated only the time of day after the first one; they now show the | ||
| date and time. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,7 +370,9 @@ const SECONDS_PER_DAY = 24 * 60 * 60; | |
|
|
||
| /** | ||
| * Format for an x-axis tick label. Below daily granularity the first tick | ||
| * carries the date and the rest only the time. At daily granularity or coarser | ||
| * carries the date and the rest only the time, unless the chart's range | ||
| * (`rangeSeconds`) spans more than a day: then the time of day repeats across | ||
| * ticks, so every tick carries the date and time. At daily granularity or coarser | ||
| * every tick carries the date, plus the time when the bucket does not start at | ||
| * midnight in `timeZone` (buckets are UTC-aligned, so this happens in most | ||
| * zones). An undefined `timeZone` means the browser's zone. | ||
|
|
@@ -380,14 +382,19 @@ export function getXAxisTickDateFormat({ | |
| index, | ||
| granularity, | ||
| timeZone, | ||
| rangeSeconds, | ||
| }: { | ||
| tickSeconds: number; | ||
| index: number; | ||
| granularity: string; | ||
| timeZone: string | undefined; | ||
| rangeSeconds?: number; | ||
| }): DateFormat { | ||
| if (convertGranularityToSeconds(granularity) < SECONDS_PER_DAY) { | ||
| return index === 0 ? 'normal' : 'time'; | ||
| if (index === 0) return 'normal'; | ||
| return rangeSeconds != null && rangeSeconds > SECONDS_PER_DAY | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 P2 — Multi-day sub-daily axis mixes When 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 |
||
| ? 'short' | ||
| : 'time'; | ||
| } | ||
| const wallClock = toWallClock( | ||
| new Date(tickSeconds * 1000), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 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