Use InterpolatePchipSorted for interpolation for best results
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -317,13 +317,19 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
}
}
- private double GetYAxisValueFromXAxisCurrentValue()
+ private decimal GetYAxisValueFromXAxisCurrentValue(double xValue)
+ {
+ if (_xAxisValues is { } && _yAxisValues is { })
{
var x = _xAxisValues.Reverse().ToArray();
- var y = _yAxisValues;
- double t = XAxisCurrentValue;
- var spline = CubicSpline.InterpolateNaturalSorted(x, y);
- return spline.Interpolate(t);
+ var y = _yAxisValues.Reverse().ToArray();
+ double t = xValue;
+ var spline = CubicSpline.InterpolatePchipSorted(x, y);
+ var interpolated = (decimal) spline.Interpolate(t);
+ return Math.Clamp(interpolated, (decimal)y[^1], (decimal)y[0]);
+ }
+
+ return (decimal)XAxisMaxValue;
}
public ICommand PasteCommand { get; }

Use InterpolatePchipSorted for interpolation for best results