@* How often it went well against what the model said (SPEC 13.4, mockup 06): one scale, 2 px lines, faint grid, the
perfect estimate beside it, direct labels on the fullest band and on the last one, a box on hover and the table.
As in EquityChart the lines are SVG stretched to the box; texts and points are HTML placed in percent. *@
@if (Bands.Count > 0)
{
var loX = Bands.Min(b => b.From) / 10 * 10;
var hiX = (Bands.Max(b => b.To) + 9) / 10 * 10;
var loY = Math.Min(loX, (int)Math.Floor(Bands.Min(b => b.Observed)) / 10 * 10) - 5m;
var hiY = Math.Max(hiX, Bands.Max(b => b.Observed)) + 4m;
var step = hiX - loX > 60 ? 20 : 10;
var fullest = Bands.MaxBy(b => b.Cases)!;
var last = Bands[^1];
decimal X(decimal v) => (v - loX) / (hiX - loX) * 1000m;
decimal Y(decimal v) => (hiY - v) / (hiY - loY) * 1000m;
…va bene davvero
@for (var t = (int)Math.Ceiling(loY / step) * step; t <= hiY; t += step)
{
@t%
}
@foreach (var b in Bands)
{
Tra @(b.From)% e @(b.To)% @Format.Number(b.Observed)% su @Cases(b)
}
@Label(fullest)
@if (last != fullest)
{
@Label(last)
}
@for (var t = loX; t <= hiX; t += step)
{
@t%
}
Quando il modello dice…
Il modelloStima perfetta
@Text
Vedi i numeri in una tabella
Quando il modello dice
Casi
È andata bene
Affidabilità
@foreach (var b in Bands)
{
tra @(b.From)% e @(b.To)%
@Format.Number(b.Cases)
@Format.Number(b.Observed)%
@(b.Solid ? "conta" : "troppo pochi casi per contarci")