diff --git a/BPASmartClient.Academy/ColorResource.xaml b/BPASmartClient.Academy/ColorResource.xaml
index 00df0592..b61a15f4 100644
--- a/BPASmartClient.Academy/ColorResource.xaml
+++ b/BPASmartClient.Academy/ColorResource.xaml
@@ -10,4 +10,16 @@
#ff00ff
#0000ff
#A26189
+
+ #ff0000
+ #90ee90
+ #00bfff
+ #ffff00
+ #ffa500
+ #9b30ff
+ #00ffff
+ #7FFF00
+ #ff00ff
+ #0000ff
+ #A26189
\ No newline at end of file
diff --git a/BPASmartClient.Academy/View/DeviceChart50LView.xaml b/BPASmartClient.Academy/View/DeviceChart50LView.xaml
index 47555b69..cc7ea2b1 100644
--- a/BPASmartClient.Academy/View/DeviceChart50LView.xaml
+++ b/BPASmartClient.Academy/View/DeviceChart50LView.xaml
@@ -176,11 +176,12 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs b/BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
index 3a64ffcd..1d1e9585 100644
--- a/BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
+++ b/BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
@@ -20,6 +20,7 @@ using ThingsGateway.Foundation.Core;
using BPASmartClient.Academy._50L;
using ThingsGateway.Foundation.Extension.String;
using BPASmartClient.CustomResource.UserControls.MessageShow;
+using OxyPlot.Wpf;
namespace BPASmartClient.Academy.View
{
@@ -28,9 +29,9 @@ namespace BPASmartClient.Academy.View
///
public partial class DeviceChart50LView : UserControl
{
- //private volatile static DeviceChart50LView _Instance;
- //public static DeviceChart50LView GetInstance => _Instance ?? (_Instance = new DeviceChart50LView());
- public DeviceChart50LView()
+ private volatile static DeviceChart50LView _Instance;
+ public static DeviceChart50LView GetInstance => _Instance ?? (_Instance = new DeviceChart50LView());
+ private DeviceChart50LView()
{
InitializeComponent();
//this.DataContext = DeviceChart50LViewModel.GetInstance;
@@ -42,13 +43,13 @@ namespace BPASmartClient.Academy.View
{
var datas = SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id);
- if (datas is null || datas.Count==0)
+ if (datas is null || datas.Count==0 || e.Source is not PlotView)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error,App.MainWindow,"无数据","当前无曲线数据。");
return;
}
ooo.Visibility = Visibility.Collapsed;
- CartesianChart liveCharts = sender as CartesianChart;
+
double min = DateTimeAxis.ToDouble(DateTime.MinValue);
DateTime startTime = datas.Select(x => x.Createtime).Min();
@@ -57,7 +58,8 @@ namespace BPASmartClient.Academy.View
//double max = DateTimeAxis.ToDouble(DateTime.Now);
double maxrange = max - min;
- switch (liveCharts.ToolTip)
+ PlotView charts = e.Source as PlotView;
+ switch (charts.ToolTip)
{
case "温度曲线":
{
@@ -66,7 +68,7 @@ namespace BPASmartClient.Academy.View
chartGrid.Visibility = Visibility.Visible;
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
List reactorTemp = new();
@@ -101,7 +103,7 @@ namespace BPASmartClient.Academy.View
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "压力/Mpa", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
@@ -135,7 +137,7 @@ namespace BPASmartClient.Academy.View
chartGrid.Visibility = Visibility.Visible;
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "比例阀开度/%", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
List point1 = new();
@@ -163,7 +165,7 @@ namespace BPASmartClient.Academy.View
chartGrid.Visibility = Visibility.Visible;
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "流量", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
@@ -198,7 +200,7 @@ namespace BPASmartClient.Academy.View
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
@@ -232,7 +234,7 @@ namespace BPASmartClient.Academy.View
chartGrid.Visibility = Visibility.Visible;
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "湿度", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
List point1 = new();
@@ -260,7 +262,7 @@ namespace BPASmartClient.Academy.View
if (!(plotModel.Axes.Count > 0))
{
- plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
+ plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "HH:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "角度/°", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
@@ -287,13 +289,24 @@ namespace BPASmartClient.Academy.View
}
private void AddOxyLineSeries(string title,OxyColor markerFill, List dataPoints)
{
+
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries()
- { LineStyle = LineStyle.Solid,
+ {
+ LineStyle = title.Contains("_参考")?LineStyle.Dot : LineStyle.Solid,
Title = title,
MarkerFill = markerFill,
MarkerSize = 2,
LineLegendPosition = OxyPlot.Series.LineLegendPosition.End
};
+ try
+ {
+ var scb = Application.Current.TryFindResource(title) as SolidColorBrush;
+ var color = scb.ToOxyColor();
+ templine.Color = color;
+ }
+ catch (Exception)
+ {
+ }
List twValues = new List();
foreach (var item in dataPoints)
{
diff --git a/BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs b/BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
index dfc21fe0..3173b473 100644
--- a/BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
+++ b/BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
@@ -18,6 +18,7 @@ using System.Windows.Media;
using System.Windows;
using OxyLineSeries = OxyPlot.Series.LineSeries;
using OxyPlot.Wpf;
+using ThingsGateway.Foundation.Extension.String;
namespace BPASmartClient.Academy.ViewModel
{
@@ -34,7 +35,7 @@ namespace BPASmartClient.Academy.ViewModel
Charting.For(mapper);
DataFeedback = SqliteOperate.GetInstance.DataFeedBacks;
-
+ InitialOxyChart();
LoadNames(SqliteOperate.GetInstance.FindNames(SelectTime));
Select = new BPARelayCommand(() => { LoadNames(SqliteOperate.GetInstance.FindNames(SelectTime)); });
@@ -55,6 +56,34 @@ namespace BPASmartClient.Academy.ViewModel
{
while (!_tokenSource.IsCancellationRequested)
{
+ #region 实时数据刷新
+ for (int i = 0; i < PlotModels.Count; i++)
+ {
+ for (int j = 0; j < PlotModels[i].Series.Count; j++)
+ {
+ ((OxyLineSeries)(PlotModels[i].Series[j])).Points.Clear();
+ }
+ }
+ RefreshOxyPlotSeries(0, 0,DataFeedback.Temperature);
+ RefreshOxyPlotSeries(0, 1, DataFeedback.CondensateWaterTemperature);
+
+ RefreshOxyPlotSeries(1, 0, DataFeedback.SteamPressure);
+ RefreshOxyPlotSeries(1, 1, DataFeedback.ReactPressure);
+
+ RefreshOxyPlotSeries(2, 0, DataFeedback.ProportionalValveOpening);
+
+ RefreshOxyPlotSeries(3, 0, DataFeedback.SteamFlowRate);
+ RefreshOxyPlotSeries(3, 1, DataFeedback.NegativePressureFlowRate);
+
+ RefreshOxyPlotSeries(4, 0, DataFeedback.WeighingWaterTankWeight);
+ RefreshOxyPlotSeries(4, 1, DataFeedback.BrineTankWeight);
+
+ RefreshOxyPlotSeries(5, 0, DataFeedback.CondensateWaterHumidity);
+
+ RefreshOxyPlotSeries(6, 0, DataFeedback.ReactEncoderValue);
+
+ #endregion
+ #region 参照数据刷新
if (ReferenceData != null && ReferenceData.Temperature.Count > 0)
{
DateTime startTime = DataFeedback.Temperature.Min(x => x.DateTime);
@@ -66,7 +95,7 @@ namespace BPASmartClient.Academy.ViewModel
//PartReferenceData.Temperature.RemoveWhere(x => x.DateTime < startTime);
//PartReferenceData.SteamPressure.RemoveWhere(x => x.DateTime < startTime);
- //PartReferenceData.SteamPressure.RemoveWhere(x => x.DateTime < startTime);
+ //PartReferenceData.SteamFlowRate.RemoveWhere(x => x.DateTime < startTime);
//PartReferenceData.CondensateWaterTemperature.RemoveWhere(x => x.DateTime < startTime);
//PartReferenceData.CondensateWaterHumidity.RemoveWhere(x => x.DateTime < startTime);
//PartReferenceData.NegativePressureFlowRate.RemoveWhere(x => x.DateTime < startTime);
@@ -78,7 +107,7 @@ namespace BPASmartClient.Academy.ViewModel
PartReferenceData.Temperature.Clear();
PartReferenceData.SteamPressure.Clear();
- PartReferenceData.SteamPressure.Clear();
+ PartReferenceData.SteamFlowRate.Clear();
PartReferenceData.CondensateWaterTemperature.Clear();
PartReferenceData.CondensateWaterHumidity.Clear();
PartReferenceData.NegativePressureFlowRate.Clear();
@@ -92,7 +121,7 @@ namespace BPASmartClient.Academy.ViewModel
{
PartReferenceData.Temperature.AddRange(ReferenceData.Temperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
- PartReferenceData.SteamPressure.AddRange(ReferenceData.SteamFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
+ PartReferenceData.SteamFlowRate.AddRange(ReferenceData.SteamFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
PartReferenceData.CondensateWaterTemperature.AddRange(ReferenceData.CondensateWaterTemperature.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
PartReferenceData.CondensateWaterHumidity.AddRange(ReferenceData.CondensateWaterHumidity.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
PartReferenceData.NegativePressureFlowRate.AddRange(ReferenceData.NegativePressureFlowRate.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
@@ -102,7 +131,29 @@ namespace BPASmartClient.Academy.ViewModel
PartReferenceData.BrineTankWeight.AddRange(ReferenceData.BrineTankWeight.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
PartReferenceData.ReactPressure.AddRange(ReferenceData.ReactPressure.Where(x => x.DateTime >= startTime && x.DateTime <= endTime));
}
+ RefreshOxyPlotSeries(0, 2, PartReferenceData.Temperature);
+ RefreshOxyPlotSeries(0, 3, PartReferenceData.CondensateWaterTemperature);
+
+ RefreshOxyPlotSeries(1, 2, PartReferenceData.SteamPressure);
+ RefreshOxyPlotSeries(1, 3, PartReferenceData.ReactPressure);
+
+ RefreshOxyPlotSeries(2, 1, PartReferenceData.ProportionalValveOpening);
+
+ RefreshOxyPlotSeries(3, 2, PartReferenceData.SteamFlowRate);
+ RefreshOxyPlotSeries(3, 3, PartReferenceData.NegativePressureFlowRate);
+ RefreshOxyPlotSeries(4, 2, PartReferenceData.WeighingWaterTankWeight);
+ RefreshOxyPlotSeries(4, 3, PartReferenceData.BrineTankWeight);
+
+ RefreshOxyPlotSeries(5, 1, PartReferenceData.CondensateWaterHumidity);
+
+ RefreshOxyPlotSeries(6, 1, PartReferenceData.ReactEncoderValue);
+ }
+ #endregion
+
+ for (int i = 0; i < PlotModels.Count; i++)
+ {
+ PlotModels[i].InvalidatePlot(true);
}
//await Task.Delay(2000);
Thread.Sleep(2000);
@@ -115,7 +166,12 @@ namespace BPASmartClient.Academy.ViewModel
_tokenSource.Cancel(false);
}
+ #region Private Fields
private CancellationTokenSource _tokenSource;
+ Stopwatch sw = new Stopwatch();
+ #endregion
+
+ #region Properties
private DataFeedBack_50 dataFeedback;
public DataFeedBack_50 DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } }
@@ -134,14 +190,31 @@ namespace BPASmartClient.Academy.ViewModel
public Func doubleFormatter { get; set; } = value => value.ToString("F2");
- private Visibility _referenceWindownVisiblity=Visibility.Collapsed;
+ private Visibility _referenceWindownVisiblity = Visibility.Collapsed;
public Visibility ReferenceWindownVisiblity { get { return _referenceWindownVisiblity; } set { _referenceWindownVisiblity = value; OnPropertyChanged(); } }
public double AxisStep { get; set; } = TimeSpan.FromSeconds(2).Ticks;
public double AxisUnit { get; set; } = TimeSpan.TicksPerSecond;
- Stopwatch sw = new Stopwatch();
+ public ObservableCollection PlotModels { get => _plotModels; set { _plotModels = value; OnPropertyChanged(); } }
+ private ObservableCollection _plotModels;
+
+ public ObservableCollection RecipeCharts { get; set; } = new ObservableCollection();
+
+ public DateTime SelectTime { get { return _mSelectTime; } set { _mSelectTime = value; OnPropertyChanged(); } }
+ private DateTime _mSelectTime = DateTime.Now;
+
+ public string ProductNum { get { return _mProductNum; } set { _mProductNum = value; OnPropertyChanged(); } }
+ private string _mProductNum;
+
+
+ public Visibility LoadingVis { get { return _mLoadingVis; } set { _mLoadingVis = value; OnPropertyChanged(); } }
+ private Visibility _mLoadingVis = Visibility.Collapsed;
+ #endregion
+
+
+ #region Parivate Methods
private void OxyInit(string Id)
{
ReferenceData = new();
@@ -167,7 +240,14 @@ namespace BPASmartClient.Academy.ViewModel
}
-
+ private void RefreshOxyPlotSeries(int plotIndex,int seriesIndex,ChartValues dataValues)
+ {
+ if (plotIndex>=0 && plotIndex <= PlotModels.Count && seriesIndex>=0 && seriesIndex <= PlotModels[plotIndex].Series.Count && dataValues != null && dataValues.Count>0)
+ {
+ ((OxyLineSeries)(PlotModels[plotIndex].Series[seriesIndex])).Points
+ .AddRange(dataValues.Select(x => new DataPoint(DateTimeAxis.ToDouble(x.DateTime), Math.Round(x.Value,2))));
+ }
+ }
private void LoadNames(List data)
{
if (data == null) return;
@@ -187,21 +267,164 @@ namespace BPASmartClient.Academy.ViewModel
Id = item.Id,
});
});
- }
+ }
- public ObservableCollection RecipeCharts { get; set; } = new ObservableCollection();
+ private void InitialOxyChart()
+ {
+ PlotModels = new();
+
+ #region 创建曲线
+ OxyLineSeries temperatureSeries = CreateLine("反应釜温度");
+ OxyLineSeries steamPressureSeries = CreateLine("反应釜蒸汽压力");
+ OxyLineSeries steamFlowRateSeries = CreateLine("反应釜蒸汽流量");
+ OxyLineSeries condensateWaterTemperatureSeries = CreateLine("冷凝水罐温度");
+ OxyLineSeries condensateWaterHumiditySeries = CreateLine("冷凝水罐湿度");
+ OxyLineSeries negativePressureFlowRateSeries = CreateLine("负压流量");
+ OxyLineSeries weighingWaterTankWeightSeries = CreateLine("称重水罐重量");
+ OxyLineSeries reactEncoderValueSeries = CreateLine("反应釜编码器值");
+ OxyLineSeries proportionalValveOpeningSeries = CreateLine("比例阀实际开度");
+ OxyLineSeries brineTankWeightSeries = CreateLine("卤水配制罐重量");
+ OxyLineSeries reactPressureSeries = CreateLine("反应釜压力");
+
+ OxyLineSeries reftemperatureSeries = CreateLine("反应釜温度_参考",LineStyle.Dot);
+ OxyLineSeries refsteamPressureSeries = CreateLine("反应釜蒸汽压力_参考",LineStyle.Dot);
+ OxyLineSeries refsteamFlowRateSeries = CreateLine("反应釜蒸汽流量_参考",LineStyle.Dot);
+ OxyLineSeries refcondensateWaterTemperatureSeries = CreateLine("冷凝水罐温度_参考",LineStyle.Dot);
+ OxyLineSeries refcondensateWaterHumiditySeries = CreateLine("冷凝水罐湿度_参考",LineStyle.Dot);
+ OxyLineSeries refnegativePressureFlowRateSeries = CreateLine("负压流量_参考",LineStyle.Dot);
+ OxyLineSeries refweighingWaterTankWeightSeries = CreateLine("称重水罐重量_参考",LineStyle.Dot);
+ OxyLineSeries refreactEncoderValueSeries = CreateLine("反应釜编码器值_参考",LineStyle.Dot);
+ OxyLineSeries refproportionalValveOpeningSeries = CreateLine("比例阀实际开度_参考",LineStyle.Dot);
+ OxyLineSeries refbrineTankWeightSeries = CreateLine("卤水配制罐重量_参考",LineStyle.Dot);
+ OxyLineSeries refreactPressureSeries = CreateLine("反应釜压力_参考",LineStyle.Dot);
+ #endregion
+ #region 温度曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("温度/℃",0,200);
+ tempPlotModel.Series.Add(temperatureSeries);
+ tempPlotModel.Series.Add(condensateWaterTemperatureSeries);
- public DateTime SelectTime { get { return _mSelectTime; } set { _mSelectTime = value; OnPropertyChanged(); } }
- private DateTime _mSelectTime = DateTime.Now;
+ tempPlotModel.Series.Add(reftemperatureSeries);
+ tempPlotModel.Series.Add(refcondensateWaterTemperatureSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 压力曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("压力/Mpa",-0.1,0.6);
+ tempPlotModel.Series.Add(steamPressureSeries);
+ tempPlotModel.Series.Add(reactPressureSeries);
- public string ProductNum { get { return _mProductNum; } set { _mProductNum = value; OnPropertyChanged(); } }
- private string _mProductNum;
+ tempPlotModel.Series.Add(refsteamPressureSeries);
+ tempPlotModel.Series.Add(refreactPressureSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 比例阀开度曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("比例阀开度/%",0,100);
+ tempPlotModel.Series.Add(proportionalValveOpeningSeries);
+ tempPlotModel.Series.Add(refproportionalValveOpeningSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 流量曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("流量",0,100);
+ tempPlotModel.Series.Add(steamFlowRateSeries);
+ tempPlotModel.Series.Add(negativePressureFlowRateSeries);
+
+ tempPlotModel.Series.Add(refsteamFlowRateSeries);
+ tempPlotModel.Series.Add(refnegativePressureFlowRateSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 重量曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("重量/kg",0,50);
+ tempPlotModel.Series.Add(weighingWaterTankWeightSeries);
+ tempPlotModel.Series.Add(brineTankWeightSeries);
+
+ tempPlotModel.Series.Add(refweighingWaterTankWeightSeries);
+ tempPlotModel.Series.Add(refbrineTankWeightSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 湿度曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("湿度/%RH",0,200);
+ tempPlotModel.Series.Add(condensateWaterHumiditySeries);
+
+ tempPlotModel.Series.Add(refcondensateWaterHumiditySeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ #region 反应釜角度曲线
+ {
+ PlotModel tempPlotModel = CreatePlotModel("角度/°",0,360);
+ tempPlotModel.Series.Add(reactEncoderValueSeries);
+
+ tempPlotModel.Series.Add(refreactEncoderValueSeries);
+ PlotModels.Add(tempPlotModel);
+ }
+ #endregion
+ }
+ private PlotModel CreatePlotModel(string axisYTitle,double axisYMinValue,double axisYMaxValue)
+ {
+ PlotModel plotModel = new PlotModel();
+ //plotModel.Background = OxyColors.Transparent;
+ if (!(plotModel.Axes.Count > 0))
+ {
+ plotModel.Axes.Add(new DateTimeAxis()
+ {
+ Position = OxyPlot.Axes.AxisPosition.Bottom,
+ //Title = "时间",
+ StringFormat = "HH:mm:ss",
+ AxislineColor = OxyColor.FromRgb(84, 164, 227),
+ AbsoluteMinimum = DateTimeAxis.ToDouble(new DateTime()),
+ IsZoomEnabled = false,
+ IsPanEnabled = false,
+ });
+ plotModel.Axes.Add(new LinearAxis()
+ {
+ //Title = axisYTitle,
+ Position = OxyPlot.Axes.AxisPosition.Left,
+ LabelFormatter = value => value.ToString("F2"),
+ AxislineColor = OxyColor.Parse("#9C9C9C"),
+ AxislineStyle = LineStyle.Solid,
+ AxislineThickness = 1,
+ IsZoomEnabled = false,
+ IsPanEnabled = false,
+ AbsoluteMinimum=axisYMinValue,EdgeRenderingMode= EdgeRenderingMode.PreferSpeed,
+ AbsoluteMaximum = axisYMaxValue,
+ });
+ }
+ return plotModel;
+ }
+
+ private OxyLineSeries CreateLine(string title,LineStyle lineStyle=LineStyle.Solid)
+ {
+ var scb = Application.Current.TryFindResource(title) as SolidColorBrush;
+ var color = scb.ToOxyColor();
+ return new OxyLineSeries()
+ {
+ LineStyle = lineStyle,
+ //Title = title,
+ MarkerFill = scb.ToOxyColor(),
+ MarkerSize = 2,
+ StrokeThickness=3,
+ LineLegendPosition = LineLegendPosition.End,
+ InterpolationAlgorithm=InterpolationAlgorithms.CatmullRomSpline,
+ CanTrackerInterpolatePoints=false,
+ Color = color,
+ };
+ }
+ #endregion
- public Visibility LoadingVis { get { return _mLoadingVis; } set { _mLoadingVis = value; OnPropertyChanged(); } }
- private Visibility _mLoadingVis = Visibility.Collapsed;
+ #region Commands
public BPARelayCommand Select { get; set; }
@@ -210,7 +433,8 @@ namespace BPASmartClient.Academy.ViewModel
public BPARelayCommand InspectDataCommand { get; set; }
- public BPARelayCommand ShowRefrenceWindowCommand { get;private set; }
- public BPARelayCommand HiddenRefrenceWindowCommand { get; private set; }
+ public BPARelayCommand ShowRefrenceWindowCommand { get; private set; }
+ public BPARelayCommand HiddenRefrenceWindowCommand { get; private set; }
+ #endregion
}
}
diff --git a/BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs b/BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs
index 0a990720..a1816997 100644
--- a/BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs
+++ b/BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs
@@ -98,7 +98,8 @@ namespace BPASmartClient.Academy.ViewModel
StringFormat = "HH:mm:ss",
AxislineColor = OxyColor.FromRgb(84, 164, 227),
AbsoluteMinimum = OxyDataModels[0].dataPoints[0].X,
- AbsoluteMaximum = OxyDataModels[0].dataPoints[OxyDataModels[0].dataPoints.Count - 1].X,
+ //AbsoluteMaximum = OxyDataModels[0].dataPoints[OxyDataModels[0].dataPoints.Count - 1].X,
+ //MaximumPadding=0.05,
});
OxyModel.Axes.Add(new LinearAxis()
{