lx
2025-09-05 0b108f56b2d0c35d01ee361dc593119ac52a14e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using ErrorAnalysis.Service.Model;
using OxyPlot.Axes;
using OxyPlot.Legends;
using OxyPlot.Series;
using OxyPlot.WindowsForms;
using OxyPlot;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace ErrorAnalysis.UI
{
    public partial class ProcessingData : Form
    {
        ProcessingDataModel _model;
        public ProcessingData(ProcessingDataModel model)
        {
            _model = model;
            InitializeComponent();
        }
 
        private void Plot(ProcessingDataModel model)
        {
            pnlCO.Controls.Clear();
            pnlData.Controls.Clear();
            var plotModel = new PlotModel();
 
            var xAxis = new LinearAxis { Position = AxisPosition.Bottom, Title = "Porosity(%)" };
            var yAxis = new LinearAxis { Position = AxisPosition.Left, Title = "C/O" };
            xAxis.MajorGridlineStyle = LineStyle.DashDashDotDot;
            yAxis.MajorGridlineStyle = LineStyle.DashDot;
 
 
            plotModel.Axes.Add(xAxis);
            plotModel.Axes.Add(yAxis);
 
            // 创建曲线系列
            var oSeries = new LineSeries { Title = "Water Line", Color = OxyColors.MediumBlue };
            var cSeries = new LineSeries { Title = "Oil Line", Color = OxyColors.DarkRed };
            var oOriginSeries = new LineSeries { Title = "Water Line Origin", Color = OxyColors.MediumPurple };
            var cOriginSeries = new LineSeries { Title = "Oil Line Origin", Color = OxyColors.DarkOrange };
 
            foreach (var o in model.WaterLine)
                oSeries.Points.Add(new DataPoint(o[0], o[1]));
            foreach (var c in model.OilLine)
                cSeries.Points.Add(new DataPoint(c[0], c[1]));
            foreach (var o in model.WaterLineOrgin)
                oOriginSeries.Points.Add(new DataPoint(o[0], o[1]));
            foreach (var c in model.OilLineOrigin)
                cOriginSeries.Points.Add(new DataPoint(c[0], c[1]));
 
            plotModel.Legends.Add(new Legend { LegendPosition = LegendPosition.TopLeft });
            // 添加曲线到图表模型
            plotModel.Series.Add(oSeries);
            plotModel.Series.Add(cSeries);
            plotModel.Series.Add(cOriginSeries);
            plotModel.Series.Add(oOriginSeries);
 
            // 可视化代码
            // 创建 Windows 窗体以显示图表
            var plotView = new PlotView { Model = plotModel };
            plotView.Dock = DockStyle.Fill;
            pnlCO.Controls.Add(plotView);
 
 
            pnlData.Controls.Clear();
            plotModel = new PlotModel();
            xAxis = new LinearAxis { Position = AxisPosition.Bottom, Title = "Track" };
            xAxis.MajorGridlineStyle = LineStyle.Dash;
           var logYAxis = new LogarithmicAxis { Position = AxisPosition.Left, Title = "Counting" };
            logYAxis.MajorGridlineStyle = LineStyle.Dash;
            plotModel.Axes.Add(xAxis);
            plotModel.Axes.Add(logYAxis);
 
            var farSeries = new LineSeries { Title = "Far Spectrum", Color = OxyColors.MediumBlue };
            var nearSeries = new LineSeries { Title = "Near Spectrum", Color = OxyColors.MediumPurple };
            foreach (var item in model.FarSpecData)
                farSeries.Points.Add(new DataPoint(item[0], item[1]));
            foreach (var item in model.NearSpecData)
                nearSeries.Points.Add(new DataPoint(item[0], item[1]));
 
            plotModel.Legends.Add(new Legend { LegendPosition = LegendPosition.TopRight });
            plotModel.Series.Add(farSeries);
            plotModel.Series.Add(nearSeries);
            plotView = new PlotView { Model = plotModel };
 
            plotView.Dock = DockStyle.Fill;
            pnlData.Controls.Add(plotView);
        }
 
        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
            Dispose();
        }
 
        private void ProcessingData_Load(object sender, EventArgs e)
        {
            txtNearCC.Text = _model.NearCC.ToString();
            txtNearOC.Text = _model.NearOC.ToString();
            txtNearCR.Text = _model.NearCR.ToString();
            txtNearOR.Text = _model.NearOR.ToString();
 
            txtFarCC.Text = _model.FarCC.ToString();
            txtFarOC.Text = _model.FarOC.ToString();
            txtFarCR.Text = _model.FarCR.ToString();
            txtFarOR.Text = _model.FarOR.ToString();
 
            txtNearTO.Text = _model.NearTO.ToString();
            txtFarTO.Text = _model.FarTO.ToString();
 
            txtNearPDEV.Text = _model.NearPDEV.ToString();
            txtFarPDEV.Text = _model.FarPDEV.ToString();
            txtMergePDEV.Text = _model.MergePDEV.ToString();
 
            txtOilLinePoint.Text = _model.OilPoint.ToString();
            txtWaterLinePoint.Text = _model.WaterPoint.ToString();
            txtMergeDelta.Text = _model.MergeDelta.ToString();
 
            txtFarTO.Text = _model.FarTO.ToString();
            txtNearTO.Text = _model.NearTO.ToString();
            Plot(_model);
            pnlCO.Focus();
        }
    }
}