- 리포트에서 Trend 그래프 정리

This commit is contained in:
2017-06-24 17:32:17 +09:00
parent 8c46481430
commit fae1f8b7c9
8 changed files with 290 additions and 57 deletions

View File

@@ -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);
}));
}
}
}