|
@@ -1,8 +1,10 @@
|
|
|
using DevExpress.Charts.Model;
|
|
|
using DevExpress.Utils;
|
|
|
using DevExpress.XtraCharts;
|
|
|
+using DevExpress.XtraReports.UI;
|
|
|
using NPOI.Util;
|
|
|
using OTSIncAReportApp._1_UI.Control_DEVCharts;
|
|
|
+using OTSIncAReportApp.DataOperation.DataAccess;
|
|
|
using OTSIncAReportApp.OTSRstMgrFunction;
|
|
|
using OTSIncAReportApp.OTSSampleReportInfo;
|
|
|
using OTSIncAReportApp.SysMgrTools;
|
|
@@ -11,8 +13,11 @@ using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
+using System.Drawing;
|
|
|
using System.Linq;
|
|
|
using System.Windows.Forms;
|
|
|
+using System.Xml;
|
|
|
+using static System.Net.WebRequestMethods;
|
|
|
|
|
|
namespace OTSIncAReportApp.Control_ECharts
|
|
|
{
|
|
@@ -117,8 +122,18 @@ namespace OTSIncAReportApp.Control_ECharts
|
|
|
|
|
|
panel1.Dock = DockStyle.Fill;
|
|
|
chartControl1.Dock = DockStyle.Fill;
|
|
|
-
|
|
|
- Graphics();
|
|
|
+ int sel_pro = m_conditionChoose.m_conditionData.ProItemProIndex();
|
|
|
+ if (sel_pro == 2)
|
|
|
+ {
|
|
|
+ comboBox1.Visible = false;
|
|
|
+ Graphics_Stacking(list_dt[0]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ comboBox1.Visible = true;
|
|
|
+ Graphics();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -406,8 +421,10 @@ namespace OTSIncAReportApp.Control_ECharts
|
|
|
ListData.Add(dtEComponent);
|
|
|
break;
|
|
|
case "PSize":
|
|
|
- //获取粒级表
|
|
|
- string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
|
|
|
+
|
|
|
+
|
|
|
+ //获取粒级表
|
|
|
+ string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
|
|
|
DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(pathe);
|
|
|
string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
|
|
|
List<string> temp = new List<string>();
|
|
@@ -443,38 +460,162 @@ namespace OTSIncAReportApp.Control_ECharts
|
|
|
po = "DFERET";
|
|
|
break;
|
|
|
}
|
|
|
- DataTable dtp = particledata.GetParticleAll(filedAndParticl);
|
|
|
- DataTable dtPSize = new DataTable();
|
|
|
- dtPSize.Columns.Add("name");
|
|
|
- dtPSize.Columns.Add("Cunt");
|
|
|
|
|
|
- for (int k = 0; k < temp.Count; k++)
|
|
|
- {
|
|
|
- string str = temp[k];
|
|
|
- string d1 = str.Split('~')[0];
|
|
|
- string d2 = str.Split('~')[1];
|
|
|
- if (d2 == "MAX")
|
|
|
- {
|
|
|
- d2 = "999";
|
|
|
- }
|
|
|
- DataRow[] datas = dtp.Select(getWhere(d2, d1, po));
|
|
|
- DataRow dr = dtPSize.NewRow();
|
|
|
- dr["name"] = str;
|
|
|
- dr["Cunt"] = datas.Count().ToString();
|
|
|
- dtPSize.Rows.Add(dr);
|
|
|
- }
|
|
|
- ListData.Add(dtPSize);
|
|
|
- break;
|
|
|
+
|
|
|
+ var dpd= DataProcessing(particledata,po, temp);
|
|
|
+
|
|
|
+ ListData.Add(dpd);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return ListData;
|
|
|
}
|
|
|
|
|
|
+ private DataTable DataProcessing(ParticleData particledata,string po, List<string> temp)
|
|
|
+ {
|
|
|
+ DataTable pos_dt = particledata.GetParticleListForParticlSize("area", "");
|
|
|
+ DataTable pos_AreaInformationOfAllElements = particledata.GetAreaByAllIncA("");
|
|
|
+ DataTable pos_dtp = particledata.GetParticleAll("");
|
|
|
+ List<string> colid = new List<string>() { "name", "ar", "TypeId", "Largest", "Class", "GroupId", "con" };
|
|
|
+ DataTable m_bt_DBData = new DataTable();
|
|
|
+ for (int i = 0; i < temp.Count; i++)
|
|
|
+ {
|
|
|
+ colid.Add(temp[i].ToString());
|
|
|
+ }
|
|
|
+ for (int i = 0; i < colid.Count; i++)
|
|
|
+ {
|
|
|
+ m_bt_DBData.Columns.Add(colid[i].ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < pos_dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow dr = m_bt_DBData.NewRow();
|
|
|
+ dr["name"] = pos_dt.Rows[i]["TypeName"].ToString();
|
|
|
+ dr["TypeId"] = pos_dt.Rows[i]["TypeId"].ToString();
|
|
|
+ dr["con"] = pos_dt.Rows[i]["con"].ToString();
|
|
|
+
|
|
|
+ dr["GroupId"] = pos_dt.Rows[i]["GroupId"].ToString();
|
|
|
+ if (pos_dt.Rows[i]["GroupName"].ToString() == "")
|
|
|
+ dr["Class"] = "Default";
|
|
|
+ else
|
|
|
+ dr["Class"] = pos_dt.Rows[i]["GroupName"].ToString();
|
|
|
+ //continue;
|
|
|
+ dr["Largest"] = Math.Round(Convert.ToDouble(pos_dt.Rows[i]["max"]), 2);
|
|
|
+
|
|
|
+
|
|
|
+ for (int a = 7; a < colid.Count; a++)
|
|
|
+ {
|
|
|
+ string d1 = colid[a].Split('~')[0];
|
|
|
+ string d2 = colid[a].Split('~')[1];
|
|
|
+ if (d2 == "MAX")
|
|
|
+ {
|
|
|
+ d2 = "999";
|
|
|
+ }
|
|
|
+ DataRow[] datas = pos_dtp.Select(getWhere(d2, d1, po, pos_dt.Rows[i]["TypeId"].ToString()));
|
|
|
+ dr[colid[a]] = datas.Count();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int a = 0; a < pos_AreaInformationOfAllElements.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (pos_dt.Rows[i]["TypeId"].ToString() == pos_AreaInformationOfAllElements.Rows[a]["TypeId"].ToString())
|
|
|
+ {
|
|
|
+ dr["ar"] = pos_AreaInformationOfAllElements.Rows[a]["ar"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_bt_DBData.Rows.Add(dr);
|
|
|
+ }
|
|
|
+
|
|
|
+ return m_bt_DBData;
|
|
|
+ }
|
|
|
+
|
|
|
+ private string getWhere(string max, string min, string col, string partic)
|
|
|
+ {
|
|
|
+ if (col == "Area")
|
|
|
+ {
|
|
|
+ return col + ">=" + ((Convert.ToDouble(min) / 2) * (Convert.ToDouble(min) / 2) * Math.PI).ToString() + " and " + col + "<" + ((Convert.ToDouble(max) / 2) * (Convert.ToDouble(max) / 2) * Math.PI).ToString() + " and TypeId=" + partic;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
- private void Graphics()
|
|
|
+ private void Graphics_Stacking(DataTable dt)
|
|
|
+ {
|
|
|
+ chartControl1.Series.Clear();
|
|
|
+
|
|
|
+ List<Series> seriesList = new List<Series>();
|
|
|
+
|
|
|
+ DataTable data = new DataTable();
|
|
|
+ data.Columns.Add("name");
|
|
|
+ data.Columns.Add("range");
|
|
|
+ data.Columns.Add("num");
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ for (int a = 7; a < dt.Columns.Count; a++)
|
|
|
+ {
|
|
|
+ DataRow dr = data.NewRow();
|
|
|
+ dr["name"] = dt.Rows[i]["name"].ToString();
|
|
|
+ dr["range"] = dt.Columns[a].ColumnName;
|
|
|
+ dr["num"] = dt.Rows[i][a].ToString();
|
|
|
+ data.Rows.Add(dr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ foreach (DataRow dr in data.DefaultView.ToTable(true, "name").Rows)
|
|
|
+ {
|
|
|
+ Series s = new Series(dr["name"].ToString(), ViewType.StackedBar)
|
|
|
+ {
|
|
|
+ LegendTextPattern = dr["name"].ToString(),
|
|
|
+ ArgumentScaleType = ScaleType.Qualitative,
|
|
|
+ };
|
|
|
+ foreach (DataRow drl in data.Select("name='" + dr["name"].ToString() + "'"))
|
|
|
+ s.Points.Add(new SeriesPoint(drl["range"].ToString(), int.Parse(drl["num"].ToString())));
|
|
|
+ s.LabelsVisibility = DefaultBoolean.False;
|
|
|
+ seriesList.Add(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (DataRow dr in data.DefaultView.ToTable(true, "name").Rows)
|
|
|
+ {
|
|
|
+ Series s = new Series(dr["name"].ToString(), ViewType.StackedBar)
|
|
|
+ {
|
|
|
+ LegendTextPattern = dr["name"].ToString(),
|
|
|
+ ArgumentScaleType = ScaleType.Qualitative,
|
|
|
+ };
|
|
|
+ foreach (DataRow drl in data.Select("name='" + dr["name"].ToString() + "'"))
|
|
|
+ s.Points.Add(new SeriesPoint(drl["range"].ToString(), int.Parse(drl["num"].ToString())));
|
|
|
+ s.LabelsVisibility = DefaultBoolean.False;
|
|
|
+ seriesList.Add(s);
|
|
|
+ }
|
|
|
+ foreach (Series sr in seriesList.ToArray())
|
|
|
+ chartControl1.Series.Add(sr);
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisY.Title.Text = "";
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisX.Title.Text = "";
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisY.Title.Visibility = DefaultBoolean.True;
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisX.Title.Visibility = DefaultBoolean.True;
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisY.Title.Font = new Font("Tahoma", 9);
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisX.Title.Font = new Font("Tahoma", 9);
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisY.Title.Alignment = System.Drawing.StringAlignment.Far;
|
|
|
+ ((XYDiagram)chartControl1.Diagram).AxisX.Title.Alignment = System.Drawing.StringAlignment.Far;
|
|
|
+
|
|
|
+ //图例的位置定义
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ private void Graphics()
|
|
|
{
|
|
|
chartControl1.Series.Clear();
|
|
|
for (int i = 0; i < prListData.Count; i++)
|