总览卡曲线

This commit is contained in:
sc committed 2025-09-01 00:54:43 +08:00
commit acdfc68def
3 files changed
+44 -10

No files matched your search

+20 -4
View File
@@ -13,6 +13,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using System.Linq;
using System.Runtime.Serialization;
@@ -105,10 +106,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
DataContext = this;
}
public void DataAdd(double dat)
public void DataAdd(DateTime dateTime, double dat)
{
DateTime dateTime = DateTime.Now;
Dispatcher.Invoke(() =>
{
// 添加新数据点
@@ -123,7 +122,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
MTH_values.RemoveAt(0);
}
});
}
}
public void DataROW(DataRow[] dataRows)
{
DateTime dateTime = DateTime.Now;
foreach (DataRow row in dataRows)
{
// 添加新数据点
MTH_values.Add(new DateTimePoint((DateTime)row["DateTime"], (double)row["DAT"]));
}
Dispatcher.Invoke(() =>
{
// 更新X轴范围,始终保持最近6小时
XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
});
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{