summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-08-02 15:54:47 -0700
committerJacob Palecki <[email protected]>2020-08-02 15:54:47 -0700
commit529f18bd6ddbcd182fd03a13e3c07dc10162f036 (patch)
treed71ba432d3f6a2c79ec41901f05e95eeed23aeb6
parentMove logic out of forms class into accelgui class (diff)
downloadrawaccel-529f18bd6ddbcd182fd03a13e3c07dc10162f036.tar.xz
rawaccel-529f18bd6ddbcd182fd03a13e3c07dc10162f036.zip
Add velocity graph
-rw-r--r--grapher/AccelGUI.cs31
-rw-r--r--grapher/Form1.Designer.cs49
-rw-r--r--grapher/Form1.cs21
3 files changed, 82 insertions, 19 deletions
diff --git a/grapher/AccelGUI.cs b/grapher/AccelGUI.cs
index d372869..9acb38e 100644
--- a/grapher/AccelGUI.cs
+++ b/grapher/AccelGUI.cs
@@ -25,6 +25,7 @@ namespace grapher
public AccelGUI(
RawAcceleration accelForm,
Chart accelerationChart,
+ Chart velocityChart,
ManagedAccel managedAccel,
AccelOptions accelOptions,
OptionXY sensitivity,
@@ -38,6 +39,7 @@ namespace grapher
{
AccelForm = accelForm;
AccelChart = accelerationChart;
+ VelocityChart = velocityChart;
ManagedAcceleration = managedAccel;
AccelerationOptions = accelOptions;
Sensitivity = sensitivity;
@@ -60,6 +62,8 @@ namespace grapher
public Chart AccelChart { get; }
+ public Chart VelocityChart { get; }
+
public ManagedAccel ManagedAcceleration { get; }
public AccelOptions AccelerationOptions { get; }
@@ -118,7 +122,8 @@ namespace grapher
public void UpdateGraph()
{
- var orderedPoints = new SortedDictionary<double, double>();
+ var orderedAccelPoints = new SortedDictionary<double, double>();
+ var orderedVelocityPoints = new SortedDictionary<double, double>();
foreach (var magnitudeData in Magnitudes)
{
@@ -127,20 +132,32 @@ namespace grapher
var outMagnitude = Magnitude(output.Item1, output.Item2);
var ratio = magnitudeData.magnitude > 0 ? outMagnitude / magnitudeData.magnitude : Sensitivity.Fields.X;
- if (!orderedPoints.ContainsKey(magnitudeData.magnitude))
+ if (!orderedAccelPoints.ContainsKey(magnitudeData.magnitude))
+ {
+ orderedAccelPoints.Add(magnitudeData.magnitude, ratio);
+ }
+
+ if (!orderedVelocityPoints.ContainsKey(magnitudeData.magnitude))
{
- orderedPoints.Add(magnitudeData.magnitude, ratio);
+ orderedVelocityPoints.Add(magnitudeData.magnitude, outMagnitude);
}
}
- var series = AccelChart.Series.FirstOrDefault();
- series.Points.Clear();
+ var accelSeries = AccelChart.Series.FirstOrDefault();
+ accelSeries.Points.Clear();
- foreach (var point in orderedPoints)
+ foreach (var point in orderedAccelPoints)
{
- series.Points.AddXY(point.Key, point.Value);
+ accelSeries.Points.AddXY(point.Key, point.Value);
}
+ var velSeries = VelocityChart.Series.FirstOrDefault();
+ velSeries.Points.Clear();
+
+ foreach (var point in orderedVelocityPoints)
+ {
+ velSeries.Points.AddXY(point.Key, point.Value);
+ }
}
diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs
index 667abf1..11b84f9 100644
--- a/grapher/Form1.Designer.cs
+++ b/grapher/Form1.Designer.cs
@@ -30,6 +30,9 @@ namespace grapher
/// </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.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
@@ -59,24 +62,26 @@ namespace grapher
this.capXYLock = new System.Windows.Forms.CheckBox();
this.weightXYLock = new System.Windows.Forms.CheckBox();
this.LockXYLabel = new System.Windows.Forms.Label();
+ this.VelocityChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.VelocityChart)).BeginInit();
this.SuspendLayout();
//
// AccelerationChart
//
- chartArea2.AxisX.Title = "Speed (counts/ms)";
- chartArea2.AxisY.Title = "Sensitivity (magnitude ratio)";
- chartArea2.Name = "ChartArea1";
- this.AccelerationChart.ChartAreas.Add(chartArea2);
- legend2.Name = "Legend1";
- this.AccelerationChart.Legends.Add(legend2);
+ chartArea1.AxisX.Title = "Speed (counts/ms)";
+ chartArea1.AxisY.Title = "Sensitivity (magnitude ratio)";
+ chartArea1.Name = "ChartArea1";
+ this.AccelerationChart.ChartAreas.Add(chartArea1);
+ legend1.Name = "Legend1";
+ this.AccelerationChart.Legends.Add(legend1);
this.AccelerationChart.Location = new System.Drawing.Point(242, 1);
this.AccelerationChart.Name = "AccelerationChart";
- series2.ChartArea = "ChartArea1";
- series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series2.Legend = "Legend1";
- series2.Name = "Accelerated Sensitivity";
- this.AccelerationChart.Series.Add(series2);
+ series1.ChartArea = "ChartArea1";
+ series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series1.Legend = "Legend1";
+ series1.Name = "Accelerated Sensitivity";
+ this.AccelerationChart.Series.Add(series1);
this.AccelerationChart.Size = new System.Drawing.Size(721, 312);
this.AccelerationChart.TabIndex = 0;
this.AccelerationChart.Text = "chart1";
@@ -297,11 +302,29 @@ namespace grapher
this.LockXYLabel.TabIndex = 27;
this.LockXYLabel.Text = "Lock X && Y";
//
+ // VelocityChart
+ //
+ chartArea2.Name = "ChartArea1";
+ this.VelocityChart.ChartAreas.Add(chartArea2);
+ legend2.Name = "Legend1";
+ this.VelocityChart.Legends.Add(legend2);
+ this.VelocityChart.Location = new System.Drawing.Point(242, 319);
+ this.VelocityChart.Name = "VelocityChart";
+ series2.ChartArea = "ChartArea1";
+ series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series2.Legend = "Legend1";
+ series2.Name = "Mouse Velocity";
+ this.VelocityChart.Series.Add(series2);
+ this.VelocityChart.Size = new System.Drawing.Size(721, 300);
+ this.VelocityChart.TabIndex = 28;
+ this.VelocityChart.Text = "chart1";
+ //
// RawAcceleration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(963, 312);
+ this.ClientSize = new System.Drawing.Size(963, 621);
+ this.Controls.Add(this.VelocityChart);
this.Controls.Add(this.LockXYLabel);
this.Controls.Add(this.weightXYLock);
this.Controls.Add(this.capXYLock);
@@ -332,6 +355,7 @@ namespace grapher
this.Text = "Raw Acceleration Graph";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.VelocityChart)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -365,6 +389,7 @@ namespace grapher
private System.Windows.Forms.CheckBox capXYLock;
private System.Windows.Forms.CheckBox weightXYLock;
private System.Windows.Forms.Label LockXYLabel;
+ private System.Windows.Forms.DataVisualization.Charting.Chart VelocityChart;
}
}
diff --git a/grapher/Form1.cs b/grapher/Form1.cs
index 1cbd6c9..50d6476 100644
--- a/grapher/Form1.cs
+++ b/grapher/Form1.cs
@@ -117,6 +117,7 @@ namespace grapher
AccelGUI = new AccelGUI(
this,
AccelerationChart,
+ VelocityChart,
managedAcceleration,
accelerationOptions,
sensitivity,
@@ -146,6 +147,26 @@ namespace grapher
this.AccelerationChart.ChartAreas[0].CursorX.IsUserEnabled = true;
this.AccelerationChart.ChartAreas[0].CursorY.IsUserEnabled = true;
+
+ this.VelocityChart.ChartAreas[0].AxisX.RoundAxisValues();
+
+ this.VelocityChart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
+ this.VelocityChart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
+
+ this.VelocityChart.ChartAreas[0].AxisY.ScaleView.MinSize = 0.01;
+ this.VelocityChart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = 0.001;
+
+ this.VelocityChart.ChartAreas[0].CursorY.Interval = 0.001;
+
+ this.VelocityChart.ChartAreas[0].CursorX.AutoScroll = true;
+ this.VelocityChart.ChartAreas[0].CursorY.AutoScroll = true;
+
+ this.VelocityChart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
+ this.VelocityChart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
+
+ this.VelocityChart.ChartAreas[0].CursorX.IsUserEnabled = true;
+ this.VelocityChart.ChartAreas[0].CursorY.IsUserEnabled = true;
+
}
#endregion Constructor