리포트 수정

그래프 범위 수정
그래프 활성화될 때 table 선택
This commit is contained in:
2017-08-13 06:14:04 +09:00
parent d48d0167ac
commit 4bee47633b
6 changed files with 85 additions and 30 deletions

View File

@@ -535,5 +535,21 @@ namespace friction
Theme.Apply(menuStrip); Theme.Apply(menuStrip);
} }
#endregion #endregion
public void OnRadarGraphActivated()
{
if (m_DataHandler.GetCurTable() != "All")
OnApplyData(this, m_DataHandler.GetCurSpring(), "All");
}
public void OnTrendGraphActivated()
{
if (m_DataHandler.GetCurTable() == "All")
{
List<string> tableList = m_DataHandler.GetTableList();
if(tableList.Count > 0)
OnApplyData(this, m_DataHandler.GetCurSpring(), tableList[1]);
}
}
} }
} }

View File

@@ -262,6 +262,7 @@
this.TabText = "Radar Graph"; this.TabText = "Radar Graph";
this.Text = "Radar Graph"; this.Text = "Radar Graph";
this.VisibleChanged += new System.EventHandler(this.PanelRadarGraph_VisibleChanged); this.VisibleChanged += new System.EventHandler(this.PanelRadarGraph_VisibleChanged);
this.Enter += new System.EventHandler(this.PanelRadarGraph_Enter);
((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();

View File

@@ -214,5 +214,10 @@ namespace friction
m_CurSpring = ""; m_CurSpring = "";
UpdateGraph(); UpdateGraph();
} }
private void PanelRadarGraph_Enter(object sender, EventArgs e)
{
m_Owner.OnRadarGraphActivated();
}
} }
} }

View File

@@ -180,6 +180,7 @@
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document; this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
this.TabText = "Trend Graph"; this.TabText = "Trend Graph";
this.Text = "Trend Graph"; this.Text = "Trend Graph";
this.Enter += new System.EventHandler(this.PanelTrendGraph_Enter);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.panelGraph.ResumeLayout(false); this.panelGraph.ResumeLayout(false);

View File

@@ -152,9 +152,8 @@ namespace friction
string strTable = m_DataHandler.GetCurTable(); string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.Series.Clear();
trendChart.AxisX[0].Title = "Humidity"; trendChart.AxisX[0].Title = "Humidity";
ChartValues<ScatterPoint>[] Points = { ChartValues<ScatterPoint>[] Points = {
@@ -176,6 +175,9 @@ namespace friction
Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN }); Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN });
} }
if (Chart.Count <= 0)
return;
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>();
@@ -224,8 +226,12 @@ namespace friction
}; };
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); float fMin = Chart.Min(r => r.HUMIDITY);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); float fMax = Chart.Max(r => r.HUMIDITY);
float fMargin = (fMax - fMin) * 0.05f;
trendChart.AxisX[0].MinValue = (fMin-fMargin);
trendChart.AxisX[0].MaxValue = (fMax+fMargin);
m_CurSpring = strSpring; m_CurSpring = strSpring;
m_CurTable = strTable; m_CurTable = strTable;
@@ -237,9 +243,7 @@ namespace friction
string strTable = m_DataHandler.GetCurTable(); string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0) trendChart.Series.Clear();
return;
trendChart.AxisX[0].Title = "Temperature"; trendChart.AxisX[0].Title = "Temperature";
ChartValues<ScatterPoint>[] Points = { ChartValues<ScatterPoint>[] Points = {
@@ -257,6 +261,9 @@ namespace friction
Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN }); Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN });
} }
if (Chart.Count <= 0)
return;
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>();
@@ -290,8 +297,12 @@ namespace friction
}; };
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); float fMin = Chart.Min(r => r.TEMPERATURE);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); float fMax = Chart.Max(r => r.TEMPERATURE);
float fMargin = (fMax - fMin) * 0.05f;
trendChart.AxisX[0].MinValue = (fMin - fMargin);
trendChart.AxisX[0].MaxValue = (fMax + fMargin);
} }
private void UpdateGraphForce() private void UpdateGraphForce()
@@ -300,9 +311,7 @@ namespace friction
string strTable = m_DataHandler.GetCurTable(); string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0) trendChart.Series.Clear();
return;
trendChart.AxisX[0].Title = "Force"; trendChart.AxisX[0].Title = "Force";
var Points = new ChartValues<ScatterPoint>(); var Points = new ChartValues<ScatterPoint>();
@@ -314,6 +323,9 @@ namespace friction
Values.Add(new TrendLine.POINT { X = pnt.FORCE, Y = pnt.RPN }); Values.Add(new TrendLine.POINT { X = pnt.FORCE, Y = pnt.RPN });
} }
if (Chart.Count <= 0)
return;
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>();
@@ -340,8 +352,12 @@ namespace friction
}; };
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); float fMin = Chart.Min(r => r.FORCE);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); float fMax = Chart.Max(r => r.FORCE);
float fMargin = (fMax - fMin) * 0.05f;
trendChart.AxisX[0].MinValue = (fMin - fMargin);
trendChart.AxisX[0].MaxValue = (fMax + fMargin);
} }
private void UpdateGraphVelocity() private void UpdateGraphVelocity()
@@ -350,9 +366,7 @@ namespace friction
string strTable = m_DataHandler.GetCurTable(); string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0) trendChart.Series.Clear();
return;
trendChart.AxisX[0].Title = "Velocity"; trendChart.AxisX[0].Title = "Velocity";
var Points = new ChartValues<ScatterPoint>(); var Points = new ChartValues<ScatterPoint>();
@@ -364,6 +378,9 @@ namespace friction
Values.Add(new TrendLine.POINT { X = pnt.VELOCITY, Y = pnt.RPN }); Values.Add(new TrendLine.POINT { X = pnt.VELOCITY, Y = pnt.RPN });
} }
if (Chart.Count <= 0)
return;
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>();
@@ -390,8 +407,12 @@ namespace friction
}; };
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); float fMin = Chart.Min(r => r.VELOCITY);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); float fMax = Chart.Max(r => r.VELOCITY);
float fMargin = (fMax - fMin) * 0.05f;
trendChart.AxisX[0].MinValue = (fMin - fMargin);
trendChart.AxisX[0].MaxValue = (fMax + fMargin);
} }
public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE) public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE)
@@ -445,22 +466,26 @@ namespace friction
private void rbHumidity_CheckedChanged(object sender, EventArgs e) private void rbHumidity_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(GRAPH_TYPE.HUMIDITY); if(sender == rbHumidity && rbHumidity.Checked == true)
UpdateGraph(GRAPH_TYPE.HUMIDITY);
} }
private void rbTemp_CheckedChanged(object sender, EventArgs e) private void rbTemp_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(GRAPH_TYPE.TEMPERATURE); if (sender == rbTemp && rbTemp.Checked == true)
UpdateGraph(GRAPH_TYPE.TEMPERATURE);
} }
private void rbForce_CheckedChanged(object sender, EventArgs e) private void rbForce_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(GRAPH_TYPE.FORCE); if (sender == rbForce && rbForce.Checked == true)
UpdateGraph(GRAPH_TYPE.FORCE);
} }
private void rbVelocity_CheckedChanged(object sender, EventArgs e) private void rbVelocity_CheckedChanged(object sender, EventArgs e)
{ {
UpdateGraph(GRAPH_TYPE.VELOCITY); if (sender == rbVelocity && rbVelocity.Checked == true)
UpdateGraph(GRAPH_TYPE.VELOCITY);
} }
public void CopyChart(GRAPH_TYPE Type) public void CopyChart(GRAPH_TYPE Type)
@@ -499,5 +524,9 @@ namespace friction
})); }));
} }
private void PanelTrendGraph_Enter(object sender, EventArgs e)
{
m_Owner.OnTrendGraphActivated();
}
} }
} }

