|
|
|
|
@ -8,6 +8,7 @@ using OxyPlot;
|
|
|
|
|
using OxyPlot.Axes;
|
|
|
|
|
using OxyPlot.Series;
|
|
|
|
|
using SmartAquaViewer.DataAnalysis;
|
|
|
|
|
using static SmartAquaViewer.Model.Enums;
|
|
|
|
|
|
|
|
|
|
namespace SmartAquaViewer.ViewModel
|
|
|
|
|
{
|
|
|
|
|
@ -86,7 +87,70 @@ namespace SmartAquaViewer.ViewModel
|
|
|
|
|
Model.InvalidatePlot(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static double? ResolveTankY(WaterQualityVO vo, string fieldName)
|
|
|
|
|
public void SetDefaultLineGraph(
|
|
|
|
|
List<WaterQualityVO> collection,
|
|
|
|
|
MonitorTab selectedTab,
|
|
|
|
|
FieldItem? xField, FieldItem? yField,
|
|
|
|
|
bool isMarker)
|
|
|
|
|
{
|
|
|
|
|
Model.Series.Clear();
|
|
|
|
|
Model.Axes.Clear();
|
|
|
|
|
|
|
|
|
|
var xAxis = new DateTimeAxis
|
|
|
|
|
{
|
|
|
|
|
Position = AxisPosition.Bottom,
|
|
|
|
|
Title = "시간",
|
|
|
|
|
StringFormat = "HH:mm:ss",
|
|
|
|
|
IntervalType = DateTimeIntervalType.Minutes,
|
|
|
|
|
MajorGridlineStyle = LineStyle.Solid,
|
|
|
|
|
MinorGridlineStyle = LineStyle.Dot
|
|
|
|
|
};
|
|
|
|
|
var yAxis = new LinearAxis
|
|
|
|
|
{
|
|
|
|
|
Position = AxisPosition.Left,
|
|
|
|
|
Title = yField.Display,
|
|
|
|
|
MajorGridlineStyle = LineStyle.Solid,
|
|
|
|
|
MinorGridlineStyle = LineStyle.Dot
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Model.Axes.Add(xAxis);
|
|
|
|
|
Model.Axes.Add(yAxis);
|
|
|
|
|
|
|
|
|
|
var series = new LineSeries()
|
|
|
|
|
{
|
|
|
|
|
MarkerType = isMarker ? MarkerType.Circle : MarkerType.None,
|
|
|
|
|
MarkerSize = isMarker ? 3 : 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var r in collection.OrderBy(r => r.RecordedTime))
|
|
|
|
|
{
|
|
|
|
|
if (selectedTab.Equals(MonitorTab.Filter))
|
|
|
|
|
{
|
|
|
|
|
var y = ResolveFilterY(r, yField.Name!);
|
|
|
|
|
if (!y.HasValue) continue;
|
|
|
|
|
|
|
|
|
|
series.Points.Add(new DataPoint(
|
|
|
|
|
DateTimeAxis.ToDouble(r.RecordedTime),
|
|
|
|
|
y.Value));
|
|
|
|
|
|
|
|
|
|
if (series.Points.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
// 트래커 포맷: 시간, 수조, 지표, 값
|
|
|
|
|
series.TrackerFormatString =
|
|
|
|
|
$"시간: {{2:HH:mm}}\n{yField.Display}: {{4:0.###}}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (selectedTab.Equals(MonitorTab.Sterilizer))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Model.Series.Add(series);
|
|
|
|
|
Model.InvalidatePlot(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double? ResolveTankY(WaterQualityVO vo, string fieldName)
|
|
|
|
|
{
|
|
|
|
|
return fieldName switch
|
|
|
|
|
{
|
|
|
|
|
@ -98,5 +162,20 @@ namespace SmartAquaViewer.ViewModel
|
|
|
|
|
_ => null
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double? ResolveFilterY(WaterQualityVO vo, string fieldName)
|
|
|
|
|
{
|
|
|
|
|
return fieldName switch
|
|
|
|
|
{
|
|
|
|
|
"Filtering.SumpPH" => vo.Filtering.SumpPH,
|
|
|
|
|
"Filtering.SumpORP" => vo.Filtering.SumpORP,
|
|
|
|
|
"Filtering.SumpWaterLevel" => vo.Filtering.SumpWaterLevel,
|
|
|
|
|
"Filtering.SumpFlowRate" => vo.Filtering.SumpFlowRate,
|
|
|
|
|
"Filtering.SumpTemperature" => vo.Filtering.SumpTemperature,
|
|
|
|
|
"Filtering.FlowRate" => vo.Filtering.FlowRate,
|
|
|
|
|
"Filtering.HeatPumpTemperature" => vo.Filtering.HeatPumpTemperature,
|
|
|
|
|
_ => null
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|