fix: correct Y-grid to 5 lines, add defensive date sort in GetChartPricesAsync
This commit is contained in:
@@ -66,6 +66,7 @@ public class FundDataService : IFundDataService
|
||||
_logger.LogError(ex, "Errore GetChartPricesAsync per ISIN {Isin}", isin);
|
||||
throw;
|
||||
}
|
||||
points.Sort((a, b) => a.Date.CompareTo(b.Date));
|
||||
return points;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,9 +130,9 @@ public static class FundSkiaChartRenderer
|
||||
var axisLabelFont = new SKFont(SKTypeface.Default, 10f);
|
||||
|
||||
// Y grid (5 horizontal lines)
|
||||
for (int i = 0; i <= 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
decimal price = yMin + (yMax - yMin) * i / 5;
|
||||
decimal price = yMin + (yMax - yMin) * i / 4;
|
||||
float py = PriceToY(price, yMin, yMax, plotY, plotH);
|
||||
canvas.DrawLine(plotX, py, plotX + plotW, py, i == 0 ? axisPaint : gridPaint);
|
||||
canvas.DrawText($"{price:F2}", plotX - 5f, py + 4f,
|
||||
|
||||
Reference in New Issue
Block a user