fix(s2): use Spectrum 2 chart-size dash patterns for line types - #968
Open
c-lamoureux wants to merge 1 commit into
Open
c-lamoureux wants to merge 1 commit into
c-lamoureux wants to merge 1 commit into
Conversation
Named line types use per-chart-size dash and gap values compensated for round line caps. Custom dash arrays are treated as visible lengths at medium chart size and scale with chart size. Adds a resizable LineType chart size story. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Contributor
|
🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-968 🎨 S2 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-968-s2 📚 Docs -> https://opensource.adobe.com/react-spectrum-charts/PR-968-docs/ |
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.



Description
S2 line types now use Spectrum 2 dash and gap sizes for each chart size (S/M/L), compensated for round line caps.
Previously S2 reused S1 dash arrays, which were tuned for butt caps. With S2's round caps, every dash grew by the stroke width and every gap shrank by it (e.g.
twoDashgaps disappeared, dotted gaps were too tight), and patterns did not change with chart size.Changes
getStrokeDashFromLineType(S2) returns the medium-size visible lengths (dash including caps, gap) from a per-size design table.getChartSizeDashExprbuilds a Vega expression that picks the cap-compensated dash for the current chart size from therscChartSizeStrokeWidthsignal. Used for static line types and alternate segments (forecast).lineTypeuses a newlineTypeChartSizeordinal scale that mirrors thelineTypescale's domain with chart-size dash expressions.number[]line types are treated as visible lengths at medium chart size and scale with stroke width.strokeDashmoved fromentertoupdateso it reacts to resize.lineType.Rendered dash arrays (dash excluding caps, gap)
How Has This Been Tested?
getChartSizeDashes,getChartSizeDashExpr,getLineStrokeDash, alternate segments, and the new scale.stroke-dasharrayat S and L widths.React Spectrum Charts 2/Line/Features/Line Type Chart Size(resizable, one series per line type).Types of changes