Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Component | Timeline: Enhancements and fixes #536

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

rokotyan
Copy link
Contributor

This PR introduces several improvements to the Timeline component:

New features:

  • Adds labelTextAlign config option to Timeline component to control label alignment
  • Timeline can now automatically calculate line and row widths if they were not provided
  • Adds configurable clip path extension to XYContainer

Fixes:

  • Improves Timeline component clipping behavior with dedicated clipPath
  • Fixes label positioning and width calculations

Refactoring:

  • Moves text alignment utility to a shared function textAlignToAnchor

Before. Setting xDomain lead to this:
SCR-20250219-ndmx

After:
SCR-20250219-neay

This commit introduces several improvements to the Timeline component and related utilities:

- Improves Timeline component clipping behavior with dedicated clipPath
- Adds `labelTextAlign` config option to Timeline component to control label alignment
- Moves text alignment utility to a shared function `textAlignToAnchor`
- Fixes label positioning and width calculations
- Makes Timeline automatically calculate line and row widths if they were not provided
- Adds configurable clip path extension to XYContainer
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from fbd4d48 to a10887e Compare February 20, 2025 15:13
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from b88d697 to 8899b8d Compare February 21, 2025 23:20
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch 2 times, most recently from 2ff25ee to 6ea2f2a Compare February 28, 2025 01:08
- Introduce a dedicated TimelineRowLabel type to encapsulate label data, including formatted labels.
- Added the `rowLabelStyle` config option.
- Update the `groupBy` utility to pass the index to the accessor.
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 6ea2f2a to 8bb8742 Compare February 28, 2025 01:35
- Introduce `TimelineArrow` types and render state interfaces in types.ts
- Add new arrow rendering group and data preparation logic in timeline/index.ts
- Implement arrowLinePath utility in utils/path.ts to generate customizable SVG arrow paths
- Add corresponding arrow style rules and theme variables in `timeline/style.ts`
- Update timeline configuration and default constants for arrow head dimensions in config.ts and constants.ts
- Re-export timeline types in src/types.ts
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 48ad3f0 to 8035c06 Compare March 4, 2025 16:41
Introduce a new timeline arrows example in the xy-components library that demonstrates arrow configuration between timeline rows.
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 8035c06 to 1b50ddc Compare March 4, 2025 16:41
rokotyan added 6 commits March 4, 2025 09:44
…ransitions

- Introduce new timeline config options animationLineEnterPosition and animationLineExitPosition in config.ts to control the starting and exit positions of animated lines.
- Update Timeline component to utilize these options, including support for functional configurations using the new isFunction import.
- Refactor label and rect transitions with smartTransition for smoother enter/exit animations.
- Adjust data bindings to use TimelineRowLabel keys for improved label rendering consistency.
… fix duration fallback

- Introduce a new timeline animation example with configurable enter/exit animation line positions.
- Update the timeline tooltip example to use TimelineRowLabel for enhanced type safety in tooltips.
- Adjust timeline component to apply a default duration of 1000 when none is provided.
… domain, and arrow exit transition

- Add a missing domain based on rowLabels to the ordinal scale for improved record mapping.
- Wrap bound data for both lineStartIcon and lineEndIcon selections to ensure single datum binding.
- Adjust arrow exit transition to fade out (opacity 0) before removal, correcting cleanup behavior.
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch 2 times, most recently from faff8c0 to 2cf7333 Compare March 12, 2025 20:21
- Added configurable hover style to timeline lines, changing stroke width and color on hover.
- Defined new CSS variables for hover stroke width and color, including dark theme variants.
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 2cf7333 to 1241041 Compare March 12, 2025 21:42
- Add a new `_rowIconsGroup` in the Timeline component to render icons before row labels, including position calculation using maximum icon size.
- Update the timeline configuration (`config.ts`) to include a rowIcon callback and adjust the `rowLabelFormatter` to receive the row index.
- Extend timeline types by introducing `TimelineRowIcon` and updating `TimelineRowLabel` to support `iconHref`, `iconSize`, and `iconColor`.
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 1241041 to 19c1dbe Compare March 13, 2025 21:08
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from 19c1dbe to a495444 Compare March 19, 2025 19:36
- Dummy arrow points to smooth transitions
- Make scrolling work when hovering over labels
- More robust bleed calculations
- Clip path transition
@rokotyan rokotyan force-pushed the fix/timeline-clipping branch from a495444 to dfaad01 Compare March 19, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant