Merged
Conversation
|
|
||
| // Align bucket start to round intervals (e.g., start of minute/hour) | ||
| const alignedMinX = Math.floor(minX / bucketSizeMs) * bucketSizeMs; | ||
| const numBuckets = Math.ceil((maxX - alignedMinX) / bucketSizeMs); |
Contributor
There was a problem hiding this comment.
Bug: Zero buckets causes data loss and undefined key access
When all data points share the same timestamp that's exactly aligned to a bucket boundary (e.g., precisely on the minute), and there are more than 50 points, numBuckets computes to 0 via Math.ceil((maxX - alignedMinX) / bucketSizeMs). This causes displayTimestamps to be empty, bucketIndex to be -1, and displayTimestamps[bucketIndex] to be undefined. Data then gets keyed by undefined in the map, and the resulting table has no data rows since iteration over empty displayTimestamps produces nothing.
Additional Locations (1)
aliu39
approved these changes
Dec 10, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Before when getting values for on-page charts, we'd sample the value at each timestamp. This could accidentally miss spikes.
Now, we choose an interval and sum data within each interval to more accurately represent the data being shown.
Closes AIML-2016