Repository navigation
Conversation
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.
Threshold-based ramp legends label their ticks with the raw threshold values, so a quantile scale (which is internally converted to a threshold scale) shows the raw quantiles:
labels the ticks
0.8571428571428571,1.7142857142857142, …, while the corresponding axis ticks and tip values are formatted withformatDefault. The same happens with an explicitthresholdscale, where a threshold of2000is labelled2000instead of2,000.This changes the default
tickFormatof threshold legends (which also serve quantile and quantize scales) from the identity toformatDefault, the formatter already used for axis ticks. An explicittickFormat— a d3-format string, a function, ornullto hide the labels — still takes precedence.Tests
test/legend-test.jsgains four cases: quantile labels are formatted, threshold labels are formatted, an explicittickFormatstring is respected, andtickFormat: nullstill hides the labels.Without the change, the two formatting tests fail:
With it,
npx vitest run test/legend-test.jspasses (8/8). The committed snapshottest/output/penguinQuantileUnknown.htmlis updated accordingly (3475becomes3,475, and so on), which is the only snapshot that changes.The full suite (
npx vitest run) was run before and after the change; the failures in both runs are the same pre-existing, environment-specific ones (test/docs-test.jsnetwork anchors,test/plots/time-axis.tslocal time zone, and canvas raster snapshots), and they also fail on an unmodified checkout.npx eslintandnpx tscpass.Fixes #2345.
AI was used to write this code.