From 772e6760f2d25a771fe314135d53d1e72373aab7 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 17 二月 2025 18:09:02 +0800 Subject: [PATCH] 增加报告Chart --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs | 63 ++++++++++++++++++++++++------- 1 files changed, 48 insertions(+), 15 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs index 289f0e4..87695602 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs @@ -1,4 +1,5 @@ -锘縰sing DevExpress.XtraReports.UI; +锘縰sing DevExpress.XtraCharts; +using DevExpress.XtraReports.UI; using System; using System.Collections; using System.ComponentModel; @@ -21,6 +22,10 @@ //A4璁剧疆 827 1169 this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; this.Margins = new DevExpress.Drawing.DXMargins(50, 50, 50, 50); + + //鍐呭瀹藉害 + float contentWidth = 727F;//鍐呭瀹藉害 + float firstCaptionHeight = 30F;//涓�绾ф爣棰橀珮搴� //727 1069 @@ -75,20 +80,9 @@ #region 涓�銆侀」鐩杩� - var labForDescription = new XRLabel(); - labForDescription.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); - labForDescription.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); - labForDescription.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); - labForDescription.Multiline = true; - labForDescription.Name = "labForDescription"; - labForDescription.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); - labForDescription.SizeF = new System.Drawing.SizeF(727F, 25F); - labForDescription.StylePriority.UseFont = false; - labForDescription.StylePriority.UseTextAlignment = false; - labForDescription.Text = "涓�銆侀」鐩杩�"; - labForDescription.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + var labForDescription = CreateFirstCaption("涓�銆侀」鐩杩�", contentWidth, firstCaptionHeight, 0F, locationY); this.Detail.Controls.Add(labForDescription); - locationY += 25F; + locationY += firstCaptionHeight; #endregion @@ -202,15 +196,54 @@ // 灏嗚〃鏍兼坊鍔犲埌Detail this.Detail.Controls.Add(tableForPumpList); + locationY += 30F; + locationY += 30F * vm.PumpList.Count; } + if (vm.WorkingList != null && vm.WorkingList.Count > 0) + { + foreach (var working in vm.WorkingList) + { + XRChart chart = new XRChart(); + chart.LocationF = new DevExpress.Utils.PointFloat(0F, locationY); + chart.WidthF = contentWidth; + chart.HeightF = 300F; + // 鍒涘缓涓�涓嚎绯诲垪 + Series series = new Series("Series1", ViewType.Spline); + // 娣诲姞鏁版嵁鐐� + foreach (var item in working.PumpAnaly.Items[0].RatedCurveQH) + { + series.Points.Add(new SeriesPoint(item.X, item.Y)); + } + chart.Series.Add(series); - + Detail.Controls.Add(chart); + } + } } + //鍒涘缓涓�绾ф爣棰� + private XRLabel CreateFirstCaption(string caption, float sizeX, float sizeY, float locationX, float locationY) + { + var lab = new XRLabel(); + lab.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); + lab.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); + lab.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); + lab.Multiline = true; + lab.Name = "lab"; + lab.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + lab.SizeF = new System.Drawing.SizeF(sizeX, sizeY); + lab.StylePriority.UseFont = false; + lab.StylePriority.UseTextAlignment = false; + lab.Text = caption; + lab.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + return lab; + } + + // 鍒涘缓琛ㄥご鍗曞厓鏍� private XRTableCell CreateTableCell(string text, int width) { -- Gitblit v1.9.3