Skip to content

Conversation

@gka
Copy link
Contributor

@gka gka commented May 19, 2025

While SveltePlot allows you to use any SVG gradients, you can also make use of the LinearGradientX and LinearGradientY helpers, which allow mapping data to gradient stops.

https://deploy-preview-42--svelteplot.netlify.app/features/gradients

@netlify
Copy link

netlify bot commented May 19, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 7cf6c16
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/682b182759c05a00081c3e22
😎 Deploy Preview https://deploy-preview-42--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gka gka requested a review from Copilot May 19, 2025 11:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds first-class gradient helpers to SveltePlot, refactors canvas color resolution, and updates documentation and navigation.

  • Introduce LinearGradientX and LinearGradientY Svelte components and export them in the public API
  • Consolidate color‐and‐gradient parsing into a reusable resolveColor helper for canvas marks
  • Update docs pages, code examples, and sidebar entries for gradient features

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/marks/helpers/LinearGradientX.svelte New horizontal gradient helper
src/lib/marks/helpers/LinearGradientY.svelte New vertical gradient helper
src/lib/marks/helpers/canvas.ts Added resolveColor to parse and apply SVG gradients in canvas
src/lib/marks/helpers/LineCanvas.svelte Refactored to use resolveColor, removed inline color logic
src/lib/marks/helpers/DotCanvas.svelte Refactored to use resolveColor for dot fill/stroke
src/lib/index.ts Export gradient helpers
src/routes/features/gradients/+page.ts Load datasets for gradients feature
src/routes/features/gradients/+page.md Added documentation for LinearGradientX and LinearGradientY
src/routes/marks/line/+page.md Example usage for gradient lines
config/sidebar.ts Added “Gradients” entry to the sidebar
Comments suppressed due to low confidence (1)

src/lib/marks/helpers/LinearGradientX.svelte:1

  • [nitpick] Consider adding unit or integration tests for the new gradient helpers to verify that data-to-offset mapping and rendering behave as expected.
<script lang="ts">

@gka gka merged commit d2d29cf into main May 19, 2025
5 checks passed
@gka gka deleted the fest/gradients branch May 19, 2025 11: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.

2 participants