This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
Plot: avoid timeseries downsample if we are already below display limit #7333
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.
User-Facing Changes
Fix bug where zooming into a plot would unnecessarily downsample datums extremely close together.
Description
This change updates the TimestampDatasetsBuilderImpl to avoid doing a downsample if we are already under the viewport size for the number of items we want to display. While this does technically create a dataset that could have multiple datums at the same pixel coordinate, this is a tradeoff to avoid downsample rounding errors for extremely close datums at different zoom levels.
As the user zooms in, we might resolve these datums to the same pixel or different pixels based on rounding - even though in absolute terms they are further apart (i.e. going from 0.42 to 0.477 distance apart). This tends to be most obvious once you've already zoomed to a point where data was displayed without downsampling but then zooming in again changes the rounding and the logic would think the data is downsampled. In practice, the purpose of downsampling is to avoid rendering too many datums on a plot since rendering takes time. But when the dataset is already so small that it is under our viewport size and max point threshold then there's no reason to run downsampling and we can display all the datums regardless of whether they would appear at the same pixel or not.