Skip to content

feat: add data and axes transforms#25

Open
zao111222333 wants to merge 1 commit intodonkeyteethUX:mainfrom
zao111222333:main
Open

feat: add data and axes transforms#25
zao111222333 wants to merge 1 commit intodonkeyteethUX:mainfrom
zao111222333:main

Conversation

@zao111222333
Copy link
Copy Markdown
Contributor

I add a coordinate transform layer so series and reference lines can choose how their x/y values are interpreted before drawing. Normal data transforms run before the plot's axis scale, while Transform::axes() uses normalized plot coordinates where 0.0 is the low edge and 1.0 is the high edge.

This makes it possible to render data-converted series, fixed-position overlays, mixed data/axes coordinates, and transformed reference lines without changing the plot's global axis scale. Axes-coordinate geometry stays fixed during pan and zoom and is excluded from autoscale bounds.

Key changes:

  • Add CoordinateSystem, Transform, and PositionTransform
  • Support identity, affine, log, exp, composed, and axes-coordinate transforms
  • Route AxisScale conversion through the shared transform implementation
  • Add per-series transform APIs, including x/y-specific transforms and with_axes_transform
  • Add transform support for VLine and HLine
  • Apply transforms consistently in plot state, fills, highlights, tooltips, and both shader/canvas renderers
  • Rebuild dynamic axes-coordinate geometry when camera or bounds change
  • Display axes-coordinate tooltip values as percentages
  • Add examples/transform.rs covering data, composed, axes, mixed-axis, and reference-line transforms:
Screen.Recording.2026-05-06.at.22.35.25.mov

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