- Material Pair에 layout 적용

- Trend Graph에 Force, Velocity 추가
This commit is contained in:
2017-06-23 14:59:08 +09:00
parent 244eab56a6
commit bc27de2ea5
12 changed files with 488 additions and 188 deletions

View File

@@ -40,6 +40,8 @@ namespace friction
{ {
public float HUMIDITY; public float HUMIDITY;
public float TEMPERATURE; public float TEMPERATURE;
public float FORCE;
public float VELOCITY;
public float RPN; public float RPN;
override public string ToString() override public string ToString()
@@ -207,7 +209,7 @@ namespace friction
return result; return result;
} }
public List<TREND_CHART> GetHumidityChart(string strSpring, string strTable) public List<TREND_CHART> GetTrendChart(string strSpring, string strTable)
{ {
string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", Config.COLUMN_NAME.SPRING, strSpring, Config.COLUMN_NAME.TABLE, strTable); string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", Config.COLUMN_NAME.SPRING, strSpring, Config.COLUMN_NAME.TABLE, strTable);
DataRow[] rows = m_Data.Select(strQuery); DataRow[] rows = m_Data.Select(strQuery);
@@ -219,6 +221,8 @@ namespace friction
{ {
HUMIDITY = (float)r[Config.COLUMN_NAME.HUMIDITY], HUMIDITY = (float)r[Config.COLUMN_NAME.HUMIDITY],
TEMPERATURE = (float)r[Config.COLUMN_NAME.TEMP], TEMPERATURE = (float)r[Config.COLUMN_NAME.TEMP],
FORCE = (float)r[Config.COLUMN_NAME.FORCE],
VELOCITY = (float)r[Config.COLUMN_NAME.VELOCITY],
RPN = (float)r[Config.COLUMN_NAME.RPN], RPN = (float)r[Config.COLUMN_NAME.RPN],
}); });
} }
@@ -226,7 +230,6 @@ namespace friction
return result; return result;
} }
#region calculation #region calculation
float CalcDependency(DataRow[] rows, string strColumn) float CalcDependency(DataRow[] rows, string strColumn)
{ {

23
MainForm.Designer.cs generated
View File

@@ -55,6 +55,8 @@
this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.aToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMain.SuspendLayout(); this.toolStripMain.SuspendLayout();
this.statusStrip.SuspendLayout(); this.statusStrip.SuspendLayout();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
@@ -184,7 +186,8 @@
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.tableToolStripMenuItem, this.tableToolStripMenuItem,
this.graphToolStripMenuItem, this.graphToolStripMenuItem,
this.reportToolStripMenuItem}); this.reportToolStripMenuItem,
this.aToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip"; this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1184, 24); this.menuStrip.Size = new System.Drawing.Size(1184, 24);
@@ -291,6 +294,21 @@
this.dockPanel.Size = new System.Drawing.Size(1184, 690); this.dockPanel.Size = new System.Drawing.Size(1184, 690);
this.dockPanel.TabIndex = 2; this.dockPanel.TabIndex = 2;
// //
// aToolStripMenuItem
//
this.aToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem});
this.aToolStripMenuItem.Name = "aToolStripMenuItem";
this.aToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.aToolStripMenuItem.Text = "Help";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -302,6 +320,7 @@
this.Controls.Add(this.menuStrip); this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip; this.MainMenuStrip = this.menuStrip;
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "Material Stick-Slip Analysis"; this.Text = "Material Stick-Slip Analysis";
this.toolStripMain.ResumeLayout(false); this.toolStripMain.ResumeLayout(false);
@@ -343,6 +362,8 @@
private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem;
private System.Windows.Forms.ToolStripButton toolStripButtonMaterial; private System.Windows.Forms.ToolStripButton toolStripButtonMaterial;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem aToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
} }
} }

View File

