- Radar Graph 추가
- Graph 클릭 이벤트 추가
This commit is contained in:
19
Config.cs
19
Config.cs
@@ -53,7 +53,18 @@ namespace friction
|
||||
WritePrivateProfileString("Option", "recent", OPTION.GetRecentAll(), m_strPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public struct COLUMN_NAME
|
||||
{
|
||||
public static string SPRING = "Material spring";
|
||||
public static string TABLE = "material 2 table";
|
||||
public static string RPN = "Risk priority number";
|
||||
public static string FORCE = "normal force";
|
||||
public static string TEMP = "Temperature";
|
||||
public static string HUMIDITY = "Relative humidity";
|
||||
public static string VELOCITY = "Relative velocity";
|
||||
}
|
||||
|
||||
|
||||
public static class OPTION
|
||||
{
|
||||
@@ -79,9 +90,9 @@ namespace friction
|
||||
{
|
||||
public enum RISK
|
||||
{
|
||||
NO,
|
||||
POTENTIAL,
|
||||
HIGH
|
||||
NO=3,
|
||||
POTENTIAL=5,
|
||||
HIGH=10
|
||||
}
|
||||
|
||||
public enum DEPENDANCY
|
||||
|
||||
@@ -22,7 +22,21 @@ namespace friction
|
||||
public float m_fDiffByVel;
|
||||
}
|
||||
|
||||
public struct CHART
|
||||
public struct RADAR_CHART
|
||||
{
|
||||
public string m_strTable;
|
||||
public float m_fMin;
|
||||
public float m_fMax;
|
||||
public float m_fAvg;
|
||||
public int m_iCnt;
|
||||
|
||||
override public string ToString()
|
||||
{
|
||||
return string.Format("{0}: {1}-{2}-{3}", m_strTable, m_fMin, m_fAvg, m_fMax);
|
||||
}
|
||||
}
|
||||
|
||||
public struct TREND_CHART
|
||||
{
|
||||
public float HUMIDITY;
|
||||
public float TEMPERATURE;
|
||||
@@ -49,26 +63,17 @@ namespace friction
|
||||
List<string> m_SpringList = new List<string>();
|
||||
List<string> m_TableList = new List<string>();
|
||||
|
||||
Dictionary<string, string> m_ColumnMap = new Dictionary<string, string>();
|
||||
|
||||
public DataHandler()
|
||||
{
|
||||
m_ColumnMap["spring"] = "Material spring";
|
||||
m_ColumnMap["table"] = "material 2 table";
|
||||
m_ColumnMap["rpn"] = "Risk priority number";
|
||||
m_ColumnMap["force"] = "normal force";
|
||||
m_ColumnMap["temp"] = "Temperature";
|
||||
m_ColumnMap["humidity"] = "Relative humidity";
|
||||
m_ColumnMap["velocity"] = "Relative velocity";
|
||||
}
|
||||
|
||||
bool IsNumberColumn(string strColumn)
|
||||
{
|
||||
return (strColumn == m_ColumnMap["rpn"] ||
|
||||
strColumn == m_ColumnMap["force"] ||
|
||||
strColumn == m_ColumnMap["temp"] ||
|
||||
strColumn == m_ColumnMap["humidity"] ||
|
||||
strColumn == m_ColumnMap["velocity"]);
|
||||
return (strColumn == Config.COLUMN_NAME.RPN ||
|
||||
strColumn == Config.COLUMN_NAME.FORCE ||
|
||||
strColumn == Config.COLUMN_NAME.TEMP ||
|
||||
strColumn == Config.COLUMN_NAME.HUMIDITY ||
|
||||
strColumn == Config.COLUMN_NAME.VELOCITY);
|
||||
}
|
||||
|
||||
public void LoadData(string strFilePath)
|
||||
@@ -133,10 +138,10 @@ namespace friction
|
||||
|
||||
|
||||
m_SpringList = (from r in m_Data.AsEnumerable()
|
||||
select r[m_ColumnMap["spring"]]).Distinct().Cast<string>().ToList();
|
||||
select r[Config.COLUMN_NAME.SPRING]).Distinct().Cast<string>().ToList();
|
||||
|
||||
m_TableList = (from r in m_Data.AsEnumerable()
|
||||
select r[m_ColumnMap["table"]]).Distinct().Cast<string>().ToList();
|
||||
select r[Config.COLUMN_NAME.TABLE]).Distinct().Cast<string>().ToList();
|
||||
|
||||
m_ColumnsNames = (from c in m_Data.Columns.Cast<DataColumn>()
|
||||
select c.ColumnName).ToList<string>();
|
||||
@@ -178,19 +183,43 @@ namespace friction
|
||||
return m_strCurTable;
|
||||
}
|
||||
|
||||
public List<CHART> GetHumidityChart(string strSpring, string strTable)
|
||||
public List<RADAR_CHART> GetAvgAll(string strSpring)
|
||||
{
|
||||
string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", m_ColumnMap["spring"], strSpring, m_ColumnMap["table"], strTable);
|
||||
string strQuery = string.Format("[{0}]='{1}'", Config.COLUMN_NAME.SPRING, strSpring);
|
||||
DataRow[] rows = m_Data.Select(strQuery);
|
||||
|
||||
List<CHART> result = new List<CHART>();
|
||||
var group = rows
|
||||
.GroupBy(r => r[Config.COLUMN_NAME.TABLE]);
|
||||
|
||||
|
||||
List<RADAR_CHART> result = rows
|
||||
.GroupBy(r => r[Config.COLUMN_NAME.TABLE])
|
||||
.Select(t => new RADAR_CHART
|
||||
{
|
||||
m_strTable = t.Key.ToString(),
|
||||
m_iCnt = t.Count(),
|
||||
m_fMin = t.Min(k => (float)k[Config.COLUMN_NAME.RPN]),
|
||||
m_fMax = t.Max(k => (float)k[Config.COLUMN_NAME.RPN]),
|
||||
m_fAvg = t.Average(k => (float)k[Config.COLUMN_NAME.RPN])
|
||||
})
|
||||
.ToList<RADAR_CHART>();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<TREND_CHART> GetHumidityChart(string strSpring, string 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);
|
||||
|
||||
List<TREND_CHART> result = new List<TREND_CHART>();
|
||||
foreach(DataRow r in rows)
|
||||
{
|
||||
result.Add(new CHART
|
||||
result.Add(new TREND_CHART
|
||||
{
|
||||
HUMIDITY = (float)r[m_ColumnMap["humidity"]],
|
||||
TEMPERATURE = (float)r[m_ColumnMap["temp"]],
|
||||
RPN = (float)r[m_ColumnMap["rpn"]],
|
||||
HUMIDITY = (float)r[Config.COLUMN_NAME.HUMIDITY],
|
||||
TEMPERATURE = (float)r[Config.COLUMN_NAME.TEMP],
|
||||
RPN = (float)r[Config.COLUMN_NAME.RPN],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -203,8 +232,8 @@ namespace friction
|
||||
{
|
||||
// 각 그룹의 평균들의 표준편차
|
||||
var AvgOfGroup = rows
|
||||
.GroupBy(r => r[m_ColumnMap["force"]])
|
||||
.Select(t => t.Average(k => (float)k[m_ColumnMap["rpn"]]));
|
||||
.GroupBy(r => r[Config.COLUMN_NAME.FORCE])
|
||||
.Select(t => t.Average(k => (float)k[Config.COLUMN_NAME.RPN]));
|
||||
var Avg = AvgOfGroup.Average();
|
||||
var Squares = AvgOfGroup.Select(r => (r - Avg) * (r - Avg));
|
||||
var result = (float)Math.Sqrt(Squares.Average());
|
||||
@@ -215,14 +244,14 @@ namespace friction
|
||||
{
|
||||
CalcResult result = new CalcResult();
|
||||
|
||||
string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", m_ColumnMap["spring"], strSpring, m_ColumnMap["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);
|
||||
|
||||
if(rows.Length > 0)
|
||||
{
|
||||
result.m_iCnt = rows.Length;
|
||||
result.m_fAvgRPN = rows.Average(r => (float)r[m_ColumnMap["rpn"]]);
|
||||
result.m_fStdRPN = rows.Average(r => (float)Math.Pow((float)r[m_ColumnMap["rpn"]] - result.m_fAvgRPN, 2));
|
||||
result.m_fAvgRPN = rows.Average(r => (float)r[Config.COLUMN_NAME.RPN]);
|
||||
result.m_fStdRPN = rows.Average(r => (float)Math.Pow((float)r[Config.COLUMN_NAME.RPN] - result.m_fAvgRPN, 2));
|
||||
result.m_fStdRPN = (float)Math.Sqrt(result.m_fStdRPN);
|
||||
|
||||
result.m_fDiffByForce = CalcDependency(rows, "force");
|
||||
|
||||
25
MainForm.cs
25
MainForm.cs
@@ -30,7 +30,7 @@ namespace friction
|
||||
m_MaterialPanel = new PanelMaterial(this);
|
||||
m_ResultPanel = new PanelResult(this);
|
||||
m_AnalysisPanel = new PanelAnalysis(this);
|
||||
m_RadarGraphPanel = new PanelRadarGraph(this);
|
||||
m_RadarGraphPanel = new PanelRadarGraph(this, m_DataHandler);
|
||||
m_TrendGraphPanel = new PanelTrendGraph(this, m_DataHandler);
|
||||
|
||||
Theme.Apply(this);
|
||||
@@ -138,6 +138,7 @@ namespace friction
|
||||
private void radarGraphToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenPanel(m_RadarGraphPanel);
|
||||
m_RadarGraphPanel.UpdateGraph();
|
||||
}
|
||||
|
||||
private void trendGraphToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -171,6 +172,7 @@ namespace friction
|
||||
private void toolStripButtonRadarGraph_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenPanel(m_RadarGraphPanel);
|
||||
m_RadarGraphPanel.UpdateGraph();
|
||||
}
|
||||
|
||||
private void toolStripButtonTrendGraph_Click(object sender, EventArgs e)
|
||||
@@ -187,6 +189,9 @@ namespace friction
|
||||
{
|
||||
trendGraphToolStripMenuItem.Enabled = toolStripButtonTrendGraph.Enabled = false;
|
||||
radarGraphToolStripMenuItem.Enabled = toolStripButtonRadarGraph.Enabled = true;
|
||||
|
||||
if (m_RadarGraphPanel.Visible == true)
|
||||
m_RadarGraphPanel.UpdateGraph();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -201,6 +206,24 @@ namespace friction
|
||||
m_AnalysisPanel.UpdateData(m_DataHandler);
|
||||
}
|
||||
|
||||
public void OnRadarSelectTable(string strTable)
|
||||
{
|
||||
if (m_AnalysisPanel != null)
|
||||
m_AnalysisPanel.SelectRow(strTable);
|
||||
}
|
||||
|
||||
public void OnTrendSelectByHumidity(string strSpring, string strTable, float fHumidity, float fRPN)
|
||||
{
|
||||
if (m_ResultPanel != null)
|
||||
m_ResultPanel.SelectRowByHumidity(strSpring, strTable, fHumidity, fRPN);
|
||||
}
|
||||
|
||||
public void OnTrendSelectByTemperature(string strSpring, string strTable, float fTemperature, float fRPN)
|
||||
{
|
||||
if (m_ResultPanel != null)
|
||||
m_ResultPanel.SelectRowByTemperature(strSpring, strTable, fTemperature, fRPN);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,5 +132,18 @@ namespace friction
|
||||
|
||||
m_CurSpring = strSpring;
|
||||
}
|
||||
|
||||
public void SelectRow(string strTable)
|
||||
{
|
||||
dgvAnalysis.ClearSelection();
|
||||
foreach (DataGridViewRow row in dgvAnalysis.Rows)
|
||||
{
|
||||
if ((string)row.Cells["chTable"].Value == strTable)
|
||||
{
|
||||
row.Selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
82
PanelRadarGraph.Designer.cs
generated
82
PanelRadarGraph.Designer.cs
generated
@@ -28,23 +28,103 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// chart
|
||||
//
|
||||
this.chart.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)));
|
||||
chartArea1.Area3DStyle.Enable3D = true;
|
||||
chartArea1.AxisX.MajorGrid.Enabled = false;
|
||||
chartArea1.AxisX.MajorTickMark.LineWidth = 0;
|
||||
chartArea1.AxisX2.MajorGrid.Enabled = false;
|
||||
chartArea1.BackImageTransparentColor = System.Drawing.Color.Black;
|
||||
chartArea1.Name = "ChartArea1";
|
||||
this.chart.ChartAreas.Add(chartArea1);
|
||||
legend1.Name = "Legend1";
|
||||
this.chart.Legends.Add(legend1);
|
||||
this.chart.Location = new System.Drawing.Point(12, 12);
|
||||
this.chart.Name = "chart";
|
||||
series1.ChartArea = "ChartArea1";
|
||||
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series1.IsVisibleInLegend = false;
|
||||
series1.Legend = "Legend1";
|
||||
series1.LegendText = "High Risk";
|
||||
series1.MarkerSize = 0;
|
||||
series1.Name = "SeriesHigh";
|
||||
series2.ChartArea = "ChartArea1";
|
||||
series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series2.IsVisibleInLegend = false;
|
||||
series2.Legend = "Legend1";
|
||||
series2.LegendText = "Potential Risk";
|
||||
series2.MarkerSize = 0;
|
||||
series2.Name = "SeriesPotential";
|
||||
series3.ChartArea = "ChartArea1";
|
||||
series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series3.IsVisibleInLegend = false;
|
||||
series3.Legend = "Legend1";
|
||||
series3.LegendText = "No Risk";
|
||||
series3.MarkerSize = 0;
|
||||
series3.Name = "SeriesNo";
|
||||
series4.ChartArea = "ChartArea1";
|
||||
series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series4.Legend = "Legend1";
|
||||
series4.LegendText = "Max";
|
||||
series4.MarkerSize = 0;
|
||||
series4.Name = "SeriesMax";
|
||||
series5.ChartArea = "ChartArea1";
|
||||
series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series5.Legend = "Legend1";
|
||||
series5.LegendText = "Average";
|
||||
series5.MarkerSize = 0;
|
||||
series5.Name = "SeriesAvg";
|
||||
series6.ChartArea = "ChartArea1";
|
||||
series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
|
||||
series6.Legend = "Legend1";
|
||||
series6.LegendText = "Min";
|
||||
series6.MarkerSize = 0;
|
||||
series6.Name = "SeriesMin";
|
||||
this.chart.Series.Add(series1);
|
||||
this.chart.Series.Add(series2);
|
||||
this.chart.Series.Add(series3);
|
||||
this.chart.Series.Add(series4);
|
||||
this.chart.Series.Add(series5);
|
||||
this.chart.Series.Add(series6);
|
||||
this.chart.Size = new System.Drawing.Size(791, 635);
|
||||
this.chart.TabIndex = 0;
|
||||
this.chart.Text = "chart";
|
||||
this.chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseClick);
|
||||
//
|
||||
// PanelRadarGraph
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.ClientSize = new System.Drawing.Size(815, 659);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.chart);
|
||||
this.HideOnClose = true;
|
||||
this.Name = "PanelRadarGraph";
|
||||
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
|
||||
this.TabText = "Radar Graph";
|
||||
this.Text = "Radar Graph";
|
||||
((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataVisualization.Charting.Chart chart;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -7,6 +8,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
namespace friction
|
||||
@@ -14,12 +16,85 @@ namespace friction
|
||||
public partial class PanelRadarGraph : DockContent
|
||||
{
|
||||
MainForm m_Owner = null;
|
||||
DataHandler m_DataHandler = null;
|
||||
|
||||
public PanelRadarGraph(MainForm owner)
|
||||
string m_CurSpring = "";
|
||||
|
||||
public PanelRadarGraph(MainForm owner, DataHandler data)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
m_Owner = owner;
|
||||
m_DataHandler = data;
|
||||
|
||||
chart.ChartAreas[0].AxisY.Maximum = 10;
|
||||
|
||||
chart.Series["SeriesHigh"].Color = Color.FromArgb(255, 200, 200, 200);
|
||||
chart.Series["SeriesPotential"].Color = Color.FromArgb(255, 180, 180, 180);
|
||||
chart.Series["SeriesNo"].Color = Color.FromArgb(255, 140, 140, 140);
|
||||
|
||||
chart.Series["SeriesMax"].Color = Theme.Red;
|
||||
chart.Series["SeriesAvg"].Color = Theme.Yellow;
|
||||
chart.Series["SeriesMin"].Color = Theme.Green;
|
||||
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
|
||||
chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
|
||||
chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
|
||||
chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true;
|
||||
chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1;
|
||||
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(100, 0, 0, 0);
|
||||
chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
|
||||
|
||||
foreach (var series in chart.Series)
|
||||
series["AreaDrawingStyle"] = "Polygon";
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_CurSpring = "";
|
||||
}
|
||||
|
||||
public void UpdateGraph()
|
||||
{
|
||||
string strSpring = m_DataHandler.GetCurSpring();
|
||||
if (m_CurSpring == strSpring)
|
||||
return;
|
||||
|
||||
foreach (var series in chart.Series)
|
||||
series.Points.Clear();
|
||||
|
||||
List<DataHandler.RADAR_CHART> graphData = m_DataHandler.GetAvgAll(strSpring);
|
||||
|
||||
List<string> xValues = new List<string>();
|
||||
List<float> yValues = new List<float>();
|
||||
|
||||
foreach(var data in graphData)
|
||||
{
|
||||
chart.Series["SeriesMax"].Points.AddXY(data.m_strTable, data.m_fMax);
|
||||
chart.Series["SeriesAvg"].Points.AddXY(data.m_strTable, data.m_fAvg);
|
||||
chart.Series["SeriesMin"].Points.AddXY(data.m_strTable, data.m_fMin);
|
||||
|
||||
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["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO);
|
||||
|
||||
//break;
|
||||
}
|
||||
|
||||
|
||||
m_CurSpring = strSpring;
|
||||
}
|
||||
|
||||
private void chart_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
HitTestResult result = chart.HitTest(e.X, e.Y);
|
||||
if(result.ChartElementType == ChartElementType.AxisLabels &&
|
||||
result.Object != null)
|
||||
{
|
||||
string strTable = (string)result.Object;
|
||||
m_Owner.OnRadarSelectTable(strTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace friction
|
||||
private void DgvData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
DataGridViewRow row = dgvData.Rows[e.RowIndex];
|
||||
if(e.ColumnIndex == row.Cells["Risk priority number"].ColumnIndex)
|
||||
if(e.ColumnIndex == row.Cells[Config.COLUMN_NAME.RPN].ColumnIndex)
|
||||
{
|
||||
if ((float)e.Value <= 3)
|
||||
e.CellStyle.BackColor = Theme.Green;
|
||||
@@ -89,5 +89,48 @@ namespace friction
|
||||
|
||||
dgvData.Columns[strColName].Visible = bShow;
|
||||
}
|
||||
|
||||
public void SelectRowByHumidity(string strSpring, string strTable, float fHumidity, 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.HUMIDITY].Value.Equals(fHumidity)
|
||||
)
|
||||
.First();
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
row.Selected = true;
|
||||
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectRowByTemperature(string strSpring, string strTable, float fTemperature, 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.TEMP].Value.Equals(fTemperature)
|
||||
)
|
||||
.First();
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
row.Selected = true;
|
||||
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ namespace friction
|
||||
|
||||
private void TrendChart_DataClick(object sender, ChartPoint chartPoint)
|
||||
{
|
||||
if (m_bHumidity == true)
|
||||
m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
|
||||
else
|
||||
m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
|
||||
}
|
||||
|
||||
public void UpdateGraph()
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms.DataVisualization" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -166,6 +167,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="main_icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Reference in New Issue
Block a user