Opti: weekly timeline chart#580
Merged
ximu3 merged 1 commit intoximu3:mainfrom May 3, 2026
Merged
Conversation
Render 4h tick lines on the weekly timeline while keeping labels only on day boundaries and 12h midpoints. Use stronger opacity for day boundaries, medium opacity for midpoints, and weaker opacity for minor ticks.
There was a problem hiding this comment.
Pull request overview
This PR optimizes the weekly timeline chart’s X-axis tick density and visual hierarchy to improve readability of the scale markers.
Changes:
- Increased X-axis tick granularity from 12 hours to 4 hours.
- Adjusted tick label rendering to show only day-boundaries and midpoints.
- Updated vertical reference line opacity based on whether a tick is a day-boundary, midpoint, or minor tick.
Comments suppressed due to low confidence (1)
src/renderer/src/pages/Record/WeeklyReport.tsx:406
isDayBoundary/isMidpointare computed viatick % oneDay/tick % twelveHours, which will misclassify boundaries when the week crosses a DST transition (since the local day length isn’t 24h in ms). It will also potentially skip labeling the true day boundary because thetickoffsets won’t land exactly on multiples ofoneDay. Prefer checking the computeddate(e.g.,date.getHours() === dayBoundaryHour && date.getMinutes() === 0for day boundary, and a similar check for the midpoint) rather than relying on fixed millisecond modulo.
const tick = Number(t)
const isDayBoundary = tick % oneDay === 0
const isMidpoint = tick % twelveHours === 0
if (!isDayBoundary && !isMidpoint) return ''
const date = new Date(tick + weekStartTime)
const hour = date.getHours()
const minute = date.getMinutes()
const hours = String(hour).padStart(2, '0')
const minutes = String(minute).padStart(2, '0')
if (isDayBoundary) {
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${month}-${day}`
} else {
return `${hours}:${minutes}`
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
优化了时间线图表的刻度显示