|
@@ -2,6 +2,7 @@
|
|
|
using DevExpress.XtraCharts;
|
|
|
using DevExpress.XtraRichEdit.Layout;
|
|
|
using DevExpress.XtraTreeList.Data;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
using OTSCommon.DBOperate.Model;
|
|
|
using OTSIncAReportApp;
|
|
|
using OTSIncAReportApp._1_UI.Control_DEVCharts;
|
|
@@ -52,6 +53,16 @@ namespace OTSIncAReportGrids
|
|
|
//int gridheight = 0;
|
|
|
List<int> list_gridheight = new List<int>();
|
|
|
|
|
|
+
|
|
|
+ List<DataTable> list_table_data = new List<DataTable>();
|
|
|
+ List<Point> list_table_size = new List<Point>();
|
|
|
+ List<Point> list_table_Point = new List<Point>();
|
|
|
+ List<string> list_fileName = new List<string>();
|
|
|
+ int DataNumber = 0;//当前数据;
|
|
|
+
|
|
|
+ List<ComboBox> list_ComboBox = new List<ComboBox>();
|
|
|
+ List<ChartControl> list_ChartControl = new List<ChartControl>();
|
|
|
+
|
|
|
int gridwidth = 0;
|
|
|
int GridPosition = 0;
|
|
|
int chartposition = 0;
|
|
@@ -63,7 +74,7 @@ namespace OTSIncAReportGrids
|
|
|
/// <summary>
|
|
|
/// 绑定datagridview数据
|
|
|
/// </summary>
|
|
|
- public void BindDataGridView(string path, int num, string filename,string GraphicType)
|
|
|
+ public void BindDataGridView(string path, int num, string filename)
|
|
|
{
|
|
|
List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 7, 8, 9 };
|
|
|
List<string> NameList = new List<string>() { table["partcletype0"].ToString(), table["partcletype1"].ToString(), table["partcletype2"].ToString(), table["partcletype4"].ToString(), table["partcletype6"].ToString(), table["partcletype7"].ToString(), table["partcletype8"].ToString(), table["partcletype9"].ToString() };
|
|
@@ -271,16 +282,18 @@ namespace OTSIncAReportGrids
|
|
|
gridView.Rows[a1].Cells[4].Value = 0;
|
|
|
gridView.Rows[a1].Cells[4].Value = Convert.ToDouble(gridView.Rows[a1].Cells[4].Value) + Convert.ToDouble(gridView.Rows[j].Cells[4].Value);
|
|
|
}
|
|
|
- int position= SetDataGridViewStyle(gridView);
|
|
|
- panel1.Controls.Add(gridView);
|
|
|
+ list_table_Point.Add(SetDataGridViewStyle(gridView));
|
|
|
+ panel1.Controls.Add(gridView);
|
|
|
+
|
|
|
+ // Panel panel = new Panel();
|
|
|
+ //panel.Size = new Size(gridwidth, 27);
|
|
|
+ ////panel.Dock = DockStyle.Top;
|
|
|
+ //panel.Location=new Point(0, list_gridheight.Max());
|
|
|
+ // panel.BackColor = Color.WhiteSmoke;
|
|
|
+ list_table_data.Add(dt);
|
|
|
|
|
|
- // Panel panel = new Panel();
|
|
|
- //panel.Size = new Size(gridwidth, 27);
|
|
|
- ////panel.Dock = DockStyle.Top;
|
|
|
- //panel.Location=new Point(0, list_gridheight.Max());
|
|
|
- // panel.BackColor = Color.WhiteSmoke;
|
|
|
-
|
|
|
- Graphics(dt, filename, GraphicType, position);
|
|
|
+
|
|
|
+ //Graphics(dt, filename, GraphicType, position);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -327,12 +340,14 @@ namespace OTSIncAReportGrids
|
|
|
diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; // 确保标题可见
|
|
|
}
|
|
|
panel1.Controls.Add(chartControl1);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置DataGridView样式
|
|
|
/// </summary>
|
|
|
- private int SetDataGridViewStyle(OTSGridView gridView)
|
|
|
+ private Point SetDataGridViewStyle(OTSGridView gridView)
|
|
|
{
|
|
|
//用户不能调整标题的高度
|
|
|
gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
|
@@ -408,7 +423,10 @@ namespace OTSIncAReportGrids
|
|
|
gridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
|
|
|
gridView.ColumnHeadersHeight = 40;
|
|
|
|
|
|
- return outpos;
|
|
|
+ list_table_size.Add( new Point(gridView.ColumnCount * 100+40, gridView.RowCount * 30));
|
|
|
+
|
|
|
+
|
|
|
+ return new Point(outpos, gridheight);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -436,19 +454,134 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
public void SetGraphicType(ReportCondition sourceGridData)
|
|
|
{
|
|
|
- string stdId = "";
|
|
|
+
|
|
|
+
|
|
|
+ string stdId_TYPE = "";
|
|
|
int stdIdIndex = 0;
|
|
|
//find the stdId condition
|
|
|
var STDIdItm = sourceGridData.ConditionItemList.Find(s => s.iItemId == OTS_REPORT_PROP_GRID_ITEMS.GRAPHIC_TYPE);
|
|
|
if (STDIdItm != null)
|
|
|
{
|
|
|
- stdId = STDIdItm.itemDisplayVal.ToString();
|
|
|
- stdIdIndex = STDIdItm.comboDownList.IndexOf(stdId);
|
|
|
+ stdId_TYPE = STDIdItm.itemDisplayVal.ToString();
|
|
|
+ stdIdIndex = STDIdItm.comboDownList.IndexOf(stdId_TYPE);
|
|
|
}
|
|
|
|
|
|
indexGraphicType = stdIdIndex;
|
|
|
- GraphicType = stdId;
|
|
|
+ GraphicType = stdId_TYPE;
|
|
|
+
|
|
|
+
|
|
|
+ int high = 0;
|
|
|
+ for (int i = 0; i < list_table_Point.Count; i++)
|
|
|
+ {
|
|
|
+ if (high < list_table_Point[i].Y)
|
|
|
+ {
|
|
|
+ high = list_table_Point[i].Y;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < list_table_data.Count; i++)
|
|
|
+ {
|
|
|
+ DataNumber = i;
|
|
|
+ Graphics(list_table_data[i], list_fileName[i], stdId_TYPE, list_table_size[i], list_table_Point[i], high);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// chart图创建
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dt"></param>
|
|
|
+ /// <param name="stdId"></param>
|
|
|
+ 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]["con"]);
|
|
|
+ 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+20);
|
|
|
+ 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; // 确保标题可见
|
|
|
+ }
|
|
|
+
|
|
|
+ ComboBox comboBox = new ComboBox();
|
|
|
+ list_ChartControl.Add(chartControl1);
|
|
|
+ list_ComboBox.Add(comboBox);
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("柱状图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("折线图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("饼图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("圆环图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("气泡图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("簇状条形图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("堆积条形图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("瀑布图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D柱状图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D圆环图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D饼图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D折线图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D百分比堆积条形图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D漏斗图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3DManhattan 条形图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D堆积条形图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Items.Add("3D阶梯线图");
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Name = Convert.ToString(list_ComboBox.Count - 1);
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].SelectedIndex = 0;
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Location = new Point(a_Location.X+chartControl1.Size.Width-100, location_hig);
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].Size = new Size(100, 5);
|
|
|
+ list_ComboBox[list_ComboBox.Count - 1].SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
|
|
+ panel1.Controls.Add(chartControl1);
|
|
|
+ panel1.Controls.Add(list_ComboBox[list_ComboBox.Count - 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ ComboBox comboBox = sender as ComboBox;
|
|
|
+ if (comboBox != null)
|
|
|
+ {
|
|
|
+ DevFunctions.ChangeView2(list_ChartControl[Convert.ToInt32(comboBox.Name)], comboBox.Text);
|
|
|
+
|
|
|
+ }
|
|
|
+ //DevFunctions.ChangeView2(list_ChartControl[DataNumber], comboBox.Text);
|
|
|
+ }
|
|
|
|
|
|
+ private void CompositionDistributionGrid_Load(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ list_table_data.Clear();
|
|
|
+ list_table_size.Clear();
|
|
|
+ list_table_Point.Clear();
|
|
|
+ list_fileName.Clear();
|
|
|
string sou = m_condition.m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
|
|
|
|
|
|
if (sou.Contains("+"))
|
|
@@ -458,7 +591,8 @@ namespace OTSIncAReportGrids
|
|
|
ResultFile resultFile = m_ReportApp.m_rstDataMgr.ResultFilesList.Find(s => s.anotherFileName == sou.Split('+')[i]);
|
|
|
if (resultFile != null)
|
|
|
{
|
|
|
- BindDataGridView(resultFile.FilePath, i, resultFile.anotherFileName, stdId);
|
|
|
+ BindDataGridView(resultFile.FilePath, i, resultFile.anotherFileName);
|
|
|
+ list_fileName.Add(resultFile.anotherFileName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -468,17 +602,12 @@ 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, stdId);
|
|
|
+ BindDataGridView(m_ReportApp.m_rstDataMgr.ResultFilesList[i].FilePath, 0, m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName);
|
|
|
+ list_fileName.Add(m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- private void CompositionDistributionGrid_Load(object sender, EventArgs e)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
#endregion
|
|
|
|
|
|
#region 相关事件
|
|
@@ -544,7 +673,13 @@ namespace OTSIncAReportGrids
|
|
|
panel1.Controls.Remove((OTSGridView)item);
|
|
|
}
|
|
|
}
|
|
|
- string sou = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
|
|
|
+ list_table_data.Clear();
|
|
|
+ list_table_size.Clear();
|
|
|
+ list_table_Point.Clear();
|
|
|
+ list_fileName.Clear();
|
|
|
+
|
|
|
+
|
|
|
+ string sou = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
|
|
|
if (sou.Contains("+"))
|
|
|
{
|
|
|
for (int i = 0; i < sou.Split('+').Length; i++)
|
|
@@ -552,14 +687,16 @@ namespace OTSIncAReportGrids
|
|
|
ResultFile resultFile = m_ReportApp.m_rstDataMgr.ResultFilesList.Find(s => s.anotherFileName == sou.Split('+')[i]);
|
|
|
if (resultFile != null)
|
|
|
{
|
|
|
- BindDataGridView(resultFile.FilePath, i, resultFile.anotherFileName, GraphicType);
|
|
|
- }
|
|
|
+ BindDataGridView(resultFile.FilePath, i, resultFile.anotherFileName);
|
|
|
+ list_fileName.Add(resultFile.anotherFileName);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- BindDataGridView(m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath, 0, m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()].anotherFileName, GraphicType);
|
|
|
- }
|
|
|
+ BindDataGridView(m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath, 0, m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()].anotherFileName);
|
|
|
+ list_fileName.Add(m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()].anotherFileName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void Gview_gz_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
|