feat: support custom arrays for sorting order#9840
Draft
joelostblom wants to merge 5 commits into
Draft
Conversation
Allow field definitions to use explicit sort arrays,\nmatching behavior that already exists for other sortable field channels.\nThis closes a long-standing inconsistency where custom order lists worked\nfor scale channels but not for mark ordering or stack ordering.\n\nImplement sort-array handling for order fields by generating derived\n formula fields during data parsing and by compiling\norder comparators to use those derived indexes. For multi-field order,\ninclude the order position in the derived field name so different sort\narrays can coexist without collisions.\n\nAlso update order encoding normalization so array-valued order channel\ndefinitions are retained instead of being dropped. Add targeted compile\ntests for calculate, mark sort, and stack sort paths to verify both\nsingle and multi-order array behavior.
When color or fill uses an explicit sort array, stacked and grouped order\nalignment should follow that array the same way it follows an explicit\nscale domain array. This keeps sort behavior consistent across discrete\nordering inputs and matches user expectations for stack ordering.\n\nIf an explicit order field is present and targets the same field as color,\nwe now inherit the color sort array when order.sort is unspecified instead\nof leaving order at its default. This allows specs that declare order for\nstack semantics to still respect color sort arrays.\n\nThis change also deduplicates stack-by field names when color and order\nreference the same field, and adds regression tests covering grouped\nbars, stacked bars, and inherited stack sort compilation.
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.
PR Description
WIP
Checklist
npm testruns successfullysite/docs/+ examples.Tips: