瀏覽代碼

颗粒尺寸表加图形显示

zhangjiaxin 3 月之前
父節點
當前提交
be0ee10cc2

+ 83 - 6
OTSIncAReportApp/1-UI/Control_Grids/CompositionDistributionGrid.cs

@@ -1,5 +1,9 @@
-using OTSCommon.DBOperate.Model;
+using DevExpress.Utils;
+using DevExpress.XtraCharts;
+using DevExpress.XtraTreeList.Data;
+using OTSCommon.DBOperate.Model;
 using OTSIncAReportApp;
+using OTSIncAReportApp._1_UI.Control_DEVCharts;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using OTSIncAReportApp.OTSSampleReportInfo;
@@ -10,6 +14,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.Linq;
 using System.Windows.Forms;
 
 namespace OTSIncAReportGrids
@@ -43,7 +48,10 @@ namespace OTSIncAReportGrids
 
         frmReportConditionChoose m_condition;
 
-        int gridheight = 0;
+        //int gridheight = 0;
+        List<int> list_gridheight = new List<int>();
+
+		int gridwidth = 0;
         #endregion
 
         #region 多数据源
@@ -261,7 +269,70 @@ namespace OTSIncAReportGrids
             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;
+
+			ComboBox comboBox1 = new ComboBox();
+            comboBox1.Items.Add("折线图");
+			comboBox1.Items.Add("柱状图");
+			comboBox1.Items.Add("饼图");
+			comboBox1.Items.Add("圆环图");
+			comboBox1.Items.Add("气泡图");
+			comboBox1.Items.Add("簇状条形图");
+			comboBox1.Items.Add("堆积条形图");
+			comboBox1.Items.Add("瀑布图");
+			comboBox1.Items.Add("3D柱状图");
+			comboBox1.Items.Add("3D圆环图");
+			comboBox1.Items.Add("3D饼图");
+			comboBox1.Items.Add("3D折线图");
+			comboBox1.Items.Add("3D百分比堆积条形图");
+			comboBox1.Items.Add("3D漏斗图");
+			comboBox1.Items.Add("3DManhattan 条形图");
+			comboBox1.Items.Add("3D堆积条形图");
+			comboBox1.Items.Add("3D阶梯线图");
+			comboBox1.SelectedIndex = 1;
+            comboBox1.Location = new Point( panel.Size.Width - comboBox1.Width-2,4);
+			panel.Controls.Add(comboBox1);
+			panel1.Controls.Add(panel);
+           
+            Graphics(dt, filename, comboBox1.Text);
+
+		}
+
+        private void Graphics(DataTable data,string filename,string comboBox1Text)
+        {
+            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(0, list_gridheight.Max() + 27);
+            chartControl1.Size = new Size(gridwidth, gridwidth);
+			panel1.Controls.Add(chartControl1);
+		}
 
         /// <summary>
         /// 设置DataGridView样式
@@ -311,8 +382,11 @@ namespace OTSIncAReportGrids
 
             //gridView.Dock = System.Windows.Forms.DockStyle.Fill;
             //gridView.Location = new System.Drawing.Point(0, 0);
-            gridView.Location = new System.Drawing.Point(0, gridheight);
-            gridView.Margin = new System.Windows.Forms.Padding(2);
+            //gridView.Location = new System.Drawing.Point(0, gridheight);
+            int gridheight = 0;
+			gridView.Location = new System.Drawing.Point(gridwidth, 0);
+
+			gridView.Margin = new System.Windows.Forms.Padding(2);
             gridView.MergeColumnHeaderBackColor = System.Drawing.SystemColors.ButtonHighlight;
             //gridView.Name = "Gview_gz";
             gridView.ReadOnly = true;
@@ -322,7 +396,10 @@ namespace OTSIncAReportGrids
             //gridView.Size = new System.Drawing.Size(667, 520);
             gridView.Size = new System.Drawing.Size(gridView.ColumnCount * 100 + 60, gridView.RowCount * 30 + 30);
             gridheight = gridheight + gridView.RowCount * 30 + 80;
-            gridView.TabIndex = 0;
+            gridwidth = gridwidth + gridView.ColumnCount * 100 + 60;
+			list_gridheight.Add(gridheight);
+
+			gridView.TabIndex = 0;
             gridView.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.Gview_gz_SortCompare);
             gridView.Sorted += new System.EventHandler(this.Gview_gz_Sorted);
 

