ChartWindow: Make gebunden type fixed more user friendly

This commit is contained in:
2024-01-21 12:48:40 +01:00
parent 182b367811
commit 89d20f4c42
5 changed files with 112 additions and 76 deletions

@ -28,6 +28,14 @@ namespace Elwig.Helpers.Billing {
DataY = DataX.Select(i => (double)BillingData.GetCurveValueAt(data, i)).ToArray();
}
public Graph(double[] values, int precision, int minX, int maxX) {
Precision = precision;
MinX = minX;
MaxX = maxX;
DataX = Enumerable.Range(MinX, MaxX - MinX + 1).Select(i => (double)i).ToArray();
DataY = values;
}
private Graph(double[] dataX, double[] dataY, int precision, int minX, int maxX) {
Precision = precision;
MinX = minX;
@ -52,6 +60,10 @@ namespace Elwig.Helpers.Billing {
return DataY[index];
}
public double GetPriceAtOe(double oe) {
return DataY[Array.IndexOf(DataX, oe)];
}
private void FlattenGraph(int begin, int end, double value) {
for (int i = begin; i <= end; i++) {
DataY[i] = value;