WeldProcessRecordPage.razor
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@using DataAcquisition.DataAccess
@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<DataContext> dbContextFactory;
<AntDesign.Charts.Line Data="data" Config="config" />
@code {
[Parameter]
public Guid ProductionId { get; set; }
IEnumerable<object> data = new List<object>();
protected override void OnParametersSet()
{
using var context = dbContextFactory.CreateDbContext();
data = context.WeldProcessRecords.Where(x => x.ProductionId == ProductionId).Select(x => new
{
Time = x.CreateTime,
x.Name,
x.Value
}).ToList();
base.OnParametersSet();
}
LineConfig config = new LineConfig
{
Padding = "auto",
XField = "Time",
YField = "Value",
YAxis = new ValueAxis
{
Label = new BaseAxisLabel()
},
Legend = new Legend
{
Position = "right-top"
},
SeriesField = "Name"
};
}