终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

135 lignes
7.9 KiB

  1. using BPASmartClient.CustomResource.UserControls.MessageShow;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. using System.Windows.Controls.Primitives;
  18. using OxyPlot;
  19. using OxyPlot.Axes;
  20. namespace BPASmartClient.Academy.View
  21. {
  22. /// <summary>
  23. /// HistoryChartView.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class HistoryChart50LView : UserControl
  26. {
  27. public HistoryChart50LView()
  28. {
  29. InitializeComponent();
  30. }
  31. //public PlotModel plotModel { get; set; } = new PlotModel();
  32. //private void Button_Click(object sender, RoutedEventArgs e)
  33. //{
  34. // Button button = sender as Button;
  35. // int num;
  36. // bool suc = int.TryParse(button.CommandParameter.ToString(), out num);
  37. // RecipeChart recipeChart = HistorySqlite.GetInstance.recipeCharts.FirstOrDefault(o => o.Num == num);
  38. // switch (button.Content.ToString())
  39. // {
  40. // case "温度曲线":
  41. // plotModel.Series.Clear();
  42. // plotModel = new PlotModel() { Title = "温度曲线" };
  43. // OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  44. // OxyPlot.Series.LineSeries line_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜排气温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  45. // OxyPlot.Series.LineSeries line_2 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  46. // List<DataPoint> twValues = new List<DataPoint>();
  47. // List<DataPoint> tvValues = new List<DataPoint>();
  48. // List<DataPoint> tmValues = new List<DataPoint>();
  49. // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
  50. // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
  51. // {
  52. // twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempWok));
  53. // tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempVent));
  54. // tmValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempMaterial));
  55. // });
  56. // line.Points.AddRange(twValues);
  57. // line_1.Points.AddRange(tvValues);
  58. // line_2.Points.AddRange(tmValues);
  59. // if (!(plotModel.Axes.Count > 0))
  60. // {
  61. // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss" });
  62. // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
  63. // }
  64. // plotModel.Series.Add(line);
  65. // plotModel.Series.Add(line_1);
  66. // plotModel.Series.Add(line_2);
  67. // plotModel.InvalidatePlot(true);//重新加载曲线
  68. // chartView.Model = plotModel;
  69. // break;
  70. // case "转速曲线":
  71. // plotModel.Series.Clear();
  72. // plotModel = new PlotModel() { Title = "转速曲线" };
  73. // OxyPlot.Series.LineSeries line_3 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  74. // OxyPlot.Series.LineSeries line_4 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  75. // List<DataPoint> m101 = new List<DataPoint>();
  76. // List<DataPoint> m102 = new List<DataPoint>();
  77. // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
  78. // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
  79. // {
  80. // m101.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M101_Speed));
  81. // m102.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M102_Speed));
  82. // });
  83. // line_3.Points.AddRange(m101);
  84. // line_4.Points.AddRange(m102);
  85. // if (!(plotModel.Axes.Count > 0))
  86. // {
  87. // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
  88. // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "转速/rpm", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
  89. // }
  90. // plotModel.Series.Add(line_3);
  91. // plotModel.Series.Add(line_4);
  92. // plotModel.InvalidatePlot(true);//重新加载曲线
  93. // chartView.Model = plotModel;
  94. // break;
  95. // case "重量曲线":
  96. // plotModel.Series.Clear();
  97. // plotModel = new PlotModel() { Title = "冷却水罐重量曲线" };
  98. // List<DataPoint> ww = new List<DataPoint>();
  99. // OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
  100. // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
  101. // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
  102. // {
  103. // ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok));
  104. // });
  105. // line_5.Points.AddRange(ww);
  106. // if (!(plotModel.Axes.Count > 0))
  107. // {
  108. // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
  109. // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
  110. // }
  111. // plotModel.Series.Add(line_5);
  112. // plotModel.InvalidatePlot(true);//重新加载曲线
  113. // chartView.Model = plotModel;
  114. // break;
  115. // default:
  116. // break;
  117. // }
  118. // App.Current.Dispatcher.Invoke(() =>
  119. // {
  120. // NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "提示", "你点击了温度按钮", 1, 1);
  121. // });
  122. //}
  123. private void Popup_MouseLeave(object sender, MouseEventArgs e)
  124. {
  125. Popup popup = sender as Popup;
  126. popup.IsOpen = false;
  127. }
  128. }
  129. }