Repository navigation
Conversation
A zoomed scale has its range pinned through its min and max options, so it stops following the data. The range it would have without the zoom was stored once, at the first zoom or pan, and never looked at again. When the data changed while the chart was zoomed: - the 'original' limits kept the old range, so new data could not be reached by panning or zooming out, - getZoomLevel() and getInitialScaleBounds() described the old data. Before each layout that the plugin did not start itself, the zoomed scales now compute their range once more with the options they had before the zoom. Bounds given in the scale options are kept; only a bound the scale derives from the data is refreshed. The stored range of a scale that is not zoomed is dropped instead, since it is the range the scale already shows. The limits can now move away from under the current view, so a pan that brings the view back towards a limit is no longer refused; one that moves further past it still is.
The chart passes its options along when it initialises a scale, and a time scale takes `normalized` and its adapter's options from them. Initialising the scale without them left a zoomed time scale without `normalized` after an update. The check for bounds the application set on a zoomed scale is now one function, used both when the original limits are stored and when they are refreshed.
A scale without bounds of its own fits the data that is in view, so zooming x narrows y. The original range of a scale that was not zoomed was stored again at every zoom and pan, from whatever the scale showed at that moment. Zooming y after x therefore took the narrowed range as y's original: with 'original' limits y could never be zoomed back out to where it started, also after x was. The stored range of a scale that is not zoomed is now kept. It is taken when nothing is zoomed yet, and the refresh before a layout computes it with all zooms lifted, like the range of a zoomed scale. getZoomLevel() only counts the scales that are zoomed. A scale that merely fits what another scale's zoom leaves in view used to enter the result with a ratio against its range one step earlier.
The fitted y scale showed half of its range while x was zoomed to half, so the level was 2 whether or not y was counted. y now shows a quarter.
This branch has not been deployed
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.
Builds on #1008 and contains its commits until that is merged; the change here is the last commit.
A scale without bounds of its own fits the data that is in view, so zooming x narrows y. The original range of a scale that was not zoomed was stored again at every zoom and pan, from whatever the scale showed at that moment. Zooming y after x therefore took the narrowed range as y's original (#798):
limits: { y: { min: 'original', max: 'original' } }, y only zooms out to 0..50.What changes
getZoomLevel()only counts the scales that are zoomed. A scale that merely fits what another scale's zoom leaves in view used to enter the result with a ratio against its range one step earlier, which was not a meaningful number; with the range now kept, it would report the fitting as zoom.Cost
The refresh now also computes the scales that are not zoomed, when another scale is. A chart zoomed along x only therefore pays for a pass over the data of the y scale on each update that comes from the application, as a chart zoomed along both axes already did in #1008. Pan and zoom steps are not affected.
Median time of one call in milliseconds, measured the same way as in #1008 (headless Chromium, line chart without animation, timer resolution 0.1 ms),
masteragainst this branch:chart.update()master → PRFixes #798