@@ -70,6 +70,8 @@ namespace friction
DialogResult result = ofd.ShowDialog(); DialogResult result = ofd.ShowDialog();
if (result == DialogResult.OK) if (result == DialogResult.OK)
m_DBFileName = ofd.FileName; m_DBFileName = ofd.FileName;
else
return;
} }
else else
{ {
@@ -98,7 +100,7 @@ namespace friction
UpdateRecentFile(); UpdateRecentFile();
} }
private void OpenPanel(DockContent panel) public void OpenPanel(DockContent panel)
{ {
if (panel.Visible == false) if (panel.Visible == false)
panel.Show(dockPanel); panel.Show(dockPanel);
@@ -146,8 +148,16 @@ namespace friction
OpenPanel(m_TrendGraphPanel); OpenPanel(m_TrendGraphPanel);
m_TrendGraphPanel.UpdateGraph(); m_TrendGraphPanel.UpdateGraph();
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
//AboutWindow aboutWindow = new AboutWindow();
//aboutWindow.Show();
}
#endregion #endregion
#region Events from toolbox #region Events from toolbox
private void toolStripButtonOpen_Click(object sender, EventArgs e) private void toolStripButtonOpen_Click(object sender, EventArgs e)
{ {
@@ -185,8 +195,6 @@ namespace friction
#region Events from panels #region Events from panels
public void OnApplyData(string strSpring, string strTable) public void OnApplyData(string strSpring, string strTable)
{ {
Console.WriteLine(string.Format("[start] MainForm::OnApplyData({0}, {1})", strSpring, strTable));
m_DataHandler.SetSelectedMaterial(strSpring, strTable); m_DataHandler.SetSelectedMaterial(strSpring, strTable);
if (strTable == "All") if (strTable == "All")
@@ -209,28 +217,42 @@ namespace friction
} }
m_AnalysisPanel.UpdateData(m_DataHandler); m_AnalysisPanel.UpdateData(m_DataHandler);
Console.WriteLine(string.Format("[end ] MainForm::OnApplyData({0}, {1})", strSpring, strTable));
} }
public void OnRadarSelectTable(string strTable) public void OnRadarSelectTable(string strTable)
{ {
if (m_AnalysisPanel != null) if (m_AnalysisPanel != null)
m_AnalysisPanel.SelectRow(strTable); m_AnalysisPanel.SelectRow(strTable);
OpenPanel(m_AnalysisPanel);
} }
public void OnTrendSelectByHumidity(string strSpring, string strTable, float fHumidity, float fRPN) public void OnTrendSelectByHumidity(string strSpring, string strTable, float fHumidity, float fRPN)
{ {
if (m_ResultPanel != null) if (m_ResultPanel != null)
m_ResultPanel.SelectRowByHumidity(strSpring, strTable, fHumidity, fRPN); m_ResultPanel.SelectRowByHumidity(strSpring, strTable, fHumidity, fRPN);
OpenPanel(m_ResultPanel);
} }
public void OnTrendSelectByTemperature(string strSpring, string strTable, float fTemperature, float fRPN) public void OnTrendSelectByTemperature(string strSpring, string strTable, float fTemperature, float fRPN)
{ {
if (m_ResultPanel != null) if (m_ResultPanel != null)
m_ResultPanel.SelectRowByTemperature(strSpring, strTable, fTemperature, fRPN); m_ResultPanel.SelectRowByTemperature(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
} }
public void OnTrendSelectByForce(string strSpring, string strTable, float fTemperature, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByForce(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
}
public void OnTrendSelectByVelocity(string strSpring, string strTable, float fTemperature, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByVelocity(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
}
#endregion #endregion
} }
} }

View File