View File

@@ -221,9 +221,12 @@ namespace friction
if (TrendChartByHumidity != null) if (TrendChartByHumidity != null)
{ {
iRow += 27;
Sheet.Cells[71, 2].Value = MaterialSpring + " vs " + MaterialTable; Sheet.Cells[iRow, 2].Value = MaterialSpring + " vs " + MaterialTable;
Sheet.Cells[71, 2].Style.Font.Bold = true; Sheet.Cells[iRow, 2].Style.Font.Bold = true;
iRow += 13;
dY += 20; dY += 20;
var picTrendChartHumidity = Sheet.Drawings.AddPicture("Trend Chart by Humidity", TrendChartByHumidity); var picTrendChartHumidity = Sheet.Drawings.AddPicture("Trend Chart by Humidity", TrendChartByHumidity);
@@ -233,7 +236,7 @@ namespace friction
iHeight = iHeight * 390 / iWidth; iHeight = iHeight * 390 / iWidth;
iWidth = 390; iWidth = 390;
picTrendChartHumidity.SetSize(iWidth, iHeight); picTrendChartHumidity.SetSize(iWidth, iHeight);
Sheet.Cells[84, 2].Value = "by Humidity"; Sheet.Cells[iRow, 2].Value = "by Humidity";
dX += 400; dX += 400;
@@ -244,9 +247,9 @@ namespace friction
iHeight = iHeight * 390 / iWidth; iHeight = iHeight * 390 / iWidth;
iWidth = 390; iWidth = 390;
picTrendChartTemperature.SetSize(iWidth, iHeight); picTrendChartTemperature.SetSize(iWidth, iHeight);
Sheet.Cells[84, 8].Value = "by Temperature"; Sheet.Cells[iRow, 8].Value = "by Temperature";
iRow += 14;
dX -= 400; dX -= 400;
dY += iHeight + 10; dY += iHeight + 10;
var picTrendChartForce = Sheet.Drawings.AddPicture("Trend Chart by Force", TrendChartByForce); var picTrendChartForce = Sheet.Drawings.AddPicture("Trend Chart by Force", TrendChartByForce);
@@ -256,7 +259,7 @@ namespace friction
iHeight = iHeight * 390 / iWidth; iHeight = iHeight * 390 / iWidth;
iWidth = 390; iWidth = 390;
picTrendChartForce.SetSize(iWidth, iHeight); picTrendChartForce.SetSize(iWidth, iHeight);
Sheet.Cells[97, 2].Value = "by Force"; Sheet.Cells[iRow, 2].Value = "by Force";
dX += 400; dX += 400;
@@ -267,7 +270,7 @@ namespace friction
iHeight = iHeight * 390 / iWidth; iHeight = iHeight * 390 / iWidth;
iWidth = 390; iWidth = 390;
picTrendChartVelocity.SetSize(iWidth, iHeight); picTrendChartVelocity.SetSize(iWidth, iHeight);
Sheet.Cells[97, 8].Value = "by Velocity"; Sheet.Cells[iRow, 8].Value = "by Velocity";
} }
package.SaveAs(new FileInfo(FilePath)); package.SaveAs(new FileInfo(FilePath));