리포트 수정

그래프 범위 수정
그래프 활성화될 때 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

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