@@ -166,24 +166,24 @@
<data name="toolStripButtonRadarGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButtonRadarGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFdSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8xcffPyP27/hcd YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFdSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8+cffPyP27/hcd
PPw1a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3 OPQ1a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3
AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDSg6cPgr AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDSjaf+gr
VAoBQAGGbDNUGA5ATocZUHnu1H+oMAIgG+A1cdcVqDAE/P/PuObBmx+7X33+v/XFp/+rn77HNMC7f8c5 VAoBQAGGbDNUGA5ATocZUHnu1H+oMAIgG+A1cdcVqDAE/P/PuPrBmx+7X33+v/XFp/+rn77HNMC7f8c5
mAEg7DNhVyJUiqF80/m2w2+//ofhtXdefYFKIYDPxN1FyAZA8TUwnrD7f/nmi3ADpp1+sBaqDQFCeo9x mAEg7DNhVyJUiqF80/m2w2+//ofhtXdefYFKIYDPxN1FyAZA8TUwnrD7f/nmi3ADpp1+sBaqDQFCeo9x
gpyOZgAce0/Y9T99+cn/62++/l5/4hYfVBsq8JmwWw6fIW69O24mzdlvAlWOHdjP388B8c6us779276D gpyOZgAce0/Y9T99+cn/62+8/l5/4hYfVBsq8JmwWw6fIW69O24mzdlvAlWOHdjP388B8c6us779W7+D
8cTdZ4D8ApAcVNmgAQwMANmePnUCkMyWAAAAAElFTkSuQmCC 8cTdZ4D8ApAcVNmgAQwMAMJCPmrrgfeiAAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<data name="toolStripButtonTrendGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButtonTrendGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEpSURBVDhPY6A7COk9xuk1Za88lIsdBE7bKeY7aac1lIsC YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEpSURBVDhPY6A7COk9xuk1Za88lIsdBE7bKeY7aac1lIsC
/CbtXunbs+2fV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz /CbtXunbvfWfV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz
D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNunb/uv D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNund9uv
vDUnL4H45edO6FedPz0BxMYAB998DT785msOsiK/ybukAibte+IzcVc1iI/VALfeHULBk/ccb9595QCI vDUnL4H45edO6FedPz0BxMYAB998DT785msOsiK/ybukAibte+IzcVc1iI/VALfeHULBk/ccb9595QCI
j66o8vyZgKrzx6RBbKwGgELUY+Luv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB j66o8vyZgKrzx6RBbKwGgELUfeLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB
oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAKbL9ZOjCSnkAAAAASUVORK5CYII= oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAG7v9X5RifekAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -39,6 +39,7 @@
this.lbInfo22 = new System.Windows.Forms.Label(); this.lbInfo22 = new System.Windows.Forms.Label();
this.lbInfo23 = new System.Windows.Forms.Label(); this.lbInfo23 = new System.Windows.Forms.Label();
this.lbInfo24 = new System.Windows.Forms.Label(); this.lbInfo24 = new System.Windows.Forms.Label();
this.lbSpring = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvAnalysis)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvAnalysis)).BeginInit();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@@ -52,11 +53,11 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.dgvAnalysis.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvAnalysis.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvAnalysis.Location = new System.Drawing.Point(12, 12); this.dgvAnalysis.Location = new System.Drawing.Point(12, 33);
this.dgvAnalysis.Name = "dgvAnalysis"; this.dgvAnalysis.Name = "dgvAnalysis";
this.dgvAnalysis.ReadOnly = true; this.dgvAnalysis.ReadOnly = true;
this.dgvAnalysis.RowTemplate.Height = 23; this.dgvAnalysis.RowTemplate.Height = 23;
this.dgvAnalysis.Size = new System.Drawing.Size(856, 567); this.dgvAnalysis.Size = new System.Drawing.Size(856, 546);
this.dgvAnalysis.TabIndex = 0; this.dgvAnalysis.TabIndex = 0;
// //
// tableLayoutPanel1 // tableLayoutPanel1
@@ -195,12 +196,21 @@
this.lbInfo24.TabIndex = 2; this.lbInfo24.TabIndex = 2;
this.lbInfo24.Text = "Not Enough Data"; this.lbInfo24.Text = "Not Enough Data";
// //
// lbSpring
//
this.lbSpring.AutoSize = true;
this.lbSpring.Location = new System.Drawing.Point(12, 9);
this.lbSpring.Name = "lbSpring";
this.lbSpring.Size = new System.Drawing.Size(0, 12);
this.lbSpring.TabIndex = 2;
//
// PanelAnalysis // PanelAnalysis
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(880, 649); this.ClientSize = new System.Drawing.Size(880, 649);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.lbSpring);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.dgvAnalysis); this.Controls.Add(this.dgvAnalysis);
this.HideOnClose = true; this.HideOnClose = true;
@@ -212,6 +222,7 @@
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -228,5 +239,6 @@
private System.Windows.Forms.Label lbInfo22; private System.Windows.Forms.Label lbInfo22;
private System.Windows.Forms.Label lbInfo23; private System.Windows.Forms.Label lbInfo23;
private System.Windows.Forms.Label lbInfo24; private System.Windows.Forms.Label lbInfo24;
private System.Windows.Forms.Label lbSpring;
} }
} }

View File