+ 86 - 85
OTSIncAReportApp/1-UI/Control_Grids/CompositionDistributionGrid.designer.cs

@@ -28,94 +28,95 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CompositionDistributionGrid));
-            this.panel1 = new System.Windows.Forms.Panel();
-            this.pictureBox1 = new System.Windows.Forms.PictureBox();
-            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
-            this.ToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
-            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
-            this.ToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
-            this.panel1.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
-            this.contextMenuStrip1.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // panel1
-            // 
-            this.panel1.AutoScroll = true;
-            this.panel1.Controls.Add(this.pictureBox1);
-            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel1.Location = new System.Drawing.Point(0, 0);
-            this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(1000, 780);
-            this.panel1.TabIndex = 5;
-            // 
-            // pictureBox1
-            // 
-            this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
-            this.pictureBox1.Location = new System.Drawing.Point(746, 735);
-            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
-            this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(255, 45);
-            this.pictureBox1.TabIndex = 1;
-            this.pictureBox1.TabStop = false;
-            // 
-            // contextMenuStrip1
-            // 
-            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
-            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+			this.components = new System.ComponentModel.Container();
+			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CompositionDistributionGrid));
+			this.panel1 = new System.Windows.Forms.Panel();
+			this.pictureBox1 = new System.Windows.Forms.PictureBox();
+			this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+			this.ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+			this.ToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+			this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+			this.ToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
+			this.panel1.SuspendLayout();
+			((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+			this.contextMenuStrip1.SuspendLayout();
+			this.SuspendLayout();
+			// 
+			// panel1
+			// 
+			this.panel1.AutoScroll = true;
+			this.panel1.Controls.Add(this.pictureBox1);
+			this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+			this.panel1.Location = new System.Drawing.Point(0, 0);
+			this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+			this.panel1.Name = "panel1";
+			this.panel1.Size = new System.Drawing.Size(667, 520);
+			this.panel1.TabIndex = 5;
+			// 
+			// pictureBox1
+			// 
+			this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+			this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
+			this.pictureBox1.Location = new System.Drawing.Point(497, 490);
+			this.pictureBox1.Name = "pictureBox1";
+			this.pictureBox1.Size = new System.Drawing.Size(170, 30);
+			this.pictureBox1.TabIndex = 1;
+			this.pictureBox1.TabStop = false;
+			// 
+			// contextMenuStrip1
+			// 
+			this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
+			this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.ToolStripMenuItem1,
             this.ToolStripMenuItem2,
             this.toolStripSeparator1,
             this.ToolStripMenuItem3});
