This commit is contained in:
2024-07-05 17:43:02 +08:00
parent 08f7f9c01a
commit 1e0cba7b53
10 changed files with 388 additions and 117 deletions

View File

@@ -5,6 +5,7 @@ using Arction.Wpf.Charting.SeriesXY;
using Arction.Wpf.Charting.Views.ViewXY;
using CapMachine.Wpf.Models;
using CapMachine.Wpf.PrismEvent;
using CapMachine.Wpf.Services;
using CapMachine.Wpf.ViewModels;
using NLog;
using Prism.Events;
@@ -24,16 +25,21 @@ namespace CapMachine.Wpf.Views
/// 定时器
/// </summary>
static System.Timers.Timer CurTimer { get; set; }
private IEventAggregator _EventAggregator { get; set; }
public MachineRtDataService MachineRtDataService { get; }
/// <summary>
/// 曲线配置
/// </summary>
public ChartConfig ChartConfigInfo { get; set; }
public ChartConfig ChartConfigInfo { get; set; }
public RealTimeChartView(IEventAggregator eventAggregator)
/// <summary>
/// 实例化函数
/// </summary>
/// <param name="eventAggregator"></param>
/// <param name="machineRtDataService"></param>
public RealTimeChartView(IEventAggregator eventAggregator, MachineRtDataService machineRtDataService)
{
InitializeComponent();
@@ -44,7 +50,10 @@ namespace CapMachine.Wpf.Views
//事件服务
_EventAggregator = eventAggregator;
MachineRtDataService = machineRtDataService;
_EventAggregator.GetEvent<ChartRtEvent>().Subscribe(GetChartRtEvent);
_EventAggregator.GetEvent<ChartRtActionEvent>().Subscribe(ReLoadData);
var CreateAxisY = new AxisY();
CreateAxisY.Title.Text = Name;
@@ -56,6 +65,17 @@ namespace CapMachine.Wpf.Views
ListChartRtSeries.Add(new ChartRtSeries(CreateAxisY, lightningChart1, "室温0"));
}
/// <summary>
/// 重新加载数据
/// 更新曲线和Y轴设置
/// </summary>
/// <param name="type"></param>
/// <exception cref="NotImplementedException"></exception>
private void ReLoadData(ChartActionType type)
{
throw new NotImplementedException();
}
/// <summary>
/// 获取曲线的实时值
@@ -82,7 +102,7 @@ namespace CapMachine.Wpf.Views
}
});
}