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.
Without this change,
determineUnit
is broken when specifyingsource:'data'
(and often withsource:'labels'
though typically less noticeably).determineUnit
figures out how far apart to put the ticks when generating auto-ticks. This isn't necessarily the unit we want to use for formatting.E.g. consider the image below with
source:data
. If you setsource:'auto'
then it will generate a tick for every month. The code was thus trying to format the ticks with month formatting. However, when we havesource:'data'
set we have more than just monthly ticks, so we should use the appropriate formatter.The
determineUnitForAutoTicks
,determineStepSize
, etc. methods will be able to be deleted in a future PR and replaced with a fixed ratio as discussed with @simonbrunel over Slack. I didn't want to do that as part of this change as they're separable tasks and it would make the change too large to easily test and review. We will need thedetermineUnitForFormatting
in both cases.You can see this fix by looking at
samples/scales/time/financial.html
Before:
After: