Parcourir la source

元素图表增加一个面积占比图

zhangjiaxin il y a 2 semaines
Parent
commit
f818a842e0

+ 66 - 5
OTSIncAReportApp/1-UI/Control_Grids/ElementCompositionAvgGrid.cs

@@ -2,6 +2,7 @@
 using DevExpress.Utils;
 using DevExpress.XtraCharts;
 using OTSIncAReportApp;
+using OTSIncAReportApp._1_UI.Control_DEVCharts;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using OTSIncAReportApp.OTSSampleReportInfo;
 using OTSIncAReportApp.SysMgrTools;
@@ -335,9 +336,10 @@ namespace OTSIncAReportGrids
             Report = false;
 
             //string sou = m_ReportApp.m_conditionChoose.m_SourceGridData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
-            
+            list_fileName.Clear();
 
-            if (sou.Contains("+"))
+
+			if (sou.Contains("+"))
             {
                 for (int i = 0; i < sou.Split('+').Length; i++)
                 {
@@ -345,7 +347,9 @@ namespace OTSIncAReportGrids
                     if (resultFile != null)
                     {
                         BindDataGridView(resultFile.FilePath, i, resultFile.anotherFileName, sel);
-                    }
+                        list_fileName.Add(resultFile.anotherFileName);
+
+					}
                 }
             }
             else
@@ -355,7 +359,8 @@ namespace OTSIncAReportGrids
                     if (sou == m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName.ToString())
                     {
                         BindDataGridView(m_ReportApp.m_rstDataMgr.ResultFilesList[i].FilePath, 0, m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName, sel);
-                    }
+						list_fileName.Add(m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName);
+					}
                 }
 
                 //BindDataGridView(m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath, 0, m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResult()].FileName);
@@ -386,6 +391,16 @@ namespace OTSIncAReportGrids
 				stdId = STDIdItm.itemDisplayVal.ToString();
 				stdIdIndex = STDIdItm.comboDownList.IndexOf(stdId);
 			}
+
+			string stdId_TYPE = "";
+			int stdIdIndex_TYPE = 0;
+			//find the stdId condition
+			var STDIdItm_TYPE = sourceGridData.ConditionItemList.Find(s => s.iItemId == OTS_REPORT_PROP_GRID_ITEMS.GRAPHIC_TYPE);
+			if (STDIdItm_TYPE != null)
+			{
+				stdId_TYPE = STDIdItm_TYPE.itemDisplayVal.ToString();
+				stdIdIndex_TYPE = STDIdItm_TYPE.comboDownList.IndexOf(stdId);
+			}
 			int high = 0;
 			for (int i = 0; i < list_table_Point.Count; i++)
 			{
@@ -397,9 +412,55 @@ namespace OTSIncAReportGrids
 
 			for (int i = 0; i < list_table_data.Count; i++)
 			{
-				Graphics_Stacking(list_table_data[i], stdId, list_table_size[i], list_table_Point[i], high);
+                Graphics(list_table_data[i], list_fileName[i], stdId_TYPE, list_table_size[i], list_table_Point[i], high);
+				Graphics_Stacking(list_table_data[i], stdId, list_table_size[i], list_table_Point[i], high+ list_table_size[i].Y);
+			}
+
+		}
+
+		private void Graphics(DataTable data, string filename, string comboBox1Text,  Point a_size, Point a_Location, int location_hig)
+		{
+			ChartControl chartControl1 = new ChartControl();
+			chartControl1.Series.Clear();
+
+			// 假设你已经有一个 ChartControl 实例,并且已经添加了一个饼图 Series
+			Series series = new Series(filename, ViewType.Bar);
+			for (int a = 0; a < data.Rows.Count; a++)
+			{
+				string name = data.Rows[a]["TypeName"].ToString();
+				double Cunt = Convert.ToDouble(data.Rows[a]["ar"]);
+				series.Points.Add(new SeriesPoint(name, Cunt));
 			}
+			series.LabelsVisibility = DefaultBoolean.True;
+			chartControl1.Series.Add(series);
+
+			//图例的位置定义
+			chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
+			chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.RightOutside;
+			chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
+			chartControl1.Legend.Direction = LegendDirection.TopToBottom;
+
+			//十字准线光标
+			chartControl1.CrosshairEnabled = DefaultBoolean.True;
+			chartControl1.CrosshairOptions.ShowValueLine = true;
+			chartControl1.CrosshairOptions.ShowArgumentLabels = true;
+			DevFunctions.ChangeView2(chartControl1, comboBox1Text);
+			chartControl1.Location = new Point(a_Location.X, location_hig);
+			chartControl1.Size = new Size(a_size.X, a_size.Y);
+			// 获取图表的坐标系(通常为 XYDiagram)
+			XYDiagram diagram = chartControl1.Diagram as XYDiagram;
 
+			if (diagram != null)
+			{
+				// 设置横坐标(X轴)名称
+				diagram.AxisX.Title.Text = "种类";
+				diagram.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; // 确保标题可见
+
+				// 设置纵坐标(Y轴)名称
+				diagram.AxisY.Title.Text = "面积";
+				diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; // 确保标题可见
+			}
+			panel1.Controls.Add(chartControl1);
 		}
 
 		/// <summary>

+ 2 - 2
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -532,9 +532,9 @@ namespace OTSIncAReportApp
                 if ((int)sampleData3.itemVal == (int)CALCULATE_TABLE_TYPE.AVE_ELEMENT_COMP)
                 {
                     var sampleData1 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE];
-
                     list.Insert(2, sampleData1);
-
+					var sampleDataA5 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.GRAPHIC_TYPE];
+					list.Add(sampleDataA5);
 					//all particle types
 					var stditm = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.STD_ID];
 					list.Add(stditm);