|
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.UserControls;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Controls.Primitives;
- using OxyPlot;
- using OxyPlot.Axes;
-
- namespace BPASmartClient.Academy.View
- {
- /// <summary>
- /// HistoryChartView.xaml 的交互逻辑
- /// </summary>
- public partial class HistoryChart50LView : UserControl
- {
- public HistoryChart50LView()
- {
- InitializeComponent();
- }
- //public PlotModel plotModel { get; set; } = new PlotModel();
- //private void Button_Click(object sender, RoutedEventArgs e)
- //{
- // Button button = sender as Button;
- // int num;
- // bool suc = int.TryParse(button.CommandParameter.ToString(), out num);
- // RecipeChart recipeChart = HistorySqlite.GetInstance.recipeCharts.FirstOrDefault(o => o.Num == num);
- // switch (button.Content.ToString())
- // {
- // case "温度曲线":
- // plotModel.Series.Clear();
- // plotModel = new PlotModel() { Title = "温度曲线" };
- // 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 };
- // 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 };
- // 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 };
- // List<DataPoint> twValues = new List<DataPoint>();
- // List<DataPoint> tvValues = new List<DataPoint>();
- // List<DataPoint> tmValues = new List<DataPoint>();
- // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
- // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
- // {
- // twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempWok));
- // tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempVent));
- // tmValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempMaterial));
-
- // });
- // line.Points.AddRange(twValues);
- // line_1.Points.AddRange(tvValues);
- // line_2.Points.AddRange(tmValues);
- // if (!(plotModel.Axes.Count > 0))
- // {
- // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss" });
- // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
- // }
- // plotModel.Series.Add(line);
- // plotModel.Series.Add(line_1);
- // plotModel.Series.Add(line_2);
- // plotModel.InvalidatePlot(true);//重新加载曲线
- // chartView.Model = plotModel;
- // break;
- // case "转速曲线":
- // plotModel.Series.Clear();
- // plotModel = new PlotModel() { Title = "转速曲线" };
- // 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 };
- // 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 };
- // List<DataPoint> m101 = new List<DataPoint>();
- // List<DataPoint> m102 = new List<DataPoint>();
- // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
- // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
- // {
- // m101.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M101_Speed));
- // m102.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M102_Speed));
-
- // });
- // line_3.Points.AddRange(m101);
- // line_4.Points.AddRange(m102);
- // if (!(plotModel.Axes.Count > 0))
- // {
- // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
- // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "转速/rpm", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
- // }
- // plotModel.Series.Add(line_3);
- // plotModel.Series.Add(line_4);
- // plotModel.InvalidatePlot(true);//重新加载曲线
- // chartView.Model = plotModel;
- // break;
- // case "重量曲线":
- // plotModel.Series.Clear();
- // plotModel = new PlotModel() { Title = "冷却水罐重量曲线" };
- // List<DataPoint> ww = new List<DataPoint>();
- // OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
- // HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
- // HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
- // {
- // ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok));
-
- // });
- // line_5.Points.AddRange(ww);
- // if (!(plotModel.Axes.Count > 0))
- // {
- // plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
- // plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
- // }
- // plotModel.Series.Add(line_5);
- // plotModel.InvalidatePlot(true);//重新加载曲线
- // chartView.Model = plotModel;
- // break;
- // default:
- // break;
- // }
- // App.Current.Dispatcher.Invoke(() =>
- // {
- // NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "提示", "你点击了温度按钮", 1, 1);
- // });
- //}
-
- private void Popup_MouseLeave(object sender, MouseEventArgs e)
- {
- Popup popup = sender as Popup;
- popup.IsOpen = false;
- }
- }
- }
|