diff --git a/MP.Stats/Components/ChartJsBar.razor b/MP.Stats/Components/ChartJs/BarPlot.razor similarity index 100% rename from MP.Stats/Components/ChartJsBar.razor rename to MP.Stats/Components/ChartJs/BarPlot.razor diff --git a/MP.Stats/Components/ChartJsBar.razor.cs b/MP.Stats/Components/ChartJs/BarPlot.razor.cs similarity index 58% rename from MP.Stats/Components/ChartJsBar.razor.cs rename to MP.Stats/Components/ChartJs/BarPlot.razor.cs index 1488f52c..400b2f2b 100644 --- a/MP.Stats/Components/ChartJsBar.razor.cs +++ b/MP.Stats/Components/ChartJs/BarPlot.razor.cs @@ -14,9 +14,9 @@ using Microsoft.JSInterop; using MP.Stats; using MP.Stats.Shared; -namespace MP.Stats.Components +namespace MP.Stats.Components.ChartJs { - public partial class ChartJsBar + public partial class BarPlot { [Inject] IJSRuntime JSRuntime { get; set; } @@ -26,6 +26,9 @@ namespace MP.Stats.Components [Parameter] public string Legenda { get; set; } = "Legenda"; + + [Parameter] + public bool Horizontal { get; set; } = false; [Parameter] public string[]? Data { get; set; } @@ -44,6 +47,7 @@ namespace MP.Stats.Components //} } + /// /// Inizializzazione rendering componente /// @@ -56,7 +60,7 @@ namespace MP.Stats.Components /// protected async Task renderChart() { - // creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js + // creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js, tipo verticale var config = new { type = "bar", @@ -81,17 +85,60 @@ namespace MP.Stats.Components { datasets = new[] { new { - data = Data, - borderColor = lineColor, - backgroundColor = backColor, - borderWidth = 1, + data = Data, + borderColor = lineColor, + backgroundColor = backColor, + borderWidth = 1, label = Legenda } }, labels = Labels } }; - await JSRuntime.InvokeVoidAsync("setup", Id, config); + // creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js, tipo verticale + var configHor = new + { + type = "bar", + options = new + { + indexAxis = "y", + 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 = Legenda + } + }, + labels = Labels + } + }; + if (Horizontal) + { + await JSRuntime.InvokeVoidAsync("setup", Id, configHor); + } + else + { + await JSRuntime.InvokeVoidAsync("setup", Id, config); + } } } } \ No newline at end of file diff --git a/MP.Stats/Components/Chart.razor b/MP.Stats/Components/ChartJs/Chart.razor similarity index 100% rename from MP.Stats/Components/Chart.razor rename to MP.Stats/Components/ChartJs/Chart.razor diff --git a/MP.Stats/Components/ChartJsStepLine.razor b/MP.Stats/Components/ChartJs/StepLine.razor similarity index 100% rename from MP.Stats/Components/ChartJsStepLine.razor rename to MP.Stats/Components/ChartJs/StepLine.razor diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 90a77dfc..7011200b 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.2217 + 6.14.2202.2412 diff --git a/MP.Stats/Pages/Test.razor b/MP.Stats/Pages/Test.razor index cb7cd1c8..7877bfbe 100644 --- a/MP.Stats/Pages/Test.razor +++ b/MP.Stats/Pages/Test.razor @@ -1,6 +1,6 @@ @page "/test" -@using MP.Stats.Components +@using MP.Stats.Components.ChartJs

Test Normal plot

@@ -44,10 +44,13 @@ *@
- +
- + +
+
+
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index 3a2b10b0..44898f68 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

Versione: 6.14.2202.2217

+

Versione: 6.14.2202.2412


Note di rilascio:
    diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index 2f232fea..7b2142ac 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.14.2202.2217 +6.14.2202.2412 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index c874573a..af8a27b4 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.14.2202.2217 + 6.14.2202.2412 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