Grafici trend normalizzati!

This commit is contained in:
Samuele Locatelli
2025-03-10 19:10:18 +01:00
parent 8a808856de
commit 7c20a7ee8c
5 changed files with 37 additions and 14 deletions
+32 -9
View File
@@ -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;
}
/// <summary>
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2503.1018</Version>
<Version>6.16.2503.1018</Version>
<Version>6.16.2503.1019</Version>
<Version>6.16.2503.1019</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2503.1018</h4>
<h4>Versione: 6.16.2503.1019</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2503.1018
6.16.2503.1019
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2503.1018</version>
<version>6.16.2503.1019</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>