diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index 0b9d5ad..d1517a5 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:oxy="http://oxyplot.org/wpf"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
Width="800"
@@ -89,7 +90,7 @@
Value="{Binding LeftNoiseValue, StringFormat={}{0}}" />
-
+
@@ -159,10 +160,7 @@
Value="{Binding RightNoiseValue, StringFormat={}{0}}" />
-
+
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index 0b9d5ad..d1517a5 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:oxy="http://oxyplot.org/wpf"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
Width="800"
@@ -89,7 +90,7 @@
Value="{Binding LeftNoiseValue, StringFormat={}{0}}" />
-
+
@@ -159,10 +160,7 @@
Value="{Binding RightNoiseValue, StringFormat={}{0}}" />
-
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index c4042d1..138f787 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,68 +1,12 @@
-using System.Drawing;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using Correlator.DataService;
-using Correlator.Events;
+using System.Windows.Controls;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog(ISerialPortService serialPortService)
+ public DetectNoiseDialog()
{
InitializeComponent();
-
- serialPortService.DetectNoiseEvent += Handle_DetectNoise;
-
- //禁用XY缩放
- RedScottplotView.Configuration.LockHorizontalAxis = true;
- RedScottplotView.Configuration.LockVerticalAxis = true;
- RedScottplotView.Configuration.ScrollWheelZoom = false;
- RedScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- RedScottplotView.Plot.Grid(false);
- //四周边距
- RedScottplotView.Plot.XAxis.Layout(-5);
- RedScottplotView.Plot.YAxis.Layout(-5);
-
- // ######################################################################################
-
- //禁用XY缩放
- BlueScottplotView.Configuration.LockHorizontalAxis = true;
- BlueScottplotView.Configuration.LockVerticalAxis = true;
- BlueScottplotView.Configuration.ScrollWheelZoom = false;
- BlueScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- BlueScottplotView.Plot.Grid(false);
- //四周边距
- BlueScottplotView.Plot.XAxis.Layout(-5);
- BlueScottplotView.Plot.YAxis.Layout(-5);
- }
-
- private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
- {
- Application.Current.Dispatcher.Invoke(delegate
- {
- RedScottplotView.Plot.Clear();
- RedScottplotView.Refresh();
-
- var leftDeviceDataArray = args.LeftDeviceDataArray;
- //渲染波形
- RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
- RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- RedScottplotView.Plot.AxisAuto();
- RedScottplotView.Refresh();
-
- BlueScottplotView.Plot.Clear();
- BlueScottplotView.Refresh();
- var rightDeviceDataArray = args.RightDeviceDataArray;
- //渲染波形
- BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
- BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- BlueScottplotView.Plot.AxisAuto();
- BlueScottplotView.Refresh();
- });
}
}
}
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index 0b9d5ad..d1517a5 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:oxy="http://oxyplot.org/wpf"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
Width="800"
@@ -89,7 +90,7 @@
Value="{Binding LeftNoiseValue, StringFormat={}{0}}" />
-
+
@@ -159,10 +160,7 @@
Value="{Binding RightNoiseValue, StringFormat={}{0}}" />
-
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index c4042d1..138f787 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,68 +1,12 @@
-using System.Drawing;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using Correlator.DataService;
-using Correlator.Events;
+using System.Windows.Controls;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog(ISerialPortService serialPortService)
+ public DetectNoiseDialog()
{
InitializeComponent();
-
- serialPortService.DetectNoiseEvent += Handle_DetectNoise;
-
- //禁用XY缩放
- RedScottplotView.Configuration.LockHorizontalAxis = true;
- RedScottplotView.Configuration.LockVerticalAxis = true;
- RedScottplotView.Configuration.ScrollWheelZoom = false;
- RedScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- RedScottplotView.Plot.Grid(false);
- //四周边距
- RedScottplotView.Plot.XAxis.Layout(-5);
- RedScottplotView.Plot.YAxis.Layout(-5);
-
- // ######################################################################################
-
- //禁用XY缩放
- BlueScottplotView.Configuration.LockHorizontalAxis = true;
- BlueScottplotView.Configuration.LockVerticalAxis = true;
- BlueScottplotView.Configuration.ScrollWheelZoom = false;
- BlueScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- BlueScottplotView.Plot.Grid(false);
- //四周边距
- BlueScottplotView.Plot.XAxis.Layout(-5);
- BlueScottplotView.Plot.YAxis.Layout(-5);
- }
-
- private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
- {
- Application.Current.Dispatcher.Invoke(delegate
- {
- RedScottplotView.Plot.Clear();
- RedScottplotView.Refresh();
-
- var leftDeviceDataArray = args.LeftDeviceDataArray;
- //渲染波形
- RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
- RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- RedScottplotView.Plot.AxisAuto();
- RedScottplotView.Refresh();
-
- BlueScottplotView.Plot.Clear();
- BlueScottplotView.Refresh();
- var rightDeviceDataArray = args.RightDeviceDataArray;
- //渲染波形
- BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
- BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- BlueScottplotView.Plot.AxisAuto();
- BlueScottplotView.Refresh();
- });
}
}
}
\ No newline at end of file
diff --git a/Correlator/Events/CorrelatorDataEventArgs.cs b/Correlator/Events/CorrelatorDataEventArgs.cs
index 3f533f1..14dbe00 100644
--- a/Correlator/Events/CorrelatorDataEventArgs.cs
+++ b/Correlator/Events/CorrelatorDataEventArgs.cs
@@ -1,21 +1,15 @@
using System;
+using Correlator.Model;
namespace Correlator.Events
{
public class CorrelatorDataEventArgs : EventArgs
{
- public double LeftNoiseSumValue { get; }
- public double[] LeftDeviceDataArray { get; set; }
- public double RightNoiseSumValue { get; }
- public double[] RightDeviceDataArray { get; set; }
+ public CorrelatorDataModel DataModel { get; }
- public CorrelatorDataEventArgs(
- double leftNoiseSumValue, double[] leftArray, double rightNoiseSumValue, double[] rightArray)
+ public CorrelatorDataEventArgs(CorrelatorDataModel dataModel)
{
- LeftNoiseSumValue = leftNoiseSumValue;
- LeftDeviceDataArray = leftArray;
- RightNoiseSumValue = rightNoiseSumValue;
- RightDeviceDataArray = rightArray;
+ DataModel = dataModel;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index 0b9d5ad..d1517a5 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:oxy="http://oxyplot.org/wpf"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
Width="800"
@@ -89,7 +90,7 @@
Value="{Binding LeftNoiseValue, StringFormat={}{0}}" />
-
+
@@ -159,10 +160,7 @@
Value="{Binding RightNoiseValue, StringFormat={}{0}}" />
-
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index c4042d1..138f787 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,68 +1,12 @@
-using System.Drawing;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using Correlator.DataService;
-using Correlator.Events;
+using System.Windows.Controls;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog(ISerialPortService serialPortService)
+ public DetectNoiseDialog()
{
InitializeComponent();
-
- serialPortService.DetectNoiseEvent += Handle_DetectNoise;
-
- //禁用XY缩放
- RedScottplotView.Configuration.LockHorizontalAxis = true;
- RedScottplotView.Configuration.LockVerticalAxis = true;
- RedScottplotView.Configuration.ScrollWheelZoom = false;
- RedScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- RedScottplotView.Plot.Grid(false);
- //四周边距
- RedScottplotView.Plot.XAxis.Layout(-5);
- RedScottplotView.Plot.YAxis.Layout(-5);
-
- // ######################################################################################
-
- //禁用XY缩放
- BlueScottplotView.Configuration.LockHorizontalAxis = true;
- BlueScottplotView.Configuration.LockVerticalAxis = true;
- BlueScottplotView.Configuration.ScrollWheelZoom = false;
- BlueScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- BlueScottplotView.Plot.Grid(false);
- //四周边距
- BlueScottplotView.Plot.XAxis.Layout(-5);
- BlueScottplotView.Plot.YAxis.Layout(-5);
- }
-
- private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
- {
- Application.Current.Dispatcher.Invoke(delegate
- {
- RedScottplotView.Plot.Clear();
- RedScottplotView.Refresh();
-
- var leftDeviceDataArray = args.LeftDeviceDataArray;
- //渲染波形
- RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
- RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- RedScottplotView.Plot.AxisAuto();
- RedScottplotView.Refresh();
-
- BlueScottplotView.Plot.Clear();
- BlueScottplotView.Refresh();
- var rightDeviceDataArray = args.RightDeviceDataArray;
- //渲染波形
- BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
- BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- BlueScottplotView.Plot.AxisAuto();
- BlueScottplotView.Refresh();
- });
}
}
}
\ No newline at end of file
diff --git a/Correlator/Events/CorrelatorDataEventArgs.cs b/Correlator/Events/CorrelatorDataEventArgs.cs
index 3f533f1..14dbe00 100644
--- a/Correlator/Events/CorrelatorDataEventArgs.cs
+++ b/Correlator/Events/CorrelatorDataEventArgs.cs
@@ -1,21 +1,15 @@
using System;
+using Correlator.Model;
namespace Correlator.Events
{
public class CorrelatorDataEventArgs : EventArgs
{
- public double LeftNoiseSumValue { get; }
- public double[] LeftDeviceDataArray { get; set; }
- public double RightNoiseSumValue { get; }
- public double[] RightDeviceDataArray { get; set; }
+ public CorrelatorDataModel DataModel { get; }
- public CorrelatorDataEventArgs(
- double leftNoiseSumValue, double[] leftArray, double rightNoiseSumValue, double[] rightArray)
+ public CorrelatorDataEventArgs(CorrelatorDataModel dataModel)
{
- LeftNoiseSumValue = leftNoiseSumValue;
- LeftDeviceDataArray = leftArray;
- RightNoiseSumValue = rightNoiseSumValue;
- RightDeviceDataArray = rightArray;
+ DataModel = dataModel;
}
}
}
\ No newline at end of file
diff --git a/Correlator/ViewModels/DetectNoiseDialogViewModel.cs b/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
index 420bfb4..d335fbc 100644
--- a/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
+++ b/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
@@ -3,6 +3,8 @@
using Correlator.DataService;
using Correlator.Events;
using Correlator.Util;
+using OxyPlot;
+using OxyPlot.Series;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
@@ -33,6 +35,8 @@
}
}
+ public PlotModel RedDeviceData { get; set; }
+
private double _rightNoiseValue;
public double RightNoiseValue
@@ -45,6 +49,8 @@
}
}
+ public PlotModel BlueDeviceData { get; set; }
+
private string _detectState;
public string DetectState
@@ -72,6 +78,8 @@
private readonly ISerialPortService _serialPortService;
private readonly ICommandService _commandService;
+ private readonly LineSeries _redLineSeries;
+ private readonly LineSeries _blueLineSeries;
public DetectNoiseDialogViewModel(ISerialPortService serialPortService, ICommandService commandService)
{
@@ -82,12 +90,57 @@
_detectTimer.Tick += DetectEvent;
DetectNoiseCommand = new DelegateCommand(DetectNoise);
+
+ RedDeviceData = new PlotModel();
+ _redLineSeries = new LineSeries
+ {
+ Color = OxyColors.Green,
+ StrokeThickness = 1,
+ Title = "幅值"
+ };
+ RedDeviceData.Series.Add(_redLineSeries);
+
+ BlueDeviceData = new PlotModel();
+ _blueLineSeries = new LineSeries
+ {
+ Color = OxyColors.Green,
+ StrokeThickness = 1,
+ Title = "幅值"
+ };
+ BlueDeviceData.Series.Add(_blueLineSeries);
}
private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
{
- LeftNoiseValue = args.LeftNoiseSumValue;
- RightNoiseValue = args.RightNoiseSumValue;
+ var dataModel = args.DataModel;
+
+ //红色传感器数据
+ LeftNoiseValue = dataModel.LeftNoiseSumValue;
+ if (_redLineSeries.Points.Count != 0)
+ {
+ _redLineSeries.Points.Clear();
+ }
+
+ for (var i = 0; i < dataModel.LeftDeviceDataArray.Length; i++)
+ {
+ _redLineSeries.Points.Add(new DataPoint(i, dataModel.LeftDeviceDataArray[i]));
+ }
+
+ RedDeviceData.InvalidatePlot(true);
+
+ //蓝色传感器数据
+ RightNoiseValue = dataModel.RightNoiseSumValue;
+ if (_blueLineSeries.Points.Count != 0)
+ {
+ _blueLineSeries.Points.Clear();
+ }
+
+ for (var i = 0; i < dataModel.RightDeviceDataArray.Length; i++)
+ {
+ _blueLineSeries.Points.Add(new DataPoint(i, dataModel.RightDeviceDataArray[i]));
+ }
+
+ BlueDeviceData.InvalidatePlot(true);
}
private void DetectNoise()
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index 9f7b81d..8fd9997 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -109,6 +109,15 @@
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\OxyPlot.Core.2.2.0\lib\net462\OxyPlot.dll
+
+
+ ..\packages\OxyPlot.Wpf.2.2.0\lib\net462\OxyPlot.Wpf.dll
+
+
+ ..\packages\OxyPlot.Wpf.Shared.2.2.0\lib\net462\OxyPlot.Wpf.Shared.dll
+
..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll
@@ -118,6 +127,7 @@
..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll
+
..\packages\ScottPlot.4.1.60\lib\net462\ScottPlot.dll
@@ -158,6 +168,7 @@
..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
@@ -478,5 +489,7 @@
这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f1d0c21..2d48916 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -215,7 +215,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -226,7 +226,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
//发送消息计算数据
@@ -234,10 +234,7 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(
- _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
- _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
- );
+ var eventArgs = new CorrelatorDataEventArgs(_dataModel);
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
@@ -326,7 +323,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.LeftNoiseSumValue = noiseValue * 2;
+ _dataModel.LeftNoiseSumValue = noiseValue;
}
else
{
@@ -336,7 +333,7 @@
var noiseValue = 0.0;
Array.ForEach(realData, i => noiseValue += Math.Abs(i));
- _dataModel.RightNoiseSumValue = noiseValue * 2;
+ _dataModel.RightNoiseSumValue = noiseValue;
}
RuntimeCache.CorrelatorData = _dataModel;
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index 0b9d5ad..d1517a5 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:oxy="http://oxyplot.org/wpf"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
Width="800"
@@ -89,7 +90,7 @@
Value="{Binding LeftNoiseValue, StringFormat={}{0}}" />
-
+
@@ -159,10 +160,7 @@
Value="{Binding RightNoiseValue, StringFormat={}{0}}" />
-
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index c4042d1..138f787 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,68 +1,12 @@
-using System.Drawing;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using Correlator.DataService;
-using Correlator.Events;
+using System.Windows.Controls;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog(ISerialPortService serialPortService)
+ public DetectNoiseDialog()
{
InitializeComponent();
-
- serialPortService.DetectNoiseEvent += Handle_DetectNoise;
-
- //禁用XY缩放
- RedScottplotView.Configuration.LockHorizontalAxis = true;
- RedScottplotView.Configuration.LockVerticalAxis = true;
- RedScottplotView.Configuration.ScrollWheelZoom = false;
- RedScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- RedScottplotView.Plot.Grid(false);
- //四周边距
- RedScottplotView.Plot.XAxis.Layout(-5);
- RedScottplotView.Plot.YAxis.Layout(-5);
-
- // ######################################################################################
-
- //禁用XY缩放
- BlueScottplotView.Configuration.LockHorizontalAxis = true;
- BlueScottplotView.Configuration.LockVerticalAxis = true;
- BlueScottplotView.Configuration.ScrollWheelZoom = false;
- BlueScottplotView.Configuration.RightClickDragZoom = false;
- //去掉网格线
- BlueScottplotView.Plot.Grid(false);
- //四周边距
- BlueScottplotView.Plot.XAxis.Layout(-5);
- BlueScottplotView.Plot.YAxis.Layout(-5);
- }
-
- private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
- {
- Application.Current.Dispatcher.Invoke(delegate
- {
- RedScottplotView.Plot.Clear();
- RedScottplotView.Refresh();
-
- var leftDeviceDataArray = args.LeftDeviceDataArray;
- //渲染波形
- RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
- RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- RedScottplotView.Plot.AxisAuto();
- RedScottplotView.Refresh();
-
- BlueScottplotView.Plot.Clear();
- BlueScottplotView.Refresh();
- var rightDeviceDataArray = args.RightDeviceDataArray;
- //渲染波形
- BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
- BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
- BlueScottplotView.Plot.AxisAuto();
- BlueScottplotView.Refresh();
- });
}
}
}
\ No newline at end of file
diff --git a/Correlator/Events/CorrelatorDataEventArgs.cs b/Correlator/Events/CorrelatorDataEventArgs.cs
index 3f533f1..14dbe00 100644
--- a/Correlator/Events/CorrelatorDataEventArgs.cs
+++ b/Correlator/Events/CorrelatorDataEventArgs.cs
@@ -1,21 +1,15 @@
using System;
+using Correlator.Model;
namespace Correlator.Events
{
public class CorrelatorDataEventArgs : EventArgs
{
- public double LeftNoiseSumValue { get; }
- public double[] LeftDeviceDataArray { get; set; }
- public double RightNoiseSumValue { get; }
- public double[] RightDeviceDataArray { get; set; }
+ public CorrelatorDataModel DataModel { get; }
- public CorrelatorDataEventArgs(
- double leftNoiseSumValue, double[] leftArray, double rightNoiseSumValue, double[] rightArray)
+ public CorrelatorDataEventArgs(CorrelatorDataModel dataModel)
{
- LeftNoiseSumValue = leftNoiseSumValue;
- LeftDeviceDataArray = leftArray;
- RightNoiseSumValue = rightNoiseSumValue;
- RightDeviceDataArray = rightArray;
+ DataModel = dataModel;
}
}
}
\ No newline at end of file
diff --git a/Correlator/ViewModels/DetectNoiseDialogViewModel.cs b/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
index 420bfb4..d335fbc 100644
--- a/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
+++ b/Correlator/ViewModels/DetectNoiseDialogViewModel.cs
@@ -3,6 +3,8 @@
using Correlator.DataService;
using Correlator.Events;
using Correlator.Util;
+using OxyPlot;
+using OxyPlot.Series;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
@@ -33,6 +35,8 @@
}
}
+ public PlotModel RedDeviceData { get; set; }
+
private double _rightNoiseValue;
public double RightNoiseValue
@@ -45,6 +49,8 @@
}
}
+ public PlotModel BlueDeviceData { get; set; }
+
private string _detectState;
public string DetectState
@@ -72,6 +78,8 @@
private readonly ISerialPortService _serialPortService;
private readonly ICommandService _commandService;
+ private readonly LineSeries _redLineSeries;
+ private readonly LineSeries _blueLineSeries;
public DetectNoiseDialogViewModel(ISerialPortService serialPortService, ICommandService commandService)
{
@@ -82,12 +90,57 @@
_detectTimer.Tick += DetectEvent;
DetectNoiseCommand = new DelegateCommand(DetectNoise);
+
+ RedDeviceData = new PlotModel();
+ _redLineSeries = new LineSeries
+ {
+ Color = OxyColors.Green,
+ StrokeThickness = 1,
+ Title = "幅值"
+ };
+ RedDeviceData.Series.Add(_redLineSeries);
+
+ BlueDeviceData = new PlotModel();
+ _blueLineSeries = new LineSeries
+ {
+ Color = OxyColors.Green,
+ StrokeThickness = 1,
+ Title = "幅值"
+ };
+ BlueDeviceData.Series.Add(_blueLineSeries);
}
private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
{
- LeftNoiseValue = args.LeftNoiseSumValue;
- RightNoiseValue = args.RightNoiseSumValue;
+ var dataModel = args.DataModel;
+
+ //红色传感器数据
+ LeftNoiseValue = dataModel.LeftNoiseSumValue;
+ if (_redLineSeries.Points.Count != 0)
+ {
+ _redLineSeries.Points.Clear();
+ }
+
+ for (var i = 0; i < dataModel.LeftDeviceDataArray.Length; i++)
+ {
+ _redLineSeries.Points.Add(new DataPoint(i, dataModel.LeftDeviceDataArray[i]));
+ }
+
+ RedDeviceData.InvalidatePlot(true);
+
+ //蓝色传感器数据
+ RightNoiseValue = dataModel.RightNoiseSumValue;
+ if (_blueLineSeries.Points.Count != 0)
+ {
+ _blueLineSeries.Points.Clear();
+ }
+
+ for (var i = 0; i < dataModel.RightDeviceDataArray.Length; i++)
+ {
+ _blueLineSeries.Points.Add(new DataPoint(i, dataModel.RightDeviceDataArray[i]));
+ }
+
+ BlueDeviceData.InvalidatePlot(true);
}
private void DetectNoise()
diff --git a/Correlator/packages.config b/Correlator/packages.config
index cd851a5..599e76e 100644
--- a/Correlator/packages.config
+++ b/Correlator/packages.config
@@ -3,6 +3,10 @@
+
+
@@ -12,6 +16,9 @@
+
+
+