Add Normalize method
MODIFY
WalletWasabi.Fluent/Morph/PolyLine.cs
WalletWasabi.Fluent/Morph/PolyLine.cs
using System.Collections.ObjectModel;
+using System.Linq;
namespace WalletWasabi.Fluent.Morph
{
@@ -15,5 +16,25 @@ namespace WalletWasabi.Fluent.Morph
YValues = new ObservableCollection<double>(YValues)
};
}
+
+ public void Normalize()
+ {
+ var xMin = XValues.Min();
+ var xMax = XValues.Max();
+ var yMin = YValues.Min();
+ var yMax = YValues.Max();
+
+ for (var i = 0; i < XValues.Count; i++)
+ {
+ var x = XValues[i];
+ XValues[i] = (x - xMin) / (xMax - xMin);
+ }
+
+ for (var i = 0; i < YValues.Count; i++)
+ {
+ var y = YValues[i];
+ YValues[i] = (y - yMin) / (yMax - yMin);
+ }
+ }
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletBalanceChartTileViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletBalanceChartTileViewModel.cs
@@ -199,6 +199,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
{
const double Speed = 0.05;
const int Frames = (int) (1 / Speed);
+
+ // TODO:
+ // source.Normalize();
+ // target.Normalize();
+
var easing = new SplineEasing();
var cache = PolyLineMorph.ToCache(source, target, Speed, easing);
var frame = 0;

Add Normalize method