-
- @if (LevelVal == null || LevelVal.Count == 0)
+@code {
+
+ [Inject]
+ private IJSRuntime JSRuntime { get; set; } = null!;
+
+
+ public enum ChartType
+ {
+ Pie,
+ Bar
+ }
+
+ [Parameter]
+ public string Id { get; set; }
+
+ [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)
+ {
+ var config = new
+ {
+ Type = Type.ToString().ToLower(),
+ Options = new
{
-
- }
- else
+ Responsive = true,
+ Scales = new
+ {
+ YAxes = new[]
+ {
+ new { Ticks = new {
+ BeginAtZero=true
+ } }
+ }
+ }
+ },
+ 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.SPEC/Components/ODLPlot.razor.cs b/MP.SPEC/Components/ODLPlot.razor.cs
index ed3197ef..5f282702 100644
--- a/MP.SPEC/Components/ODLPlot.razor.cs
+++ b/MP.SPEC/Components/ODLPlot.razor.cs
@@ -1,153 +1 @@
-using Microsoft.AspNetCore.Components;
-using MP.Data;
-using MP.Data.DatabaseModels;
-using MP.SPEC.Data;
-
-namespace MP.SPEC.Components
-{
- public partial class ODLPlot
- {
- #region Public Properties
-
- [Parameter]
- public int MachineId { get; set; } = 1;
-
- public string ODLId
- {
- get => _selODL;
- }
-
- [Parameter]
- public string SelectedODL
- {
- get => _selODL;
- set => _selODL = value;
- }
-
- [Parameter]
- public SelectOdlParams SelFilter
- {
- get => _SelFilter;
- set => _SelFilter = value;
- }
-
- #endregion Public Properties
-
- #region Protected Fields
-
- protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
- protected List