@* 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;
@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) }
Il modello Stima perfetta

@Text

Vedi i numeri in una tabella
@foreach (var b in Bands) { }
Quando il modello diceCasiÈ andata beneAffidabilità
tra @(b.From)% e @(b.To)%@Format.Number(b.Cases)@Format.Number(b.Observed)%@(b.Solid ? "conta" : "troppo pochi casi per contarci")
} @code { [Parameter, EditorRequired] public IReadOnlyList Bands { get; set; } = []; [Parameter] public string Text { get; set; } = ""; private static string Label(LearningBand b) => $"{Format.Number(b.Observed)}% su {Cases(b)}"; private static string Cases(LearningBand b) => b.Cases == 1 ? "un caso" : Format.Number(b.Cases) + " casi"; private static string Css(decimal v) => v.ToString("0.##", CultureInfo.InvariantCulture); private static string Pct(decimal v) => v.ToString("0.###", CultureInfo.InvariantCulture) + "%"; }