@@ -4,7 +4,6 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -27,10 +26,6 @@ namespace friction
Theme.Apply(this); Theme.Apply(this);
Theme.Apply(dgvAnalysis); Theme.Apply(dgvAnalysis);
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, dgvAnalysis, new object[] { true });
lbInfo11.BackColor = Theme.Green; lbInfo11.BackColor = Theme.Green;
lbInfo12.BackColor = Theme.Yellow; lbInfo12.BackColor = Theme.Yellow;
lbInfo13.BackColor = Theme.Red; lbInfo13.BackColor = Theme.Red;
@@ -73,6 +68,9 @@ namespace friction
if (strSpring == m_CurSpring) if (strSpring == m_CurSpring)
return; return;
lbSpring.Text = "Material Spring: " +strSpring;
lbSpring.ForeColor = Color.Orange;
dgvAnalysis.Columns.Clear(); dgvAnalysis.Columns.Clear();
dgvAnalysis.Rows.Clear(); dgvAnalysis.Rows.Clear();
@@ -90,6 +88,8 @@ namespace friction
foreach (string strTable in data.GetTableList()) foreach (string strTable in data.GetTableList())
{ {
DataHandler.CalcResult result = data.GetCalc(strSpring, strTable); DataHandler.CalcResult result = data.GetCalc(strSpring, strTable);
if (result.m_iCnt <= 0)
continue;
int iIdx = dgvAnalysis.Rows.Add(strTable, result.m_iCnt, result.m_fAvgRPN, result.m_fStdRPN, result.m_fDiffByForce, result.m_fDiffByTemp, result.m_fDiffByHumid, result.m_fDiffByVel); int iIdx = dgvAnalysis.Rows.Add(strTable, result.m_iCnt, result.m_fAvgRPN, result.m_fStdRPN, result.m_fDiffByForce, result.m_fDiffByTemp, result.m_fDiffByHumid, result.m_fDiffByVel);

View File

@@ -35,21 +35,24 @@
this.lvchSpring = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lvchSpring = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvTable = new System.Windows.Forms.ListView(); this.lvTable = new System.Windows.Forms.ListView();
this.lvchTable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lvchTable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// lbFileName // lbFileName
// //
this.lbFileName.AutoSize = true; this.lbFileName.AutoSize = true;
this.lbFileName.Font = new System.Drawing.Font("Malgun Gothic", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.lbFileName.Font = new System.Drawing.Font("Malgun Gothic", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.lbFileName.Location = new System.Drawing.Point(7, 9); this.lbFileName.Location = new System.Drawing.Point(3, 0);
this.lbFileName.Name = "lbFileName"; this.lbFileName.Name = "lbFileName";
this.lbFileName.Size = new System.Drawing.Size(0, 25); this.lbFileName.Size = new System.Drawing.Size(0, 25);
this.lbFileName.TabIndex = 4; this.lbFileName.TabIndex = 4;
// //
// label2 // label2
// //
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 46); this.label2.Location = new System.Drawing.Point(3, 43);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(90, 12); this.label2.Size = new System.Drawing.Size(90, 12);
this.label2.TabIndex = 5; this.label2.TabIndex = 5;
@@ -59,7 +62,7 @@
// //
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 339); this.label3.Location = new System.Drawing.Point(3, 389);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(86, 12); this.label3.Size = new System.Drawing.Size(86, 12);
this.label3.TabIndex = 6; this.label3.TabIndex = 6;
@@ -67,15 +70,14 @@
// //
// lvSpring // lvSpring
// //
this.lvSpring.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvSpring.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvSpring.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchSpring}); this.lvchSpring});
this.lvSpring.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvSpring.FullRowSelect = true; this.lvSpring.FullRowSelect = true;
this.lvSpring.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.lvSpring.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSpring.Location = new System.Drawing.Point(12, 61); this.lvSpring.Location = new System.Drawing.Point(3, 58);
this.lvSpring.Name = "lvSpring"; this.lvSpring.Name = "lvSpring";
this.lvSpring.Size = new System.Drawing.Size(326, 263); this.lvSpring.Size = new System.Drawing.Size(292, 320);
this.lvSpring.TabIndex = 7; this.lvSpring.TabIndex = 7;
this.lvSpring.UseCompatibleStateImageBehavior = false; this.lvSpring.UseCompatibleStateImageBehavior = false;
this.lvSpring.View = System.Windows.Forms.View.Details; this.lvSpring.View = System.Windows.Forms.View.Details;
@@ -89,16 +91,14 @@
// //
// lvTable // lvTable
// //
this.lvTable.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.lvTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchTable}); this.lvchTable});
this.lvTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvTable.FullRowSelect = true; this.lvTable.FullRowSelect = true;
this.lvTable.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.lvTable.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvTable.Location = new System.Drawing.Point(12, 354); this.lvTable.Location = new System.Drawing.Point(3, 404);
this.lvTable.Name = "lvTable"; this.lvTable.Name = "lvTable";
this.lvTable.Size = new System.Drawing.Size(326, 361); this.lvTable.Size = new System.Drawing.Size(292, 320);
this.lvTable.TabIndex = 8; this.lvTable.TabIndex = 8;
this.lvTable.UseCompatibleStateImageBehavior = false; this.lvTable.UseCompatibleStateImageBehavior = false;
this.lvTable.View = System.Windows.Forms.View.Details; this.lvTable.View = System.Windows.Forms.View.Details;
@@ -110,24 +110,42 @@
this.lvchTable.Text = "Table"; this.lvchTable.Text = "Table";
this.lvchTable.Width = 305; this.lvchTable.Width = 305;
// //
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.lbFileName, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.lvTable, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.lvSpring, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(298, 727);
this.tableLayoutPanel1.TabIndex = 9;
//
// PanelMaterial // PanelMaterial
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(350, 727); this.ClientSize = new System.Drawing.Size(298, 727);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.lvTable); this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.lvSpring);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbFileName);
this.HideOnClose = true; this.HideOnClose = true;
this.Name = "PanelMaterial"; this.Name = "PanelMaterial";
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.DockLeft; this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.DockLeft;
this.TabText = "Material Pair"; this.TabText = "Material Pair";
this.Text = "Material Pair"; this.Text = "Material Pair";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -139,5 +157,6 @@
private System.Windows.Forms.ListView lvTable; private System.Windows.Forms.ListView lvTable;
private System.Windows.Forms.ColumnHeader lvchSpring; private System.Windows.Forms.ColumnHeader lvchSpring;
private System.Windows.Forms.ColumnHeader lvchTable; private System.Windows.Forms.ColumnHeader lvchTable;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
} }
} }

