From fae1f8b7c991915d0c804bf13a383c7a5481767b Mon Sep 17 00:00:00 2001 From: mjjo53 Date: Sat, 24 Jun 2017 17:32:17 +0900 Subject: [PATCH] =?UTF-8?q?-=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20Trend=20=EA=B7=B8=EB=9E=98=ED=94=84=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ExcelHelper.cs | 90 ++++++++++++++++++++++ MainForm.Designer.cs | 6 +- MainForm.cs | 20 +++-- MainForm.resx | 24 +++--- PanelTrendGraph.Designer.cs | 23 ++++-- PanelTrendGraph.cs | 37 +++++---- Report.cs | 146 ++++++++++++++++++++++++++++++++---- friction.csproj | 1 + 8 files changed, 290 insertions(+), 57 deletions(-) create mode 100644 ExcelHelper.cs diff --git a/ExcelHelper.cs b/ExcelHelper.cs new file mode 100644 index 0000000..1bd3f9d --- /dev/null +++ b/ExcelHelper.cs @@ -0,0 +1,90 @@ +using OfficeOpenXml; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace friction +{ + public class ExcelHelper + { + //The correct method to convert width to pixel is: + //Pixel =Truncate(((256 * {width} + Truncate(128/{Maximum DigitWidth}))/256)*{Maximum Digit Width}) + + //The correct method to convert pixel to width is: + //1. use the formula =Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100 + // to convert pixel to character number. + //2. use the formula width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256 + // to convert the character number to width. + + public const int MTU_PER_PIXEL = 9525; + + public static int ColumnWidth2Pixel(ExcelWorksheet ws, double excelColumnWidth) + { + //The correct method to convert width to pixel is: + //Pixel =Truncate(((256 * {width} + Truncate(128/{Maximum DigitWidth}))/256)*{Maximum Digit Width}) + + //get the maximum digit width + decimal mdw = ws.Workbook.MaxFontWidth; + + //convert width to pixel + decimal pixels = decimal.Truncate(((256 * (decimal)excelColumnWidth + decimal.Truncate(128 / mdw)) / 256) * mdw); + //double columnWidthInTwips = (double)(pixels * (1440f / 96f)); + + return Convert.ToInt32(pixels); + + } + + public static double Pixel2ColumnWidth(ExcelWorksheet ws, int pixels) + { + //The correct method to convert pixel to width is: + //1. use the formula =Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100 + // to convert pixel to character number. + //2. use the formula width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256 + // to convert the character number to width. + + //get the maximum digit width + decimal mdw = ws.Workbook.MaxFontWidth; + + //convert pixel to character number + decimal numChars = decimal.Truncate(decimal.Add((pixels - 5) / mdw * 100, (decimal)0.5)) / 100; + //convert the character number to width + decimal excelColumnWidth = decimal.Truncate((decimal.Add(numChars * mdw, 5)) / mdw * 256) / 256; + + return Convert.ToDouble(excelColumnWidth); + } + + public static int RowHeight2Pixel(double excelRowHeight) + { + //convert height to pixel + decimal pixels = decimal.Truncate((decimal)(excelRowHeight / 0.75)); + + return Convert.ToInt32(pixels); + } + + public static double Pixel2RowHeight(int pixels) + { + //convert height to pixel + double excelRowHeight = pixels * 0.75; + + return excelRowHeight; + } + + public static int MTU2Pixel(int mtus) + { + //convert MTU to pixel + decimal pixels = decimal.Truncate(mtus / MTU_PER_PIXEL); + + return Convert.ToInt32(pixels); + } + + public static int Pixel2MTU(int pixels) + { + //convert pixel to MTU + int mtus = pixels * MTU_PER_PIXEL; + + return mtus; + } + } +} diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index d0d6e6a..f5e8ffd 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -304,8 +304,8 @@ // allToolStripMenuItem // this.allToolStripMenuItem.Name = "allToolStripMenuItem"; - this.allToolStripMenuItem.Size = new System.Drawing.Size(88, 22); - this.allToolStripMenuItem.Text = "All"; + this.allToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.allToolStripMenuItem.Text = "Export to Excel"; this.allToolStripMenuItem.Click += new System.EventHandler(this.allToolStripMenuItem_Click); // // aToolStripMenuItem @@ -319,7 +319,7 @@ // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // diff --git a/MainForm.cs b/MainForm.cs index 5d13826..20e596c 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -186,12 +186,17 @@ namespace friction m_Report.RadarChart = m_RadarGraphPanel.CopyChart(); - m_Report.Export(); - - Cursor.Current = Cursors.Default; - - //OpenPanel(m_TrendGraphPanel); - //m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.HUMIDITY); + if(m_DataHandler.GetCurTable() != "" && m_DataHandler.GetCurTable() != "All") + { + OpenPanel(m_TrendGraphPanel); + m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.HUMIDITY); + } + else + { + m_Report.Export(); + m_Report = null; + Cursor.Current = Cursors.Default; + } } public void OnChartUpdate(Bitmap bm, PanelTrendGraph.GRAPH_TYPE Type) @@ -217,6 +222,7 @@ namespace friction m_Report.TrendChartByVelocity = bm; m_Report.Export(); m_Report = null; + Cursor.Current = Cursors.Default; break; } } @@ -297,8 +303,6 @@ namespace friction } m_AnalysisPanel.UpdateData(m_DataHandler); - - Console.WriteLine("[MainForm::OnApply] end"); } public void OnRadarSelectTable(string strTable) diff --git a/MainForm.resx b/MainForm.resx index 835a14b..0401ec4 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -167,34 +167,34 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJ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Luv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB - oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEA/779VU6Qnd0AAAAASUVORK5CYII= + j66o8vyZgKrzx6RBbKwGgELUZeLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB + oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEA8cf9UGxcQysAAAAASUVORK5CYII= diff --git a/PanelTrendGraph.Designer.cs b/PanelTrendGraph.Designer.cs index 13d4164..619c3ea 100644 --- a/PanelTrendGraph.Designer.cs +++ b/PanelTrendGraph.Designer.cs @@ -34,15 +34,15 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rbVelocity = new System.Windows.Forms.RadioButton(); this.rbForce = new System.Windows.Forms.RadioButton(); + this.panelGraph = new System.Windows.Forms.Panel(); this.groupBox1.SuspendLayout(); + this.panelGraph.SuspendLayout(); this.SuspendLayout(); // // trendChart // - this.trendChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.trendChart.Location = new System.Drawing.Point(8, 59); + this.trendChart.Dock = System.Windows.Forms.DockStyle.Fill; + this.trendChart.Location = new System.Drawing.Point(0, 0); this.trendChart.Name = "trendChart"; this.trendChart.Size = new System.Drawing.Size(742, 603); this.trendChart.TabIndex = 0; @@ -117,14 +117,25 @@ this.rbForce.UseVisualStyleBackColor = true; this.rbForce.CheckedChanged += new System.EventHandler(this.rbForce_CheckedChanged); // + // panelGraph + // + this.panelGraph.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelGraph.Controls.Add(this.trendChart); + this.panelGraph.Location = new System.Drawing.Point(8, 59); + this.panelGraph.Name = "panelGraph"; + this.panelGraph.Size = new System.Drawing.Size(742, 603); + this.panelGraph.TabIndex = 3; + // // PanelTrendGraph // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(762, 674); this.ControlBox = false; + this.Controls.Add(this.panelGraph); this.Controls.Add(this.groupBox1); - this.Controls.Add(this.trendChart); this.HideOnClose = true; this.Name = "PanelTrendGraph"; this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document; @@ -132,6 +143,7 @@ this.Text = "Trend Graph"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + this.panelGraph.ResumeLayout(false); this.ResumeLayout(false); } @@ -144,5 +156,6 @@ private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.RadioButton rbVelocity; private System.Windows.Forms.RadioButton rbForce; + private System.Windows.Forms.Panel panelGraph; } } \ No newline at end of file diff --git a/PanelTrendGraph.cs b/PanelTrendGraph.cs index ec84c2a..02c0811 100644 --- a/PanelTrendGraph.cs +++ b/PanelTrendGraph.cs @@ -13,7 +13,7 @@ using LiveCharts.Wpf; using LiveCharts.WinForms; using LiveCharts.Defaults; using System.Windows.Media; -using System.Threading; +using System.Timers; namespace friction { @@ -38,6 +38,7 @@ namespace friction // for report bool m_bReport = false; + System.Windows.Forms.Timer m_ReportTimer = null; public PanelTrendGraph(MainForm owner, DataHandler data) { @@ -54,6 +55,7 @@ namespace friction Theme.Apply(rbTemp); + trendChart.AxisX.Add(new Axis { Title = "Humidity", @@ -386,8 +388,6 @@ namespace friction public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE) { - Console.WriteLine("[TrendGraph::UpdateGraph] start"); - if (Type == GRAPH_TYPE.NONE) { if (rbHumidity.Checked == true) @@ -398,8 +398,6 @@ namespace friction UpdateGraph(GRAPH_TYPE.FORCE); else if (rbVelocity.Checked == true) UpdateGraph(GRAPH_TYPE.VELOCITY); - - Console.WriteLine("[TrendGraph::UpdateGraph] end"); return; } @@ -428,8 +426,6 @@ namespace friction m_CurSpring = strSpring; m_CurTable = strTable; m_GraphType = Type; - - Console.WriteLine("[TrendGraph::UpdateGraph] end"); } private void rbHumidity_CheckedChanged(object sender, EventArgs e) @@ -454,6 +450,7 @@ namespace friction public void CopyChart(GRAPH_TYPE Type) { + Cursor.Current = Cursors.WaitCursor; m_bReport = true; trendChart.DisableAnimations = true; UpdateGraph(Type); @@ -463,16 +460,28 @@ namespace friction { if(m_bReport == true) { - Thread.Sleep(1500); + Cursor.Current = Cursors.WaitCursor; + m_ReportTimer = new System.Windows.Forms.Timer(); + m_ReportTimer.Interval = 500; + m_ReportTimer.Tick += new EventHandler(TimerCallback); + m_ReportTimer.Start(); - m_bReport = false; - - Bitmap bm = new Bitmap(Width, Height); - DrawToBitmap(bm, new Rectangle(0, 0, Width, Height)); - m_Owner.OnChartUpdate(bm, m_GraphType); + Console.WriteLine("Chart Updated ({0})", m_GraphType); } + } - Console.WriteLine("chart updated"); + private void TimerCallback(object sender, EventArgs e) + { + Console.WriteLine("Chart Timer Callback ({0})", m_GraphType); + m_bReport = false; + m_ReportTimer.Stop(); + + this.Invoke(new Action(() => + { + Bitmap bm = new Bitmap(Width, Height); + panelGraph.DrawToBitmap(bm, new Rectangle(panelGraph.Left, panelGraph.Top, panelGraph.Width, panelGraph.Height)); + m_Owner.OnChartUpdate(bm, m_GraphType); + })); } } } diff --git a/Report.cs b/Report.cs index 97f0c8e..3f635f3 100644 --- a/Report.cs +++ b/Report.cs @@ -48,12 +48,77 @@ namespace friction int iTableRowStart = iRow-1; int iTableColStart = iCol; + double dValue; + int iNoOfTest = 0; + int iAvgRPNColumn = 1; + foreach(DataRow row in AnalysisData.Rows) { + int.TryParse(row["No. of Tests"].ToString(), out iNoOfTest); + iCol = 2; for (int i = 0; i < AnalysisData.Columns.Count; i++) { - Sheet.Cells[iRow, iCol].Value = row[i]; + if(double.TryParse(row[i].ToString(), out dValue) == true) + { + Sheet.Cells[iRow, iCol].Value = dValue; + + if(AnalysisData.Columns[i].ColumnName == "No. of Tests") + { + + } + else if (AnalysisData.Columns[i].ColumnName == "Average RPN") + { + Sheet.Cells[iRow, iCol].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; + + var Risk = Config.ANALYSIS.GetRisk((float)dValue); + switch (Risk) + { + case Config.ANALYSIS.RISK.NO: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Green); + break; + + case Config.ANALYSIS.RISK.POTENTIAL: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Yellow); + break; + + case Config.ANALYSIS.RISK.HIGH: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Red); + break; + } + + iAvgRPNColumn = iCol; + } + else + { + Sheet.Cells[iRow, iCol].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; + var Dependancy = Config.ANALYSIS.GetDependancy((float)dValue, iNoOfTest); + switch (Dependancy) + { + case Config.ANALYSIS.DEPENDANCY.NO: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Green); + break; + + case Config.ANALYSIS.DEPENDANCY.POTENTIAL: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Yellow); + break; + + case Config.ANALYSIS.DEPENDANCY.HIGH: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Red); + break; + + case Config.ANALYSIS.DEPENDANCY.NOT_ENNOUGH_DATA: + Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Gray); + Sheet.Cells[iRow, iAvgRPNColumn].Style.Fill.BackgroundColor.SetColor(Theme.Gray); + break; + } + } + } + else + { + Sheet.Cells[iRow, iCol].Value = row[i].ToString(); + } + iCol++; } @@ -68,27 +133,78 @@ namespace friction iRow += 2; iCol = 2; + double dX=0; + double dY=0; + for (int i = 1; i < iCol; i++) + dX += ExcelHelper.ColumnWidth2Pixel(Sheet, Sheet.Column(i).Width); + for (int i = 1; i < iRow; i++) + dY += ExcelHelper.RowHeight2Pixel(Sheet.Row(i).Height); + + int iWidth = RadarChart.Width; + int iHeight = RadarChart.Height; + iHeight = iHeight * 800 / iWidth; + iWidth = 800; + + var picRadarChart = Sheet.Drawings.AddPicture("Radar Chart", RadarChart); - picRadarChart.SetPosition(iRow, 0, iCol-1, 0); - iRow += 30; + picRadarChart.SetPosition((int)dY, (int)dX); + picRadarChart.SetSize(iWidth, iHeight); + dY += iHeight + 60; - //var picTrendChartHumidity = Sheet.Drawings.AddPicture("Trend Chart by Humidity", TrendChartByHumidity); - //picTrendChartHumidity.SetPosition(iRow, 0, iCol, 0); - //iRow += 30; - //var picTrendChartTemperature = Sheet.Drawings.AddPicture("Trend Chart by Temperature", TrendChartByTemperature); - //picTrendChartTemperature.SetPosition(iRow, 0, iCol, 0); - //iRow += 30; + if (TrendChartByHumidity != null) + { - //var picTrendChartForce = Sheet.Drawings.AddPicture("Trend Chart by Force", TrendChartByForce); - //picTrendChartForce.SetPosition(iRow, 0, iCol, 0); - //iRow += 30; + Sheet.Cells[52, 2].Value = MaterialSpring + " vs " + MaterialTable; + Sheet.Cells[52, 2].Style.Font.Bold = true; - //var picTrendChartVelocity = Sheet.Drawings.AddPicture("Trend Chart by Velocity", TrendChartByVelocity); - //picTrendChartVelocity.SetPosition(iRow, 0, iCol, 0); - //iRow += 30; + dY += 10; + var picTrendChartHumidity = Sheet.Drawings.AddPicture("Trend Chart by Humidity", TrendChartByHumidity); + picTrendChartHumidity.SetPosition((int)dY, (int)dX); + iWidth = TrendChartByHumidity.Width; + iHeight = TrendChartByHumidity.Height; + iHeight = iHeight * 390 / iWidth; + iWidth = 390; + picTrendChartHumidity.SetSize(iWidth, iHeight); + Sheet.Cells[64, 2].Value = "by Humidity"; + + + dX += 400; + var picTrendChartTemperature = Sheet.Drawings.AddPicture("Trend Chart by Temperature", TrendChartByTemperature); + picTrendChartTemperature.SetPosition((int)dY, (int)dX); + iWidth = TrendChartByTemperature.Width; + iHeight = TrendChartByTemperature.Height; + iHeight = iHeight * 390 / iWidth; + iWidth = 390; + picTrendChartTemperature.SetSize(iWidth, iHeight); + Sheet.Cells[64, 6].Value = "by Temperature"; + + + dX -= 400; + dY += iHeight + 10; + var picTrendChartForce = Sheet.Drawings.AddPicture("Trend Chart by Force", TrendChartByForce); + picTrendChartForce.SetPosition((int)dY, (int)dX); + iWidth = TrendChartByForce.Width; + iHeight = TrendChartByForce.Height; + iHeight = iHeight * 390 / iWidth; + iWidth = 390; + picTrendChartForce.SetSize(iWidth, iHeight); + Sheet.Cells[76, 2].Value = "by Force"; + + + dX += 400; + var picTrendChartVelocity = Sheet.Drawings.AddPicture("Trend Chart by Velocity", TrendChartByVelocity); + picTrendChartVelocity.SetPosition((int)dY, (int)dX); + iWidth = TrendChartByVelocity.Width; + iHeight = TrendChartByVelocity.Height; + iHeight = iHeight * 390 / iWidth; + iWidth = 390; + picTrendChartVelocity.SetSize(iWidth, iHeight); + Sheet.Cells[76, 6].Value = "by Velocity"; + } package.SaveAs(new FileInfo(FilePath)); + Console.WriteLine("Report Saved"); } } } diff --git a/friction.csproj b/friction.csproj index 52107cc..dd48620 100644 --- a/friction.csproj +++ b/friction.csproj @@ -79,6 +79,7 @@ + Form