curveCubicX?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- d3, javascript
- Domain
- data-visualization, frontend
Research direction
Start by reviewing the linked original discussion in d3-interpolate#49 and the spline interpolation references in the issue. The proposal is to add a d3-shape curve that keeps Y a function of X, but the issue asks for ideas on deriving Bézier control points and does not identify files or tests. Done would mean implementing the curve and validating that it passes through the supplied points while keeping a single Y value for each X.
Written by the indexing model from the issue text.
Description
Issue was originally in d3-interpolate#49
I'm proposing the addition of a new type of curve for d3-shape — aptly called curveCubicX by @mbostock on the original thread — that treats the Y coordinate as a function of the X coordinate, such that for any X coordinate there's a single corresponding Y value.
In the image below, the proposed curveCubicX in comparison with curveNatural and curveBasis:
(the cubic curve is generated with a cubic spline interpolator through small line segments joining 1000 samples of <x, f(x)>)
The algorithm for the interpolator is described on Wikipedia (also of note is its talk page, which makes it apparent that the page suffered various incarnations of the algorithm, of various readability levels).
There are also some demos and implementations of the algorithm:
- http://blog.ivank.net/interpolation-with-cubic-splines.html
- https://github.com/morganherlocker/cubic-spline
- https://tools.timodenk.com/?p=cubic-spline-interpolation
However, these are all oriented towards finding the interpolator function, and any SVG paths are drawn with sampling the function, and I am severely out of my comfort zone in regards to obtaining the Bézier control points needed to draw the SVG path, so I'm hoping for some pointers or ideas on the matter...
As for the utility: I started with trying to recreate the Curves interface in Adobe Photoshop, which seems to be using such a cubic spline to interpolate the values. For data visualization, on the one hand it maintains Y being a function of X which makes sense in most types of charts, and the spline does pass through all the points, but on the other hand it tends to overshoot much more than other types of curves.
- Dominant language
- JavaScript
- Stars
- 2.5k
- Forks
- 307
- Avg merge
- 4h 16m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from d3/d3-shape
-
Improve tree-shakingOpen
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
assistant-ui/assistant-ui#10496 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
ai bug design good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
neomjs/neo-agent-institution#927 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gramps-project/gramps-web#1671 ·
Maintainers usually reply within 1 day
-
bug good first issue priority: P2 status: ready
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RhinoLink-Tech/data-fabric#502 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
cline/mcp-marketplace#3708 ·