View File

@@ -37,13 +37,14 @@ namespace friction
chart.Series["SeriesAvg"].Color = Theme.Yellow; chart.Series["SeriesAvg"].Color = Theme.Yellow;
chart.Series["SeriesMin"].Color = Theme.Green; chart.Series["SeriesMin"].Color = Theme.Green;
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0; chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0; chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black;
chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false; chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false; chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true; chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true;
chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1; chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(50, 0, 0, 0); chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(150, 0, 0, 0);
chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false; chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
foreach (var series in chart.Series) foreach (var series in chart.Series)
@@ -78,8 +79,6 @@ namespace friction
chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH); chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH);
chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL); chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL);
chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO); chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO);
//break;
} }

View File

@@ -4,7 +4,6 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -26,9 +25,6 @@ namespace friction
Theme.Apply(dgvData); Theme.Apply(dgvData);
Theme.Apply(lvColumn); Theme.Apply(lvColumn);
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, dgvData, new object[] { true });
dgvData.CellFormatting += DgvData_CellFormatting; dgvData.CellFormatting += DgvData_CellFormatting;
} }
@@ -135,7 +131,48 @@ namespace friction
row.Selected = true; row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index; dgvData.FirstDisplayedScrollingRowIndex = row.Index;
} }
}
public void SelectRowByForce(string strSpring, string strTable, float fForce, float fRPN)
{
dgvData.ClearSelection();
DataGridViewRow row = dgvData.Rows
.Cast<DataGridViewRow>()
.Where(r =>
r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) &&
r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) &&
r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) &&
r.Cells[Config.COLUMN_NAME.FORCE].Value.Equals(fForce)
)
.First();
if (row != null)
{
row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
}
}
public void SelectRowByVelocity(string strSpring, string strTable, float fVelocity, float fRPN)
{
dgvData.ClearSelection();
DataGridViewRow row = dgvData.Rows
.Cast<DataGridViewRow>()
.Where(r =>
r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) &&
r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) &&
r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) &&
r.Cells[Config.COLUMN_NAME.VELOCITY].Value.Equals(fVelocity)
)
.First();
if (row != null)
{
row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
}
} }
} }
} }

View File

@@ -32,6 +32,8 @@
this.rbHumidity = new System.Windows.Forms.RadioButton(); this.rbHumidity = new System.Windows.Forms.RadioButton();
this.rbTemp = new System.Windows.Forms.RadioButton(); this.rbTemp = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbForce = new System.Windows.Forms.RadioButton();
this.rbVelocity = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -77,15 +79,43 @@
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.rbHumidity); this.groupBox1.Controls.Add(this.rbHumidity);
this.groupBox1.Controls.Add(this.rbVelocity);
this.groupBox1.Controls.Add(this.rbForce);
this.groupBox1.Controls.Add(this.rbTemp); this.groupBox1.Controls.Add(this.rbTemp);
this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText; this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText;
this.groupBox1.Location = new System.Drawing.Point(8, 3); this.groupBox1.Location = new System.Drawing.Point(8, 3);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(171, 50); this.groupBox1.Size = new System.Drawing.Size(297, 50);
this.groupBox1.TabIndex = 2; this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Data"; this.groupBox1.Text = "Data";
// //
// rbForce
//
this.rbForce.Appearance = System.Windows.Forms.Appearance.Button;
this.rbForce.AutoSize = true;
this.rbForce.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbForce.Location = new System.Drawing.Point(171, 20);
this.rbForce.Name = "rbForce";
this.rbForce.Size = new System.Drawing.Size(49, 24);
this.rbForce.TabIndex = 1;
this.rbForce.Text = "Force";
this.rbForce.UseVisualStyleBackColor = true;
this.rbForce.CheckedChanged += new System.EventHandler(this.rbForce_CheckedChanged);
//
// rbVelocity
//
this.rbVelocity.Appearance = System.Windows.Forms.Appearance.Button;
this.rbVelocity.AutoSize = true;
this.rbVelocity.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbVelocity.Location = new System.Drawing.Point(226, 19);
this.rbVelocity.Name = "rbVelocity";
this.rbVelocity.Size = new System.Drawing.Size(62, 24);
this.rbVelocity.TabIndex = 1;
this.rbVelocity.Text = "Velocity";
this.rbVelocity.UseVisualStyleBackColor = true;
this.rbVelocity.CheckedChanged += new System.EventHandler(this.rbVelocity_CheckedChanged);
//
// PanelTrendGraph // PanelTrendGraph
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -111,5 +141,7 @@
private System.Windows.Forms.RadioButton rbHumidity; private System.Windows.Forms.RadioButton rbHumidity;
private System.Windows.Forms.RadioButton rbTemp; private System.Windows.Forms.RadioButton rbTemp;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbVelocity;
private System.Windows.Forms.RadioButton rbForce;
} }
} }

View File

