diff --git a/MP-STATS.sln b/MP-STATS.sln index 3b5b6475..16ba2c74 100644 --- a/MP-STATS.sln +++ b/MP-STATS.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31229.75 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32126.317 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}" EndProject diff --git a/MP.Data/chartJsData.cs b/MP.Data/chartJsData.cs new file mode 100644 index 00000000..def8c7b4 --- /dev/null +++ b/MP.Data/chartJsData.cs @@ -0,0 +1,31 @@ +using System; + +namespace MP.Data +{ + public class chartJsData + { + #region Public Classes + + public class chartJsTSerie + { + #region Public Properties + + public DateTime x { get; set; } + public decimal y { get; set; } + + #endregion Public Properties + } + + public class chartJsXY + { + #region Public Properties + + public decimal x { get; set; } + public decimal y { get; set; } + + #endregion Public Properties + } + + #endregion Public Classes + } +} \ No newline at end of file diff --git a/MP.Stats/Components/Chart.razor b/MP.Stats/Components/Chart.razor new file mode 100644 index 00000000..5c8bee17 --- /dev/null +++ b/MP.Stats/Components/Chart.razor @@ -0,0 +1,62 @@ +@inject IJSRuntime JSRuntime + + + +@code { + public enum ChartType + { + Pie, + Bar + } + + [Parameter] + public string Id { get; set; } = "MyChart"; + + [Parameter] + public ChartType Type { get; set; } + + [Parameter] + public string[]? Data { get; set; } + + [Parameter] + public string[]? BackgroundColor { get; set; } + + [Parameter] + public string[]? Labels { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await InitDefault(); + } + + protected async Task InitDefault() + { + // Here we create an anonymous type with all the options + // that need to be sent to Chart.js + var config = new + { + type = Type.ToString().ToLower(), + options = new + { + responsive = true, + scales = new + { + yAxes = new + { + suggestedMin = 0 + } + } + }, + data = new + { + datasets = new[] + { + new { data = Data, backgroundColor = BackgroundColor} + }, + labels = Labels + } + }; + await JSRuntime.InvokeVoidAsync("setup", Id, config); + } + +} \ No newline at end of file diff --git a/MP.Stats/Components/ChartHist.razor b/MP.Stats/Components/ChartHist.razor new file mode 100644 index 00000000..3f1489e1 --- /dev/null +++ b/MP.Stats/Components/ChartHist.razor @@ -0,0 +1,82 @@ +@inject IJSRuntime JSRuntime + + + +@code { + + [Parameter] + public string Id { get; set; } = "MyHist"; + + [Parameter] + public string[]? Data { get; set; } + [Parameter] + public string[]? Labels { get; set; } + + [Parameter] + public string lineColor { get; set; } = ""; + [Parameter] + public string backColor { get; set; } = ""; + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + //if (!firstRender) + //{ + await renderChart(); + //} + } + + + /// + /// Inizializzazione rendering componente + /// + /// partendo da qui: + /// https://www.williamleme.com/posts/2020/003-chartjs-blazor/ + /// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ + /// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type + /// + /// + /// + protected async Task renderChart() + { + // creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js + var config = new + { + type = "bar", + options = new + { + responsive = true, + scales = new + { + yAxes = new + { + suggestedMin = 0, + display = true, + ticks = new + { + beginAtZero = true, + maxTicksLimit = 10 + } + } + } + }, + data = new + { + datasets = new[] + { + new + { + data = Data, + borderColor = lineColor, + backgroundColor = backColor, + borderWidth = 1, + label= "Freq. Osservate" + } + }, + labels = Labels + } + }; + await JSRuntime.InvokeVoidAsync("setup", Id, config); + } + +} \ No newline at end of file diff --git a/MP.Stats/Components/ChartTS.razor b/MP.Stats/Components/ChartTS.razor new file mode 100644 index 00000000..5a332e51 --- /dev/null +++ b/MP.Stats/Components/ChartTS.razor @@ -0,0 +1,91 @@ +@using MP.Data +@inject IJSRuntime JSRuntime + + + +@code { + + [Parameter] + public string Id { get; set; } = "MyTs"; + + [Parameter] + public List DataTS { get; set; } = null!; + + [Parameter] + public string lineColor { get; set; } = ""; + [Parameter] + public string backColor { get; set; } = ""; + + /// + /// Inizializzazione rendering componente + /// + /// partendo da qui: + /// https://www.williamleme.com/posts/2020/003-chartjs-blazor/ + /// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ + /// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type + /// + /// + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + //if (!firstRender) + //{ + await renderChart(); + //} + } + + /// + /// Inizializzazione rendering componente + /// + /// partendo da qui: + /// https://www.williamleme.com/posts/2020/003-chartjs-blazor/ + /// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ + /// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type + /// + /// + /// + protected async Task renderChart() + { + // creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js + var config = new + { + type = "line", + options = new + { + responsive = true, + scales = new + { + yAxes = new + { + display = true, + ticks = new + { + maxTicksLimit = 10 + } + }, + xAxes = new + { + type = "timeseries", + distribution = "linear", + } + } + }, + data = new + { + datasets = new[] + { + new + { + data = DataTS, + borderColor= lineColor, + backgroundColor= backColor, + lineTension= 0, + stepped= true, + label= "Temperatura Rilevata" + } + } + } + }; + await JSRuntime.InvokeVoidAsync("setup", Id, config); + } +} \ No newline at end of file diff --git a/MP.Stats/Components/DataPager.razor b/MP.Stats/Components/DataPager.razor index 085c9b87..619e271f 100644 --- a/MP.Stats/Components/DataPager.razor +++ b/MP.Stats/Components/DataPager.razor @@ -1,57 +1,20 @@ 
-
+
-
+
@if (totalCount > 0) { - - - - - - - - - - - +
    +
  • +
  • @for (int i = @startPage; i <= endPage; ++i) { var pageNum = i; - - - @pageNum - - +
  • } - - - - - - - - - - - - } -
