Interpolating null data values
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
### Feature Proposal
It would be nice if chartjs could "Interpolate" null values provided in the data set.
[This is a SO question for context](https://stackoverflow.com/questions/77760054/calculating-point-coordinates-on-a-line-in-chartjs/77763621#77763621).
So for example if we provide data like this:
```
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange", "Blue", "Yellow", "Green", "Purple", "Green"],
datasets: [
{
label: '# of Points',
data: [7, null, 11, null, 5 , null, 8, null, 3, null, 7],
fill: true,
tension: 0.4,
borderWidth: 1,
pointHitRadius: 25,
spanGaps: true
}
]
},
```
It would be lovely if we could retrieve the bezier curve that displays the values with something like `const curve = chart.getLines()[0]` and then request that it interpolate the values:
```
const points = curve.interpolate();
```
And that would fill in the `null` values.
Another thing that would be neat is if we could target segments for more labels and values.
For example in Inkscape we can select nodes and click add node to add more nodes.
Here's a demo:
https://youtu.be/dVjJfx2oc5w?t=173
It would be neat if ChartJS could do something like this adding empty labels and corresponding values for a segment where we are requesting that more values be added. So for example:
```
plot.addValues(startPoint, EndPoint, N);
```
That would add N more values between the start and end point and the labels would be empty strings.
### Possible Implementation
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.