126 lines
3.1 KiB
C#
126 lines
3.1 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.MONO.Data;
|
|
using MP.MONO.Data.DbModels;
|
|
using MP.MONO.UI.Data;
|
|
using static MP.MONO.Core.Enums;
|
|
|
|
namespace MP.MONO.UI.Components
|
|
{
|
|
public partial class MultiParamPlot
|
|
{
|
|
#region Public Properties
|
|
|
|
public string pcss
|
|
{
|
|
get
|
|
{
|
|
string answ = "col-12";
|
|
int numPar = SelectedParams.Count;
|
|
if (numPar > 6)
|
|
{
|
|
answ = "col-4";
|
|
}
|
|
else if (numPar > 3)
|
|
{
|
|
answ = "col-6";
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public List<string> SelectedParams
|
|
{
|
|
get => _selParams;
|
|
set => _selParams = value;
|
|
}
|
|
|
|
[Parameter]
|
|
public DataLogFilter SelFilter
|
|
{
|
|
get => _SelFilter;
|
|
set { _SelFilter = value; }
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Fields
|
|
|
|
protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
|
|
protected List<string> _selParams { get; set; } = new List<string>();
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
//await ReloadData();
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
isLoading = true;
|
|
await ReloadData();
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
ListRecords = null;
|
|
await Task.Delay(1);
|
|
ListRecords = await MMDataService.DataLogGetFilt(DataLogType.Parameter, StartDate, EndDate);
|
|
await Task.Delay(1);
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<DataLogModel>? ListRecords = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private DateTime EndDate
|
|
{
|
|
get => _SelFilter.DtEnd;
|
|
}
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
private DateTime StartDate
|
|
{
|
|
get => _SelFilter.DtStart;
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private List<chartJsData.chartJsTSerie> val2plot(string fluxType)
|
|
{
|
|
List<chartJsData.chartJsTSerie> answ = new List<chartJsData.chartJsTSerie>();
|
|
if (ListRecords != null)
|
|
{
|
|
answ = ListRecords
|
|
.Where(x => x.FluxType == fluxType)
|
|
.Select(l => new chartJsData.chartJsTSerie() { x = l.DtRif, y = l.ValNum })
|
|
.ToList();
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |