Skip to content

feature: add jitterX and jitterY transforms #65

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

Merged
merged 24 commits into from
May 26, 2025
Merged

Conversation

gka
Copy link
Contributor

@gka gka commented May 26, 2025

demo

This pull request introduces a new jitter transform to SveltePlot, along with related updates to documentation, type definitions, and helper functions.

The jitter transform adds random noise in data space, which is useful for reducing overplotting in visualizations. Additionally, various type annotations and exports have been updated for improved code clarity and maintainability.

New jitter Transform:

  • Added jitterX and jitterY functions to implement the jitter transform, which supports both uniform and normal distributions. These functions include options for width, standard deviation, and handling temporal data (src/lib/transforms/jitter.ts).
  • Exported jitterX and jitterY from src/lib/transforms/index.ts for external use.
  • Added a new sidebar entry for the jitter transform in config/sidebar.ts.

Documentation Updates:

  • Created a dedicated page for the jitter transform, explaining its usage, options, and examples for numeric and temporal data (src/routes/transforms/jitter/+page.md).
  • Added a loader for the jitter page to fetch example datasets (src/routes/transforms/jitter/+page.ts).
  • Updated the global list of available transforms to include jitter (src/routes/features/transforms/+page.md).

Type Annotations and Helper Updates:

  • Added TypeScript type annotations to several helper functions in src/lib/helpers/time.ts, including parseTimeInterval, maybeTimeInterval, and asInterval. These updates improve type safety and clarity. [1] [2] [3]
  • Updated the isDate function in src/lib/helpers/typeChecks.ts to use a TypeScript type guard, improving type inference.

Open issues

  • add unit tests
  • implement jittering for dates

Copy link

netlify bot commented May 26, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 9521b6a
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6834dce64ac87b0008e75d3c
😎 Deploy Preview https://deploy-preview-65--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 added the enhancement New feature or request label May 26, 2025
@gka gka self-assigned this May 26, 2025
@gka gka requested a review from Copilot May 26, 2025 19:46
Copy link
Contributor

@Copilot 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

This pull request adds new jitter transforms (jitterX and jitterY) to SveltePlot to reduce overplotting, along with documentation improvements, updated type annotations, and helper function updates for time and date handling. Key changes include:

  • Implementation of the jitter transform using both uniform and normal distributions.
  • Creation of new documentation pages and sidebar entries for the jitter transform.
  • Updates to type checking and time helper functions for better type safety.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/routes/transforms/jitter/+page.ts Adds a loader to fetch example datasets for the jitter page.
src/routes/transforms/jitter/+page.md New documentation explaining jitter transform usage.
src/routes/transforms/interval/+page.md Minor update: removal of an unused import.
src/routes/transforms/bolliner/+page.md Added a placeholder page for the Bollinger transform.
src/routes/features/transforms/+page.md Updates the list of available transforms to include jitter.
src/lib/transforms/jitter.ts Implements jitterX and jitterY transforms with random noise.
src/lib/transforms/jitter.test.ts Adds tests for jitter transform functionality.
src/lib/transforms/index.ts Exports the new jitter transforms for external use.
src/lib/helpers/typeChecks.ts Updates the isDate function to use a TypeScript type guard.
src/lib/helpers/time.ts Updates type annotations and exports durations and interval functions.
config/sidebar.ts Adds a sidebar entry for the jitter transform.
Comments suppressed due to low confidence (1)

src/lib/transforms/jitter.test.ts:101

  • [nitpick] The jitterY test uses a channel key 'y' with a value 'x', which may be confusing. Consider using a consistent naming convention (e.g., { data, y: 'y' }) to clarify that the jitter is applied to the y-axis.
const result = jitterY({ data, y: 'x' }, { source: mockRandom });

Copy link

📦 Preview package for this PR is published!

Version: 0.2.7-pr-65.2

Install it with:

npm install svelteplot@pr-65
# or install the specific version
npm install svelteplot@0.2.7-pr-65.2

@gka gka merged commit 36a337e into main May 26, 2025
2 checks passed
@gka gka added this to the 0.2.7 milestone May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy