Skip to content

Commit

Permalink
Initial Graph Code and Bug fixes
Browse files Browse the repository at this point in the history
Fixed a couple of display bugs on the main form, started work on the
graph form displays basic info and working graph with position.
  • Loading branch information
DanielMcAssey committed Nov 30, 2014
1 parent 21e43f1 commit 95ba068
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 26 deletions.
1 change: 1 addition & 0 deletions src/MouseGraphView/MouseGraphView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand Down
108 changes: 108 additions & 0 deletions src/MouseGraphView/frmGraph.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 53 additions & 1 deletion src/MouseGraphView/frmGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,65 @@
using System.Text;
using System.Windows.Forms;

using MouseMon;

namespace MouseGraphView
{
public partial class frmGraph : Form
{
public frmGraph()
private List<MouseData> PlotData;

public frmGraph(List<MouseData> _plotData)
{
InitializeComponent();
PlotData = _plotData;
}

private void frmGraph_Load(object sender, EventArgs e)
{
btnShowBoth.Enabled = false;

DateTime lastTimeRecorded = PlotData[PlotData.Count-1].MouseRecordedTime;
List<MouseData> Last5Seconds = PlotData.Where(s => s.MouseRecordedTime >= lastTimeRecorded.AddSeconds(-5)).ToList<MouseData>();
List<MouseData> EverythingElse = PlotData.Where(s => s.MouseRecordedTime < lastTimeRecorded.AddSeconds(-5)).ToList<MouseData>();

for (int i = 0; i < EverythingElse.Count; i++)
{
chrtMousePos.Series[0].Points.AddXY(EverythingElse[i].MouseX, EverythingElse[i].MouseY);
}

for (int i = 0; i < Last5Seconds.Count; i++)
{
chrtMousePos.Series[1].Points.AddXY(Last5Seconds[i].MouseX, Last5Seconds[i].MouseY);
}

}

private void btnShowBoth_Click(object sender, EventArgs e)
{
btnShowBoth.Enabled = false;
btnShowAllButRecent.Enabled = true;
btnShowRecent.Enabled = true;
chrtMousePos.Series[0].Enabled = true;
chrtMousePos.Series[1].Enabled = true;
}

private void btnShowRecent_Click(object sender, EventArgs e)
{
btnShowBoth.Enabled = true;
btnShowRecent.Enabled = false;
btnShowAllButRecent.Enabled = true;
chrtMousePos.Series[0].Enabled = false;
chrtMousePos.Series[1].Enabled = true;
}

private void btnShowAllButRecent_Click(object sender, EventArgs e)
{
btnShowBoth.Enabled = true;
btnShowRecent.Enabled = true;
btnShowAllButRecent.Enabled = false;
chrtMousePos.Series[0].Enabled = true;
chrtMousePos.Series[1].Enabled = false;
}
}
}
51 changes: 27 additions & 24 deletions src/MouseGraphView/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/MouseGraphView/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void btnStop_Click(object sender, EventArgs e)

private void btnGenerateGraph_Click(object sender, EventArgs e)
{
frmGraph graphWindow = new frmGraph();
frmGraph graphWindow = new frmGraph(this.MouseMonitor.GetFullDataset());
graphWindow.Show();
}
}
Expand Down

0 comments on commit 95ba068

Please sign in to comment.