@@ -18,12 +18,22 @@ namespace friction
{ {
public partial class PanelTrendGraph : DockContent public partial class PanelTrendGraph : DockContent
{ {
public enum GRAPH_TYPE
{
NONE,
HUMIDITY,
TEMPERATURE,
FORCE,
VELOCITY
}
MainForm m_Owner = null; MainForm m_Owner = null;
DataHandler m_DataHandler = null; DataHandler m_DataHandler = null;
string m_CurSpring = ""; string m_CurSpring = "";
string m_CurTable = ""; string m_CurTable = "";
bool m_bHumidity = false; GRAPH_TYPE m_GraphType = GRAPH_TYPE.NONE;
public PanelTrendGraph(MainForm owner, DataHandler data) public PanelTrendGraph(MainForm owner, DataHandler data)
{ {
@@ -65,7 +75,6 @@ namespace friction
}, },
new AxisSection new AxisSection
{ {
//Label = "Good",
Value = 3, Value = 3,
SectionWidth = 2, SectionWidth = 2,
Fill = new SolidColorBrush Fill = new SolidColorBrush
@@ -76,7 +85,6 @@ namespace friction
}, },
new AxisSection new AxisSection
{ {
//Label = "Bad",
Value = 0, Value = 0,
SectionWidth = 3, SectionWidth = 3,
Fill = new SolidColorBrush Fill = new SolidColorBrush
@@ -100,55 +108,41 @@ namespace friction
{ {
m_CurSpring = ""; m_CurSpring = "";
m_CurTable = ""; m_CurTable = "";
m_bHumidity = false; m_GraphType = GRAPH_TYPE.NONE;
} }
private void TrendChart_DataClick(object sender, ChartPoint chartPoint) private void TrendChart_DataClick(object sender, ChartPoint chartPoint)
{ {
if (m_bHumidity == true) switch (m_GraphType)
{
case GRAPH_TYPE.HUMIDITY:
m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
else break;
case GRAPH_TYPE.TEMPERATURE:
m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
case GRAPH_TYPE.FORCE:
m_Owner.OnTrendSelectByForce(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
case GRAPH_TYPE.VELOCITY:
m_Owner.OnTrendSelectByVelocity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
}
} }
public void UpdateGraph() private void UpdateGraphHumidity()
{ {
string strSpring = m_DataHandler.GetCurSpring(); string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable(); string strTable = m_DataHandler.GetCurTable();
Console.WriteLine(string.Format("[start] TrendGraph::UpdateGraph ({0}, {1}) -> ({2}, {3})", var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
m_CurSpring, m_CurTable, strSpring, strTable));
if (m_CurSpring == strSpring && m_CurTable == strTable
&& rbHumidity.Checked == m_bHumidity
&& m_bHumidity == rbHumidity.Checked)
{
return;
}
var Chart = m_DataHandler.GetHumidityChart(strSpring, strTable);
if (Chart.Count <= 0) if (Chart.Count <= 0)
{
foreach(Series series in trendChart.Series)
series.Values.Clear();
m_CurSpring = strSpring;
m_CurTable = strTable;
m_bHumidity = rbHumidity.Checked;
return; return;
}
trendChart.AxisX[0].Title = "Humidity";
string strTitle = "";
double dMin = 0;
double dMax = 0;
if (rbHumidity.Checked == true)
{
strTitle = "Humidity";
trendChart.AxisX[0].Title = strTitle;
ChartValues<ScatterPoint>[] Points = { ChartValues<ScatterPoint>[] Points = {
new ChartValues<ScatterPoint>(), new ChartValues<ScatterPoint>(),
@@ -169,8 +163,6 @@ namespace friction
Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN }); Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN });
} }
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values); TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>(); ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
@@ -189,22 +181,24 @@ namespace friction
{ {
new ScatterSeries new ScatterSeries
{ {
Title = "~ 0℃", Title = "Low Temp",
Values = Points[0], Values = Points[0],
Fill = brushes[0], Fill = brushes[0],
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)), LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
}, },
new ScatterSeries new ScatterSeries
{ {
Title = "0℃ ~ 30℃", Title = "Mid Temp",
Values = Points[1], Values = Points[1],
Fill = brushes[1], Fill = brushes[1],
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
}, },
new ScatterSeries new ScatterSeries
{ {
Title = "30℃ ~", Title = "High Temp",
Values = Points[2], Values = Points[2],
Fill = brushes[2], Fill = brushes[2],
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
}, },
new LineSeries new LineSeries
{ {
@@ -216,14 +210,23 @@ namespace friction
}; };
dMin = Chart.Min(r => r.HUMIDITY - 1); trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
dMax = Chart.Max(r => r.HUMIDITY - 1); trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
else if(rbTemp.Checked == true)
{
strTitle = "Temperature";
trendChart.AxisX[0].Title = strTitle; m_CurSpring = strSpring;
m_CurTable = strTable;
}
private void UpdateGraphTemperature()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Temperature";
ChartValues<ScatterPoint>[] Points = { ChartValues<ScatterPoint>[] Points = {
new ChartValues<ScatterPoint>(), new ChartValues<ScatterPoint>(),
@@ -251,15 +254,17 @@ namespace friction
{ {
new ScatterSeries new ScatterSeries
{ {
Title = "~ 60%", Title = "Low Humidity",
Values = Points[0], Values = Points[0],
Foreground = System.Windows.Media.Brushes.SkyBlue, Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
}, },
new ScatterSeries new ScatterSeries
{ {
Title = "60% ~", Title = "High Humidity",
Values = Points[1], Values = Points[1],
Foreground = System.Windows.Media.Brushes.DarkBlue, Foreground = System.Windows.Media.Brushes.DarkBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
}, },
new LineSeries new LineSeries
{ {
@@ -270,29 +275,171 @@ namespace friction
}, },
}; };
dMin = Chart.Min(r => r.TEMPERATURE - 1);
dMax = Chart.Max(r => r.TEMPERATURE - 1); trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
} }
private void UpdateGraphForce()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
trendChart.AxisX[0].MinValue = dMin; var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
trendChart.AxisX[0].MaxValue = dMax; if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Force";
var Points = new ChartValues<ScatterPoint>();
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
Points.Add(new ScatterPoint(pnt.FORCE, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.FORCE, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "RPN by force",
Values = Points,
Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
private void UpdateGraphVelocity()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Velocity";
var Points = new ChartValues<ScatterPoint>();
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
Points.Add(new ScatterPoint(pnt.VELOCITY, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.VELOCITY, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "RPN by velocity",
Values = Points,
Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE)
{
if(Type == GRAPH_TYPE.NONE)
{
if (rbHumidity.Checked == true)
UpdateGraph(GRAPH_TYPE.HUMIDITY);
else if (rbTemp.Checked == true)
UpdateGraph(GRAPH_TYPE.TEMPERATURE);
else if (rbForce.Checked == true)
UpdateGraph(GRAPH_TYPE.FORCE);
else if (rbVelocity.Checked == true)
UpdateGraph(GRAPH_TYPE.VELOCITY);
return;
}
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
switch (Type)
{
case GRAPH_TYPE.HUMIDITY:
UpdateGraphHumidity();
break;
case GRAPH_TYPE.TEMPERATURE:
UpdateGraphTemperature();
break;
case GRAPH_TYPE.FORCE:
UpdateGraphForce();
break;
case GRAPH_TYPE.VELOCITY:
UpdateGraphVelocity();
break;
}
m_CurSpring = strSpring; m_CurSpring = strSpring;
m_CurTable = strTable; m_CurTable = strTable;
m_bHumidity = rbHumidity.Checked; m_GraphType = Type;
Console.WriteLine(string.Format("[end ] TrendGraph::UpdateGraph({0}, {1})", strSpring, strTable));
} }
private void rbHumidity_CheckedChanged(object sender, EventArgs e) private void rbHumidity_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(); UpdateGraph(GRAPH_TYPE.HUMIDITY);
} }
private void rbTemp_CheckedChanged(object sender, EventArgs e) private void rbTemp_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(); UpdateGraph(GRAPH_TYPE.TEMPERATURE);
}
private void rbForce_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph(GRAPH_TYPE.FORCE);
}
private void rbVelocity_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph(GRAPH_TYPE.VELOCITY);
} }
} }
} }

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -15,7 +16,6 @@ namespace friction
public static Color Forecolor = Color.FromArgb(255, 235, 235, 235); public static Color Forecolor = Color.FromArgb(255, 235, 235, 235);
public static Color Green = Color.LimeGreen; public static Color Green = Color.LimeGreen;
//public static Color Yellow = Color.Gold;
public static Color Yellow = Color.FromArgb(255, 255, 165, 0); public static Color Yellow = Color.FromArgb(255, 255, 165, 0);
public static Color Red = Color.OrangeRed; public static Color Red = Color.OrangeRed;
public static Color Gray = Color.DarkGray; public static Color Gray = Color.DarkGray;
@@ -37,6 +37,10 @@ namespace friction
ctrl.ColumnHeadersDefaultCellStyle.ForeColor = Forecolor; ctrl.ColumnHeadersDefaultCellStyle.ForeColor = Forecolor;
ctrl.RowHeadersDefaultCellStyle.BackColor = Backcolor; ctrl.RowHeadersDefaultCellStyle.BackColor = Backcolor;
ctrl.RowHeadersDefaultCellStyle.ForeColor = Forecolor; ctrl.RowHeadersDefaultCellStyle.ForeColor = Forecolor;
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, ctrl, new object[] { true });
} }
public static void Apply(ListView ctrl) public static void Apply(ListView ctrl)
@@ -50,6 +54,10 @@ namespace friction
(sender, e) => ListViewHeaderDraw(sender, e, Backcolor, Forecolor) (sender, e) => ListViewHeaderDraw(sender, e, Backcolor, Forecolor)
); );
ctrl.DrawItem += new DrawListViewItemEventHandler(ListViewBodyDraw); ctrl.DrawItem += new DrawListViewItemEventHandler(ListViewBodyDraw);
typeof(ListView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, ctrl, new object[] { true });
} }
private static void ListViewHeaderDraw(object sender, DrawListViewColumnHeaderEventArgs e, Color backColor, Color foreColor) private static void ListViewHeaderDraw(object sender, DrawListViewColumnHeaderEventArgs e, Color backColor, Color foreColor)