diff --git a/MP.SPEC/Components/Chart/Doughnut.razor.cs b/MP.SPEC/Components/Chart/Doughnut.razor.cs index 52b21dc9..b3c63a4f 100644 --- a/MP.SPEC/Components/Chart/Doughnut.razor.cs +++ b/MP.SPEC/Components/Chart/Doughnut.razor.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data; +using MP.SPEC.Data; using static System.Net.Mime.MediaTypeNames; namespace MP.SPEC.Components.Chart @@ -28,7 +29,7 @@ namespace MP.SPEC.Components.Chart public double[] Data { get; set; } [Parameter] - public string[] BackgroundColor { get; set; } + public List BackgroundColor { get; set; } [Parameter] public string[] Labels { get; set; } @@ -46,7 +47,7 @@ namespace MP.SPEC.Components.Chart { Datasets = new[] { - new { Data = Data, BackgroundColor = BackgroundColor + new { Data = Data, BackgroundColor = BackgroundColor.Select(x=>x.color), borderColor = BackgroundColor.Select(x=>x.border), borderWidth= 0, offset= 10, borderRadius = 10 } }, Labels = Labels diff --git a/MP.SPEC/Components/ListODL.razor b/MP.SPEC/Components/ListODL.razor index 838f5857..a1368074 100644 --- a/MP.SPEC/Components/ListODL.razor +++ b/MP.SPEC/Components/ListODL.razor @@ -224,7 +224,7 @@ else
-
@($"{calcolaPerc(stat.TotDurata):N1}%")
+
@($"{calcolaPerc(stat.TotDurata):N1}%")
diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 897c8f71..473b369f 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -277,7 +277,26 @@ namespace MP.SPEC.Components } return answ; } - + private string pbStyle(string css) + { + string answ = ""; + if (ListOdlStats != null) + { + if (css == "yellow") + { + answ ="orange"; + } + else if (css == "blue") + { + answ = "purple"; + } + else + { + answ = css; + } + } + return answ; + } private async void MessageService_EA_PageUpdated() { await reloadData(); diff --git a/MP.SPEC/Components/ODLPlot.razor b/MP.SPEC/Components/ODLPlot.razor index 325b78fb..bbecf152 100644 --- a/MP.SPEC/Components/ODLPlot.razor +++ b/MP.SPEC/Components/ODLPlot.razor @@ -7,7 +7,7 @@ } else { - + } } \ No newline at end of file diff --git a/MP.SPEC/Components/ODLPlot.razor.cs b/MP.SPEC/Components/ODLPlot.razor.cs index 475a5db4..f3da5226 100644 --- a/MP.SPEC/Components/ODLPlot.razor.cs +++ b/MP.SPEC/Components/ODLPlot.razor.cs @@ -49,7 +49,7 @@ namespace MP.SPEC.Components public List Data = new List(); public List Labels = new List(); - public List colors = new List(); + public List colors = new List(); protected async Task ReloadData() { @@ -61,7 +61,20 @@ namespace MP.SPEC.Components { Data.Add(record.TotDurata); Labels.Add($"{record.Descrizione} - {record.TotDurata:N1}min"); - colors.Add($"{record.Css}"); + if (record.Css == "yellow") + { + colors.Add(new DoughnutStyling("orange", "ccc")); + } + else if (record.Css == "blue") + { + colors.Add(new DoughnutStyling("purple", "ccc")); + } + else + { + colors.Add(new DoughnutStyling(record.Css, "ccc")); + } + + } await Task.Delay(1); isLoading = false; diff --git a/MP.SPEC/Data/DoughnutStyling.cs b/MP.SPEC/Data/DoughnutStyling.cs new file mode 100644 index 00000000..54a76b53 --- /dev/null +++ b/MP.SPEC/Data/DoughnutStyling.cs @@ -0,0 +1,16 @@ +using System.Drawing; + +namespace MP.SPEC.Data +{ + public class DoughnutStyling + { + public string color { get; set; } + public string border { get; set; } + + public DoughnutStyling(string color, string border) + { + this.color = color; + this.border = border; + } + } +}