Add renderer-neutral radial gradients #147
Merged
tannerlinsleymerged 36 commits into
main fromtaren/add-radial-gradients·merged by tannerlinsley Summary#
- Add ChartRadialGradient to the renderer-neutral chart and scene resource contract.
- Render scoped radial resources in SVG and React Native.
- Paint exact objectBoundingBox radial fills in Canvas, including elliptical results on non-square bounds.
- Normalize linear coordinates and authored gradient stop order consistently across renderers.
- Replace keyed gradient resources synchronously during linear-to-radial changes so duplicate IDs never exist.
Canvas boundary#
Canvas radial gradients support fills. Radial strokes throw a clear error because a nonuniform objectBoundingBox transform would distort stroke width. SVG and React Native support radial fills and strokes.
Validation#
- Cache-free pnpm validate on Node 24.18.0.
- Focused renderer suite: 8 files, 196 tests.
- Chromium Canvas versus rasterized SVG parity, including non-square bounds and decreasing stops.
- Package, declaration, bare and Expo Metro, docs, catalog, bundle, and comparison gates pass.
Release#
- Minor changesets for @tanstack/charts and @tanstack/react-native-charts. The fixed package group propagates the release to the framework adapters.
Closes #129
Summary by CodeRabbit#
New Features
- Added radial gradient support across SVG, Canvas, and React Native renderers.
- Added shared gradient types and exports for linear and radial resources.
- Added normalized coordinate handling, stop clamping, and radial-gradient animation support.
- Canvas supports radial fills; radial strokes remain unsupported.
Documentation
- Updated gradient references, rendering guidance, examples, and bundle-size measurements.
- 1
View your CI Pipeline Execution ↗ for commit 2e038b0796087f2d9d6fb0477cd7658ed17e543b
Command Status Duration Result nx run charts-workspace:ci-distributed✅ Succeeded <1s View ↗ nx run charts-workspace:package-check✅ Succeeded <1s View ↗ nx run charts-workspace:benchmark-check✅ Succeeded <1s View ↗
☁️ Nx Cloud last updated this comment at
2026-09-10 04:57:11UTCtannerlinsley merged this956d08e
tannerlinsley closed this
Sign in to join this conversation.
Warning
Review limit reached#
Next included review available in 30 minutes.
Check out review usage here.
View limit details
Limit details: You’ve used all 4 included reviews currently available.
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
ef84d747-1da3-4794-bbde-42c5f8a96178📥 Commits
Reviewing files that changed from the base of the PR and between f175e63a930955c8edb3ba0e959b7b7f3a3b9278 and 4bd80210fc9464ece1b451afe6c58e888406660d.
📒 Files selected for processing (31)
API-FRICTION.mdbenchmarks/bundle-size/README.mdbenchmarks/bundle-size/universal-baseline.jsonbenchmarks/comparison/bundle-baseline.jsonbenchmarks/conformance/previews/manifest.jsondocs/comparison.mddocs/guides/bundle-size-and-performance.mddocs/guides/themes-and-styling.mddocs/reference/chart-spec.mddocs/reference/runtime-and-scene.mddocs/reference/scales-guides-and-color.mddocs/reference/types.mdpackages/charts-core/docs/comparison.mdpackages/charts-core/docs/guides/bundle-size-and-performance.mdpackages/charts-core/docs/guides/themes-and-styling.mdpackages/charts-core/docs/reference/chart-spec.mdpackages/charts-core/docs/reference/runtime-and-scene.mdpackages/charts-core/docs/reference/scales-guides-and-color.mdpackages/charts-core/docs/reference/types.mdpackages/charts-core/src/canvas.test.tspackages/charts-core/src/canvas.tspackages/charts-core/src/export.test.tspackages/charts-core/src/index.tspackages/charts-core/src/motion.test.tspackages/charts-core/src/svg-renderer.test.tspackages/charts-core/src/types.tspackages/charts-core/src/universal-types.tspackages/react-native-charts/src/Chart.test.tsxpackages/react-native-charts/src/SvgScene.test.tsxpackages/react-native-charts/src/SvgScene.tsxscripts/measure-bundles.mjsNo actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
29528c12-c02d-45e7-92a2-2aa723599cee📥 Commits
Reviewing files that changed from the base of the PR and between 32e3c739eace1f69ec116299ea6fba70973c7c59 and f175e63a930955c8edb3ba0e959b7b7f3a3b9278.
📒 Files selected for processing (41)
.changeset/add-radial-gradients.mdAPI-FRICTION.mdbenchmarks/bundle-size/README.mdbenchmarks/bundle-size/universal-baseline.jsonbenchmarks/comparison/bundle-baseline.jsonbenchmarks/conformance/previews/manifest.jsondocs/comparison.mddocs/examples/themes-and-motion.mddocs/guides/bundle-size-and-performance.mddocs/guides/themes-and-styling.mddocs/reference/chart-spec.mddocs/reference/rendering-and-export.mddocs/reference/runtime-and-scene.mddocs/reference/scales-guides-and-color.mddocs/reference/types.mdpackages/charts-core/docs/comparison.mdpackages/charts-core/docs/examples/themes-and-motion.mdpackages/charts-core/docs/guides/bundle-size-and-performance.mdpackages/charts-core/docs/guides/themes-and-styling.mdpackages/charts-core/docs/reference/chart-spec.mdpackages/charts-core/docs/reference/rendering-and-export.mdpackages/charts-core/docs/reference/runtime-and-scene.mdpackages/charts-core/docs/reference/scales-guides-and-color.mdpackages/charts-core/docs/reference/types.mdpackages/charts-core/src/canvas.test.tspackages/charts-core/src/canvas.tspackages/charts-core/src/export.test.tspackages/charts-core/src/exports.test.tspackages/charts-core/src/index.tspackages/charts-core/src/motion.test.tspackages/charts-core/src/reconcile.test.tspackages/charts-core/src/reconcile.tspackages/charts-core/src/svg-renderer.test.tspackages/charts-core/src/svg.tspackages/charts-core/src/types.tspackages/charts-core/src/universal-types.tspackages/react-native-charts/src/Chart.test.tsxpackages/react-native-charts/src/SvgScene.test.tsxpackages/react-native-charts/src/SvgScene.tsxscripts/check-canvas-renderer.mjsscripts/measure-bundles.mjsIncluded review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.
📝 Walkthrough
Walkthrough#
The PR adds renderer-neutral linear and radial gradient types. SVG, Canvas, and React Native now support radial gradient resources with normalized coordinates, stop normalization, renderer-specific fill and stroke behavior, reconciliation updates, tests, documentation, and refreshed bundle measurements.
Changes#
Gradient support
packages/charts-core/src/types.ts,packages/charts-core/src/universal-types.ts,packages/charts-core/src/index.ts,packages/charts-core/src/exports.test.ts,docs/reference/*,packages/charts-core/docs/reference/*,API-FRICTION.md,.changeset/add-radial-gradients.mdChartGradientBase,ChartRadialGradient, and theChartGradientunion. Widens chart spec and scene gradient collections. Exports and documents the new types.packages/charts-core/src/svg.ts,packages/charts-core/src/reconcile.ts,packages/react-native-charts/src/SvgScene.tsx,packages/charts-core/src/*test.ts,packages/react-native-charts/src/*test.tsx,docs/reference/rendering-and-export.md,packages/charts-core/docs/reference/rendering-and-export.mdpackages/charts-core/src/canvas.ts,packages/charts-core/src/canvas.test.ts,docs/guides/themes-and-styling.md,packages/charts-core/docs/guides/themes-and-styling.mdscripts/check-canvas-renderer.mjs,benchmarks/*,docs/comparison.md,packages/charts-core/docs/comparison.md,docs/guides/bundle-size-and-performance.md,packages/charts-core/docs/guides/bundle-size-and-performance.md,scripts/measure-bundles.mjsPriority: ➖ Normal
Estimated code review effort: 4 (Complex) | ~45 minutes
Severity of issue fixed: Medium
Sequence Diagram(s)#
Merge Risk: ⚪ Minimal · up to
f175eNo actionable merge-blocking risk remains.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
#129. It adds radial gradient entries with radial geometry and stops, emits them through the shared SVG and export resource path, and adds Canvas and React Native supp…Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 17 files. (24 skipped: 24 unsupported.)
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share