-
- @if (!showLoading) - { -
@totalCount records
- } - @if (totalCount > 0) - { - if (!fileExist) - { - - } - else - { - Download Data - } +
  • +
  • + }
    @@ -59,26 +22,35 @@
    @if (showLoading) { - - - +
    +
    +
    }
    -
    - @if (totalCount > 0) - { -
    - row/pag:  - +
    +
    +
    + @if (!showLoading) + { + @totalCount records + }
    - } +
    + @if (totalCount > 0) + { +
    + +
    + } +
    +
    \ No newline at end of file diff --git a/MP.Stats/Components/DataPager.razor.cs b/MP.Stats/Components/DataPager.razor.cs index 54b5f57f..0d6d8dcc 100644 --- a/MP.Stats/Components/DataPager.razor.cs +++ b/MP.Stats/Components/DataPager.razor.cs @@ -9,7 +9,7 @@ using MP.Stats.Data; namespace MP.Stats.Components { - public partial class DataPager + public partial class DataPager : ComponentBase { #region Protected Fields @@ -17,6 +17,7 @@ namespace MP.Stats.Components protected string exportDir = $"{Directory.GetCurrentDirectory()}\\temp"; + #endregion Protected Fields #region Private Properties @@ -61,7 +62,7 @@ namespace MP.Stats.Components } } - // calcola un set 1..numPOages centrato sulla pagina corrente... + // calcola un set 1 .. numPages centrato sulla pagina corrente... private int startPage { get @@ -194,23 +195,31 @@ namespace MP.Stats.Components showLoading = false; } + #endregion Private Methods #region Protected Methods - protected void HandlePaginationItemClick(string page) + protected string cssActive(int numPage) { - currPage = int.Parse(page); + string answ = ""; + if (numPage == currPage) + { + answ = "active"; + } + return answ; } - #endregion Protected Methods - -#if false protected override async Task OnInitializedAsync() { await Task.Run(() => showLoading = false); } -#endif + protected void PaginationItemClick(int page) + { + currPage = page; + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP.Stats/Components/SelectionFilter.razor b/MP.Stats/Components/SelectionFilter.razor index 0eac7e25..8bba127f 100644 --- a/MP.Stats/Components/SelectionFilter.razor +++ b/MP.Stats/Components/SelectionFilter.razor @@ -6,7 +6,7 @@

    - +
    @@ -80,7 +80,7 @@

    - +
    diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 4390cfd9..cc3f10d5 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.14.2202.2116 + 6.14.2202.2117 @@ -132,6 +132,16 @@ + + + + + + + + + + @@ -155,10 +165,18 @@ + + + + + + + + diff --git a/MP.Stats/Pages/Test.razor b/MP.Stats/Pages/Test.razor index 1cdce18e..cc04841c 100644 --- a/MP.Stats/Pages/Test.razor +++ b/MP.Stats/Pages/Test.razor @@ -1,8 +1,8 @@ @page "/test" -Test +

    Test

    - +
    diff --git a/MP.Stats/Pages/_Host.cshtml b/MP.Stats/Pages/_Host.cshtml index 7b6d6abd..08212dcb 100644 --- a/MP.Stats/Pages/_Host.cshtml +++ b/MP.Stats/Pages/_Host.cshtml @@ -17,6 +17,13 @@ + + + + @* + + *@ + @@ -34,15 +41,19 @@
    - - - - + @* + *@ + @**@ + @**@ - + @* - + *@ + + + + \ No newline at end of file diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index c0e15796..30e7e27c 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

    Versione: 6.14.2202.2116

    +

    Versione: 6.14.2202.2117


    Note di rilascio:
      diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index a91e1281..aad2ebaf 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.14.2202.2116 +6.14.2202.2117 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index e6e59e34..0bb9f460 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.14.2202.2116 + 6.14.2202.2117 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Startup.cs b/MP.Stats/Startup.cs index e6d2f076..be7906a3 100644 --- a/MP.Stats/Startup.cs +++ b/MP.Stats/Startup.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using MP.Stats.Data; using System.Globalization; +using Blazorise.Bootstrap; namespace MP.Stats { @@ -79,7 +80,8 @@ namespace MP.Stats services.AddBlazorise(options => { options.ChangeTextOnKeyPress = true; // optional - }); + }) + .AddBootstrapProviders(); // Elmah services.AddElmah();