-            this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(215, 100);
-            // 
-            // ToolStripMenuItem1
-            // 
-            this.ToolStripMenuItem1.Image = global::OTSIncAReportApp.Properties.Resources.复制;
-            this.ToolStripMenuItem1.Name = "ToolStripMenuItem1";
-            this.ToolStripMenuItem1.Size = new System.Drawing.Size(214, 30);
-            this.ToolStripMenuItem1.Text = "复制整个表";
-            this.ToolStripMenuItem1.Click += new System.EventHandler(this.ToolStripMenuItem1_Click);
-            // 
-            // ToolStripMenuItem2
-            // 
-            this.ToolStripMenuItem2.Image = global::OTSIncAReportApp.Properties.Resources.复制全部;
-            this.ToolStripMenuItem2.Name = "ToolStripMenuItem2";
-            this.ToolStripMenuItem2.Size = new System.Drawing.Size(214, 30);
-            this.ToolStripMenuItem2.Text = "复制选择区域";
-            this.ToolStripMenuItem2.Click += new System.EventHandler(this.ToolStripMenuItem2_Click);
-            // 
-            // toolStripSeparator1
-            // 
-            this.toolStripSeparator1.Name = "toolStripSeparator1";
-            this.toolStripSeparator1.Size = new System.Drawing.Size(211, 6);
-            // 
-            // ToolStripMenuItem3
-            // 
-            this.ToolStripMenuItem3.Image = global::OTSIncAReportApp.Properties.Resources.恢复;
-            this.ToolStripMenuItem3.Name = "ToolStripMenuItem3";
-            this.ToolStripMenuItem3.Size = new System.Drawing.Size(214, 30);
-            this.ToolStripMenuItem3.Text = "恢复至初始状态";
-            this.ToolStripMenuItem3.Click += new System.EventHandler(this.ToolStripMenuItem3_Click);
-            // 
-            // CompositionDistributionGrid
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
-            this.Controls.Add(this.panel1);
-            this.Name = "CompositionDistributionGrid";
-            this.Size = new System.Drawing.Size(1000, 780);
-            this.Load += new System.EventHandler(this.CompositionDistributionGrid_Load);
-            this.panel1.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
-            this.contextMenuStrip1.ResumeLayout(false);
-            this.ResumeLayout(false);
+			this.contextMenuStrip1.Name = "contextMenuStrip1";
+			this.contextMenuStrip1.Size = new System.Drawing.Size(169, 100);
+			// 
+			// ToolStripMenuItem1
+			// 
+			this.ToolStripMenuItem1.Image = global::OTSIncAReportApp.Properties.Resources.复制;
+			this.ToolStripMenuItem1.Name = "ToolStripMenuItem1";
+			this.ToolStripMenuItem1.Size = new System.Drawing.Size(168, 30);
+			this.ToolStripMenuItem1.Text = "复制整个表";
+			this.ToolStripMenuItem1.Click += new System.EventHandler(this.ToolStripMenuItem1_Click);
+			// 
+			// ToolStripMenuItem2
+			// 
+			this.ToolStripMenuItem2.Image = global::OTSIncAReportApp.Properties.Resources.复制全部;
+			this.ToolStripMenuItem2.Name = "ToolStripMenuItem2";
+			this.ToolStripMenuItem2.Size = new System.Drawing.Size(168, 30);
+			this.ToolStripMenuItem2.Text = "复制选择区域";
+			this.ToolStripMenuItem2.Click += new System.EventHandler(this.ToolStripMenuItem2_Click);
+			// 
+			// toolStripSeparator1
+			// 
+			this.toolStripSeparator1.Name = "toolStripSeparator1";
+			this.toolStripSeparator1.Size = new System.Drawing.Size(165, 6);
+			// 
+			// ToolStripMenuItem3
+			// 
+			this.ToolStripMenuItem3.Image = global::OTSIncAReportApp.Properties.Resources.恢复;
+			this.ToolStripMenuItem3.Name = "ToolStripMenuItem3";
+			this.ToolStripMenuItem3.Size = new System.Drawing.Size(168, 30);
+			this.ToolStripMenuItem3.Text = "恢复至初始状态";
+			this.ToolStripMenuItem3.Click += new System.EventHandler(this.ToolStripMenuItem3_Click);
+			// 
+			// CompositionDistributionGrid
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
+			this.Controls.Add(this.panel1);
+			this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+			this.Name = "CompositionDistributionGrid";
+			this.Size = new System.Drawing.Size(667, 520);
+			this.Load += new System.EventHandler(this.CompositionDistributionGrid_Load);
+			this.panel1.ResumeLayout(false);
+			((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+			this.contextMenuStrip1.ResumeLayout(false);
+			this.ResumeLayout(false);
 
         }
 
@@ -128,5 +129,5 @@
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem3;
         private System.Windows.Forms.PictureBox pictureBox1;
-    }
+	}
 }

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Grids/CompositionDistributionGrid.resx

@@ -121,7 +121,7 @@
   <data name="pictureBox1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAKoAAAAfCAYAAAB3cVZEAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAABhBJREFUeF7tmI1NZDEMhGmBGmiBHiiBGmiBDuiADqiACmiABuiAHvb0oTU3O2s7
+        wgAADsIBFShKgAAABhBJREFUeF7tmI1NZDEMhGmBGmiBHiiBGmiBDuiADqiACmiABuiAHvb0oTU3O2s7
         eYvQ3ZMykgW8OI5/xk7urg4LCzvAIurCr+Lt7e3w+Ph4uLu7O1xdXZ3I7e3t4eHh4UtnhEXUhV8B5Lu5
         uTkjZyUQ+f39/bj7HEOifnx8pB1xfX399e35+fnw+fl51D4Ha53DdBX2OUeB05n+SJ6eno4W/gIf8BN/
         8Vv1+Zad77i/vz/ZxySoQJFCj/MuBXY4hxzp2eQTf15eXo6ap/AYZ4Q8KDRnrkeOu5qTT90zK/hd1aEk