From 7b4b2eb7dd57c29a4b3a75de8234ff9afcbe18d4 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 08 一月 2025 15:13:33 +0800 Subject: [PATCH] 水力业务图表 根据运行点延长 --- WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/04-special/02-working-view/PumpWorkingViewChart.cs | 127 +++++++++++++++++++++++++---------------- 1 files changed, 77 insertions(+), 50 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/04-special/02-working-view/PumpWorkingViewChart.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/04-special/02-working-view/PumpWorkingViewChart.cs index 0ddd5b3..1e73ab0 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/04-special/02-working-view/PumpWorkingViewChart.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/04-special/02-working-view/PumpWorkingViewChart.cs @@ -342,15 +342,15 @@ _vm = vm; _initial_data = vm != null; if (vm != null) - { + { var start_point = new Yw.Geometry.Point2d(0.0, vm.StartH); var end_point = new Yw.Geometry.Point2d(vm.PipeQ, vm.PipeH); - if (!end_point.IsZeroPoint()) + if (vm.PipeQ > 0 && vm.PipeH > 0) { _equip_pt_list = Yw.Pump.PerformParabolaHelper.GetEquipCurvePointList(start_point, end_point, 30); } - } + UpdateChart(true); } @@ -440,11 +440,12 @@ if (_vm.Items != null && _vm.Items.Any()) { - foreach (var vm in _vm.Items) { + var qh_pt_list = vm.CurveQH.GetPointList(_feat_type_qh); + var max_ratio = vm.Q / qh_pt_list.Max(x => x.X) * 1.05; { - var qh_pt_list = vm.CurveQH.GetPointList(_feat_type_qh); + qh_pt_list = qh_pt_list.GetExpandPointList(_feat_type_qh, 1, max_ratio); var xxx = qh_pt_list.Select(x => x.X); var yyy = qh_pt_list.Select(x => x.Y); @@ -457,7 +458,7 @@ if (vm.CurveQE != null) { - var qe_pt_list = vm.CurveQE.GetPointList(_feat_type_qe); + var qe_pt_list = vm.CurveQE.GetExpandPointList(_feat_type_qe, 1, max_ratio); 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()); @@ -465,7 +466,8 @@ if (vm.CurveQP != null) { - var yyy = vm.CurveQP.GetYList(_feat_type_qp); + var qp_pt_list = vm.CurveQP.GetExpandPointList(_feat_type_qp, 1, max_ratio); + var yyy = qp_pt_list.Select(x => x.Y); _min_power = Math.Min(_min_power, yyy.Min()); _max_power = Math.Max(_max_power, yyy.Max()); if (vm.P.HasValue) @@ -623,14 +625,44 @@ for (int i = 0; i < _vm.Items.Count; i++) { var vm = _vm.Items[i]; - CreateCurrentLineSeries(vm.Id, vm.Color, vm.CurveName, vm.CurveQH, vm.CurveQE, vm.CurveQP); + var qh = vm.CurveQH.GetFeatCurve(_feat_type_qh); + if (qh.IsInvalid()) + continue; + var max_pt = qh.GetPointList().LastOrDefault(); + CreateCurrentLineSeries(vm.Id, vm.Color, vm.CurveQH, vm.CurveQE, vm.CurveQP); + CreateTextSeries(vm.Color, vm.CurveName, vm.Q, vm.H); + if (max_pt.X < vm.Q) + { + var max_ratio = vm.Q / max_pt.X * 1.05; + var qh_pt_ex_list = qh.GetPointListByXRatioRange(1, max_ratio, 100); + qh_pt_ex_list = qh_pt_ex_list.Where(x => x.X >= max_pt.X).ToList(); + qh_pt_ex_list.Add(max_pt); + CreateLineSeries(vm.Id + "qh", vm.Color, qh_pt_ex_list, _default_pane,_axis_y_head, DashStyle.Dot); + + if (vm.CurveQE != null && vm.CurveQE.Any() && _qe_visible) + { + var qe = vm.CurveQE.GetFeatCurve(_feat_type_qe); + var qe_pt_ex_list = vm.CurveQE.GetExpandPointList(_feat_type_qe, 1, max_ratio, 100); + qe_pt_ex_list = qe_pt_ex_list.Where(x => x.X >= max_pt.X * 0.8).ToList(); + CreateLineSeries(vm.Id + "qe", vm.Color, qe_pt_ex_list, _default_pane, _axis_y_eff, DashStyle.Dot); + } + + if (vm.CurveQP != null && vm.CurveQP.Any() && _qp_visible) + { + var qp = vm.CurveQP.GetFeatCurve(_feat_type_qp); + var qp_pt_ex_list = vm.CurveQP.GetExpandPointList(_feat_type_qp, 1, max_ratio, 100); + qp_pt_ex_list = qp_pt_ex_list.Where(x => x.X >= max_pt.X * 0.8).ToList(); + CreateLineSeries(vm.Id+"qp", vm.Color, qp_pt_ex_list, _bottom_pane, _axis_y_power, DashStyle.Dot); + } + } + } } if (_equip_pt_list != null && _equip_pt_list.Any()) { var pt = _equip_pt_list.LastOrDefault(); - CreateTextSeries(Color.Black, pt.X, pt.Y); + CreateTextSeries(Color.Black, $"{pt.X:N1}m鲁/h {pt.Y:N1}m", pt.X, pt.Y); } } @@ -641,7 +673,7 @@ /// <summary> /// 鍒涘缓绾跨郴鍒� /// </summary> - private void CreateCurrentLineSeries(string id, Color color, string curve_name, List<Yw.Geometry.Point2d> qh, List<Yw.Geometry.Point2d> qe, List<Yw.Geometry.Point2d> qp) + private void CreateCurrentLineSeries(string id, Color color, List<Yw.Geometry.Point2d> qh, List<Yw.Geometry.Point2d> qe, List<Yw.Geometry.Point2d> qp) { var series_qh = new DevExpress.XtraCharts.Series(); series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; @@ -649,8 +681,6 @@ series_qh.Name = _tag_qh + id; series_qh.ShowInLegend = false; series_qh.CrosshairEnabled = DefaultBoolean.False; - series_qh.LegendTextPattern = curve_name; - var series_qh_view = new DevExpress.XtraCharts.SplineSeriesView(); series_qh_view.LineStyle.Thickness = 2; @@ -668,40 +698,6 @@ { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); } - - var point_qh = pt_qh_list[pt_qh_list.Count() - 1]; - var anchor_qh_pt = new DevExpress.XtraCharts.PaneAnchorPoint(); - anchor_qh_pt.Pane = _default_pane; - anchor_qh_pt.AxisXCoordinate.AxisValue = point_qh.X.ToString(); - anchor_qh_pt.AxisYCoordinate.AxisValue = point_qh.Y.ToString(); - - var position_qh = new DevExpress.XtraCharts.RelativePosition(); - position_qh.Angle = -50; - position_qh.ConnectorLength = 10; - - var txt_qh = new TextAnnotation(); - txt_qh.Border.Visibility = DefaultBoolean.False; - txt_qh.AnchorPoint = anchor_qh_pt; - txt_qh.AutoHeight = true; - txt_qh.AutoWidth = true; - txt_qh.BackColor = System.Drawing.Color.Transparent; - txt_qh.Border.Color = color; - txt_qh.ConnectorStyle = DevExpress.XtraCharts.AnnotationConnectorStyle.Line; - txt_qh.DXFont = PumpChartDisplay.AnnoFontQH; - txt_qh.Name = _tag_qh + id; - txt_qh.Padding.Bottom = 1; - txt_qh.Padding.Left = 1; - txt_qh.Padding.Right = 1; - txt_qh.Padding.Top = 1; - txt_qh.RuntimeAnchoring = false; - txt_qh.RuntimeMoving = true; - txt_qh.RuntimeResizing = false; - txt_qh.RuntimeRotation = false; - txt_qh.Text = curve_name; - txt_qh.TextColor = color; - txt_qh.ShapePosition = position_qh; - txt_qh.Visible = true; - this.chartControl1.AnnotationRepository.Add(txt_qh); this.chartControl1.Series.Add(series_qh); if (qe != null) @@ -770,13 +766,44 @@ } + /// <summary> + /// 鍒涘缓绾跨郴鍒� + /// </summary> + private void CreateLineSeries(string id, Color color, List<Yw.Geometry.Point2d> pt_list, XYDiagramPaneBase pane,AxisYBase axiy, DashStyle dash = DashStyle.Solid) + { + var series = new DevExpress.XtraCharts.Series(); + series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; + series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; + series.Name = id; + series.ShowInLegend = false; + series.CrosshairEnabled = DefaultBoolean.False; + + var series_view = new DevExpress.XtraCharts.LineSeriesView(); + series_view.LineStyle.Thickness = 2; + series_view.Color = color; + series_view.EnableAntialiasing = DefaultBoolean.True; + series_view.LineStyle.DashStyle = dash; + series_view.Pane = pane; + series_view.AxisY = axiy; + + series.SeriesPointsSorting = SortingMode.None; + series.SeriesPointsSortingKey = SeriesPointKey.Value_1; + series.View = series_view; + series.Visible = true; + + for (int i = 0; i < pt_list.Count; i++) + { + series.Points.Add(new SeriesPoint(pt_list[i].X, new double[] { pt_list[i].Y })); + } + this.chartControl1.Series.Add(series); + } + /// <summary> /// 鍒涘缓鏂囨湰绯诲垪 /// </summary> - private void CreateTextSeries(Color color, double x, double y) + private void CreateTextSeries(Color color, string name, double x, double y) { - var anchor_pt = new DevExpress.XtraCharts.PaneAnchorPoint(); anchor_pt.Pane = _default_pane; anchor_pt.AxisXCoordinate.AxisValue = x.ToString(); @@ -804,12 +831,12 @@ txt.RuntimeMoving = true; txt.RuntimeResizing = false; txt.RuntimeRotation = false; - txt.Text = $"{x}m鲁/h {y}m"; + txt.Text = name; txt.TextColor = color; txt.ShapePosition = position; txt.Visible = true; this.chartControl1.AnnotationRepository.Add(txt); - + } -- Gitblit v1.9.3