diff --git a/MP.Stats/Components/ChartTrends.razor.cs b/MP.Stats/Components/ChartTrends.razor.cs index 897cd855..acb3cfe9 100644 --- a/MP.Stats/Components/ChartTrends.razor.cs +++ b/MP.Stats/Components/ChartTrends.razor.cs @@ -6,7 +6,9 @@ using MP.Data.Services; using MP.Stats.Data; using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; +using System.Security.AccessControl; namespace MP.Stats.Components { @@ -211,17 +213,29 @@ namespace MP.Stats.Components var currPlot = GetTSDetail(idxMacc, "", pSel, true); TSDataMultiDetail.Add(currPlot); TSDataMultiDetail.Add(GetTSDetail(idxMacc, "", pSel, false)); +#if false if (LabelPlotDet.Count == 0) { - if (pSel == PeriodoSel.Day) + switch (pSel) { - LabelPlotDet = currPlot.Select(r => $"{r.x:HH:mm:ss}").ToList(); + //case PeriodoSel.Day: + // LabelPlotDet = currPlot.Select(r => $"{r.x:HH}").ToList(); + // break; + //case PeriodoSel.Week: + // LabelPlotDet = currPlot.Select(r => $"{r.x:dd}").ToList(); + // break; + //case PeriodoSel.Month: + // LabelPlotDet = currPlot.Select(r => $"{r.x:dd}").ToList(); + // break; + //case PeriodoSel.Year: + // LabelPlotDet = currPlot.Select(r => $"{r.x:MM-dd}").ToList(); + // break; + //default: + // LabelPlotDet = currPlot.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); + // break; } - else - { - LabelPlotDet = currPlot.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); - } - } + } +#endif } bgColorsDet = semaphColors(ParetoData.Count * 2, "0.3"); @@ -258,6 +272,8 @@ namespace MP.Stats.Components { // fake fix: indietro 7 gg... DateTime dataRif = DateTime.Today.AddDays(-7); + TimeSpan deltaOld = new TimeSpan(0); + DateTime dtStart = dataRif; DateTime inizio = dataRif; DateTime fine = inizio.AddDays(1); double startVal = 0; @@ -266,18 +282,22 @@ namespace MP.Stats.Components case PeriodoSel.Day: inizio = isCurrent ? dataRif : dataRif.AddDays(-1); fine = inizio.AddDays(1); + deltaOld = TimeSpan.FromDays(1); break; case PeriodoSel.Week: inizio = isCurrent ? GetFirstDayOfWeek(dataRif) : GetFirstDayOfWeek(dataRif).AddDays(-7); fine = inizio.AddDays(7); + deltaOld = TimeSpan.FromDays(7); break; case PeriodoSel.Month: inizio = isCurrent ? new DateTime(dataRif.Year, dataRif.Month, 1) : new DateTime(dataRif.Year, dataRif.Month, 1).AddMonths(-1); fine = inizio.AddMonths(1); + deltaOld = inizio.AddMonths(1).Subtract(inizio); break; case PeriodoSel.Year: inizio = isCurrent ? new DateTime(dataRif.Year, 1, 1) : new DateTime(dataRif.Year, 1, 1).AddYears(-1); fine = inizio.AddYears(1); + deltaOld = inizio.AddYears(1).Subtract(inizio); break; @@ -295,10 +315,11 @@ namespace MP.Stats.Components if (firstRec != null) { startVal = cDouble(firstRec.Valore); + dtStart = firstRec.dtEvento.Date; } answ = listRaw - .Select(r => new chartJsData.chartJsTSerie() { x = r.dtEvento, y = cDouble(r.Valore) - startVal }) + .Select(r => new chartJsData.chartJsTSerie() { x = isCurrent ? r.dtEvento : r.dtEvento.Add(deltaOld), y = cDouble(r.Valore) - startVal }) .OrderBy(o => o.x) .ToList(); } @@ -308,7 +329,9 @@ namespace MP.Stats.Components private double cDouble(string origValue) { - return double.Parse(origValue); + double dblVal = 0; + double.TryParse(origValue, NumberStyles.Any, CultureInfo.InvariantCulture, out dblVal); + return dblVal; } /// diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 3e71c4d1..f4201016 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,8 +4,8 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2503.1018 - 6.16.2503.1018 + 6.16.2503.1019 + 6.16.2503.1019 true $(NoWarn);1591 en diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index 9b59fd50..bd38fc2e 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

Versione: 6.16.2503.1018

+

Versione: 6.16.2503.1019


Note di rilascio: