Shuxia Ning
2024-12-19 b0c978129ba55cf81e8470b6c9326745a5dbc7d1
WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedChart.cs
@@ -1,8 +1,6 @@
using DevExpress.Utils;
using DevExpress.Utils.Drawing;
using DevExpress.XtraCharts;
using System.Text;
using Yw.Geometry;
namespace Yw.WinFrmUI.Phart
{
@@ -29,7 +27,7 @@
        private AxisX _axis_x_flow;
        private AxisY _axis_y_head;
        private SecondaryAxisY _axis_y_eff, _axis_y_power;
        private ConstantLine _query_flow_line;
        private ConstantLine _const_line_x;
        private TextAnnotation _anno_txt_query_info;
        private PumpCoordinate _coordinate;
@@ -132,8 +130,8 @@
            _axis_y_power = _diagram.SecondaryAxesY.GetAxisByName("AxisYQP");
            _axis_y_power.SetSecondaryAxisYQPDisplay();
            _query_flow_line = (ConstantLine)_diagram.AxisX.ConstantLines.GetElementByName("WorkPointLine");
            _query_flow_line.SetWorkPointLineDisplay();
            _const_line_x = (ConstantLine)_diagram.AxisX.ConstantLines.GetElementByName("WorkPointLine");
            _const_line_x.SetWorkPointLineDisplay();
            _anno_txt_query_info = this.chartControl1.AnnotationRepository[0] as TextAnnotation;
            _anno_txt_query_info.SetTextAnnoWorkPointDisplay();
@@ -148,7 +146,7 @@
            _axis_y_power.GridLines.Visible = false;
            _query_flow_line.Visible = false;
            _const_line_x.Visible = false;
            _anno_txt_query_info.Visible = false;
            this.chartControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseMove);
@@ -161,7 +159,7 @@
        private void ChartControl1_CustomPaint(object sender, CustomPaintEventArgs e)
        {
            if (e is not DXCustomPaintEventArgs dxArgs)
            if (e is not DXCustomPaintEventArgs dx_args)
                return;
            if (_vm_list == null || !_vm_list.Any())
                return;
@@ -175,10 +173,10 @@
                    var sect_pt = vm.EquipPoint;
                    if (sect_pt == null)
                        continue;
                    DrawEquipPoint(dxArgs.Cache, pen, sect_pt, vm.CurrentCurveQE, vm.CurrentCurveQP);
                    DrawEquipPoint(dx_args.Cache, pen, sect_pt, vm.CurrentCurveQE, vm.CurrentCurveQP);
                }
                DrawEquipLine(dxArgs.Cache, pen, _equip_line);
                DrawEquipLine(dx_args.Cache, pen, _equip_line);
            }
        }
@@ -224,7 +222,7 @@
            }
            if (qp != null && _qp_visible)
            {
                var qp_y = qe.GetPointY(qh_x);
                var qp_y = qp.GetPointY(qh_x);
                var qp_pt = _diagram.DiagramToPoint(qh_x, qp_y, _axis_x_flow, _axis_y_power);
                var qp_pt_x = qp_pt.Point.X;
                var qp_pt_y = qp_pt.Point.Y;
@@ -414,6 +412,7 @@
                    continue;
                var qe_pt_list = vm.CurrentCurveQE.GetPointList();
                var yyy = qe_pt_list.Select(x => x.Y);
                _min_eff = Math.Min(_min_eff, yyy.Min());
                _max_eff = Math.Max(_max_eff, yyy.Max());
            }
@@ -458,7 +457,7 @@
            _axis_y_power.Visibility = DefaultBoolean.False;
            _axis_y_power.GridLines.Visible = false;
            _query_flow_line.Visible = false;
            _const_line_x.Visible = false;
            _bottom_pane.Visibility = ChartElementVisibility.Hidden;
@@ -513,7 +512,7 @@
            }
            //功率
            if (_max_power > _min_power)
            if (_max_power > _min_power && _qp_visible)
            {
                //计算刻度
                var labels = new List<CustomAxisLabel>();
@@ -564,8 +563,8 @@
            this.chartControl1.BeginInit();
            this.chartControl1.Series.Clear();
            var annotationCount = this.chartControl1.AnnotationRepository.Count;
            for (int i = annotationCount - 1; i > 0; i--)
            var annotation_count = this.chartControl1.AnnotationRepository.Count;
            for (int i = annotation_count - 1; i > 0; i--)
            {
                if (i == 0)
                    break;
@@ -603,14 +602,14 @@
        {
            if (!_line_visible)
            {
                _query_flow_line.Visible = false;
                _query_flow_line.Title.Visible = false;
                _const_line_x.Visible = false;
                _const_line_x.Title.Visible = false;
                return;
            }
            else
            {
                _query_flow_line.Visible = true;
                _query_flow_line.Title.Visible = true;
                _const_line_x.Visible = true;
                _const_line_x.Title.Visible = true;
            }
             
            if (_vm_list == null || !_vm_list.Any())
@@ -653,8 +652,8 @@
                });
            }  
            _query_flow_line.AxisValue = x_flow;
            _query_flow_line.Title.Text = $"{x_flow:N1}";
            _const_line_x.AxisValue = x_flow;
            _const_line_x.Title.Text = $"{x_flow:N1}";
               
            this.QueryPointChangedEvent?.Invoke(query_pt_list);
        }
@@ -686,7 +685,7 @@
            series_qh.View = series_qh_view;
            series_qh.Visible = true;
            var pt_qh_list = vm.CurrentCurveQH.GetPointList(12);
            var pt_qh_list = vm.CurrentCurveQH.GetPointList(100);
            for (int i = 0; i < pt_qh_list.Count; i++)
            {
                series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y }));
@@ -750,7 +749,7 @@
                series_qe.View = series_qe_view;
                series_qe.Visible = _qe_visible;
                var pt_qe_list = vm.CurrentCurveQE.GetPointList(12);
                var pt_qe_list = vm.CurrentCurveQE.GetPointList(100);
                for (int i = 0; i < pt_qe_list.Count; i++)
                {
                    series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y }));
@@ -782,7 +781,7 @@
                series_qp.View = series_qp_view;
                series_qp.Visible = _qp_visible;
                var pt_qp_list = vm.CurrentCurveQP.GetPointList(12);
                var pt_qp_list = vm.CurrentCurveQP.GetPointList(100);
                for (int i = 0; i < pt_qp_list.Count; i++)
                {
                    series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y }));
@@ -819,7 +818,7 @@
                }
                else if (hitInfo.InConstantLine)
                {
                    if (hitInfo.ConstantLine == _query_flow_line)
                    if (hitInfo.ConstantLine == _const_line_x)
                    {
                        _onMoveWorkPointLine = true;
                    }