From b5b87e24053c9f52a2edb5b1cb48f8e27e434ce1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 00:56:07 -0700 Subject: Show xy charts only when accel applied by component --- grapher/Models/Charts/AccelCharts.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 1aa3909..0136ced 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -24,8 +24,7 @@ namespace grapher ChartXY sensitivityChart, ChartXY velocityChart, ChartXY gainChart, - ToolStripMenuItem enableVelocityAndGain, - ICollection checkBoxesXY) + ToolStripMenuItem enableVelocityAndGain) { Estimated = new EstimatedPoints(); EstimatedX = new EstimatedPoints(); @@ -37,7 +36,6 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; - CheckBoxesXY = checkBoxesXY; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); VelocityChart.SetPointBinds(Estimated.Velocity, EstimatedX.Velocity, EstimatedY.Velocity); @@ -78,8 +76,6 @@ namespace grapher private EstimatedPoints EstimatedY { get; } - private ICollection CheckBoxesXY { get; } - private bool Combined { get; set; } private int FormBorderHeight { get; } @@ -119,9 +115,9 @@ namespace grapher } } - public void RefreshXY() + public void RefreshXY(bool isWhole) { - if (CheckBoxesXY.All(box => box.Checked)) + if (isWhole) { ShowCombined(); } -- cgit v1.2.3 From 246fb772c5bf7dd6a85143fadebece3b4d9f1e04 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:18:41 -0700 Subject: Add constants class and separate classes into regions --- grapher/Models/Charts/AccelCharts.cs | 26 +++++++++++++++++--------- grapher/Models/Charts/ChartXY.cs | 4 ++-- grapher/Models/Charts/EstimatedPoints.cs | 8 ++++++++ 3 files changed, 27 insertions(+), 11 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 0136ced..1574ce2 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,4 +1,5 @@ -using grapher.Models.Calculations; +using grapher.Constants; +using grapher.Models.Calculations; using grapher.Models.Charts; using System; using System.Collections.Generic; @@ -14,10 +15,7 @@ namespace grapher { public class AccelCharts { - public const int ChartSeparationVertical = 10; - - /// Needed to show full contents in form. Unsure why. - public const int FormHeightPadding = 35; + #region Constructors public AccelCharts( Form form, @@ -43,9 +41,9 @@ namespace grapher SensitivityChart.SetTop(0); VelocityChart.SetHeight(SensitivityChart.Height); - VelocityChart.SetTop(SensitivityChart.Height + ChartSeparationVertical); + VelocityChart.SetTop(SensitivityChart.Height + AccelGUIConstants.ChartSeparationVertical); GainChart.SetHeight(SensitivityChart.Height); - GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + ChartSeparationVertical); + GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + AccelGUIConstants.ChartSeparationVertical); Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); FormBorderHeight = screenRectangle.Top - ContaingForm.Top; @@ -58,6 +56,10 @@ namespace grapher ShowCombined(); } + #endregion Constructors + + #region Properties + public Form ContaingForm { get; } public ChartXY SensitivityChart { get; } @@ -80,6 +82,10 @@ namespace grapher private int FormBorderHeight { get; } + #endregion Properties + + #region Methods + public void MakeDots(int x, int y, double timeInMs) { if (Combined) @@ -149,9 +155,9 @@ namespace grapher VelocityChart.Show(); GainChart.Show(); ContaingForm.Height = SensitivityChart.Height + - ChartSeparationVertical + + AccelGUIConstants.ChartSeparationVertical + VelocityChart.Height + - ChartSeparationVertical + + AccelGUIConstants.ChartSeparationVertical + GainChart.Height + FormBorderHeight; } @@ -195,5 +201,7 @@ namespace grapher { ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; } + + #endregion Methods } } diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 81874a2..e5a948a 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -15,11 +15,11 @@ namespace grapher { public class ChartXY { - #region Consts + #region Constants public const int ChartSeparationHorizontal = 10; - #endregion Consts + #endregion Constants #region Constructors diff --git a/grapher/Models/Charts/EstimatedPoints.cs b/grapher/Models/Charts/EstimatedPoints.cs index fa0718b..9ff0e5b 100644 --- a/grapher/Models/Charts/EstimatedPoints.cs +++ b/grapher/Models/Charts/EstimatedPoints.cs @@ -9,6 +9,8 @@ namespace grapher.Models.Charts { public class EstimatedPoints { + #region Constructors + public EstimatedPoints() { Sensitivity = new PointData(); @@ -16,10 +18,16 @@ namespace grapher.Models.Charts Gain = new PointData(); } + #endregion Constructors + + #region Properties + public PointData Sensitivity { get; } public PointData Velocity { get; } public PointData Gain { get; } + + #endregion Properties } } -- cgit v1.2.3 From 4aa2f3ed741dcbd39233e125a34cac8163267d8d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:39:09 -0700 Subject: Move constants to central class --- grapher/Models/Charts/AccelCharts.cs | 13 ++++++------- grapher/Models/Charts/ChartXY.cs | 8 +------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 1574ce2..5e4b3de 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,5 +1,4 @@ -using grapher.Constants; -using grapher.Models.Calculations; +using grapher.Models.Calculations; using grapher.Models.Charts; using System; using System.Collections.Generic; @@ -41,9 +40,9 @@ namespace grapher SensitivityChart.SetTop(0); VelocityChart.SetHeight(SensitivityChart.Height); - VelocityChart.SetTop(SensitivityChart.Height + AccelGUIConstants.ChartSeparationVertical); + VelocityChart.SetTop(SensitivityChart.Height + Constants.ChartSeparationVertical); GainChart.SetHeight(SensitivityChart.Height); - GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + AccelGUIConstants.ChartSeparationVertical); + GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + Constants.ChartSeparationVertical); Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); FormBorderHeight = screenRectangle.Top - ContaingForm.Top; @@ -154,10 +153,10 @@ namespace grapher { VelocityChart.Show(); GainChart.Show(); - ContaingForm.Height = SensitivityChart.Height + - AccelGUIConstants.ChartSeparationVertical + + ContaingForm.Height = SensitivityChart.Height + + Constants.ChartSeparationVertical + VelocityChart.Height + - AccelGUIConstants.ChartSeparationVertical + + Constants.ChartSeparationVertical + GainChart.Height + FormBorderHeight; } diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index e5a948a..6a65e41 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -15,12 +15,6 @@ namespace grapher { public class ChartXY { - #region Constants - - public const int ChartSeparationHorizontal = 10; - - #endregion Constants - #region Constructors public ChartXY(Chart chartX, Chart chartY) @@ -31,7 +25,7 @@ namespace grapher ChartY.Top = ChartX.Top; ChartY.Height = ChartX.Height; ChartY.Width = ChartX.Width; - ChartY.Left = ChartX.Left + ChartX.Width + ChartSeparationHorizontal; + ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal; SetupChart(ChartX); SetupChart(ChartY); -- cgit v1.2.3 From 1462da675f1bc36d2a770413f13ccc68165cf1e9 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 20:30:15 -0700 Subject: Add chart resize --- grapher/Models/Charts/AccelCharts.cs | 16 ++++++++++++++++ grapher/Models/Charts/ChartXY.cs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 5e4b3de..6d9f0a1 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -132,6 +132,22 @@ namespace grapher } } + public void SetWidened() + { + SensitivityChart.SetWidened(); + VelocityChart.SetWidened(); + GainChart.SetWidened(); + UpdateFormWidth(); + } + + public void SetNarrowed() + { + SensitivityChart.SetNarrowed(); + VelocityChart.SetNarrowed(); + GainChart.SetNarrowed(); + UpdateFormWidth(); + } + private void OnEnableClick(object sender, EventArgs e) { EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 6a65e41..7998f7f 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -29,6 +29,9 @@ namespace grapher SetupChart(ChartX); SetupChart(ChartY); + + Widened = false; + SetWidened(); } #endregion Constructors @@ -76,6 +79,8 @@ namespace grapher public bool Combined { get; private set; } + public bool Widened { get; private set; } + private PointData CombinedPointData { get; set; } private PointData XPointData { get; set; } @@ -174,6 +179,34 @@ namespace grapher } } + public void SetWidened() + { + if (!Widened) + { + ChartX.Width = Constants.WideChartWidth; + ChartY.Width = Constants.WideChartWidth; + + ChartX.Left = Constants.WideChartLeft; + ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal; + + Widened = true; + } + } + + public void SetNarrowed() + { + if (Widened) + { + ChartX.Width = Constants.NarrowChartWidth; + ChartY.Width = Constants.NarrowChartWidth; + + ChartX.Left = Constants.NarrowChartLeft; + ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal; + + Widened = false; + } + } + public void Hide() { ChartX.Hide(); -- cgit v1.2.3 From 9502dcf7608475857b1487375997d20a9d29622e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:26:22 -0700 Subject: Remove and sort usings en masse --- grapher/Models/Charts/AccelCharts.cs | 6 ------ grapher/Models/Charts/ChartXY.cs | 11 +---------- grapher/Models/Charts/EstimatedPoints.cs | 5 ----- 3 files changed, 1 insertion(+), 21 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 6d9f0a1..b3199d4 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,14 +1,8 @@ using grapher.Models.Calculations; using grapher.Models.Charts; using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Security.Permissions; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -using System.Windows.Forms.DataVisualization.Charting; namespace grapher { diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 7998f7f..5ff2a8d 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -1,15 +1,6 @@ -using grapher.Models.Charts; -using grapher.Models.Mouse; -using System; +using grapher.Models.Mouse; using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; -using static grapher.AccelCharts; namespace grapher { diff --git a/grapher/Models/Charts/EstimatedPoints.cs b/grapher/Models/Charts/EstimatedPoints.cs index 9ff0e5b..f7ba3ce 100644 --- a/grapher/Models/Charts/EstimatedPoints.cs +++ b/grapher/Models/Charts/EstimatedPoints.cs @@ -1,9 +1,4 @@ using grapher.Models.Mouse; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace grapher.Models.Charts { -- cgit v1.2.3 From ae8ee86fdaac66815827e132493c8bfcc5fbf8c9 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 14:29:37 -0700 Subject: Center write button --- grapher/Models/Charts/AccelCharts.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index b3199d4..9040851 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -15,7 +15,8 @@ namespace grapher ChartXY sensitivityChart, ChartXY velocityChart, ChartXY gainChart, - ToolStripMenuItem enableVelocityAndGain) + ToolStripMenuItem enableVelocityAndGain, + Button writeButton) { Estimated = new EstimatedPoints(); EstimatedX = new EstimatedPoints(); @@ -27,6 +28,7 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; + WriteButton = writeButton; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); VelocityChart.SetPointBinds(Estimated.Velocity, EstimatedX.Velocity, EstimatedY.Velocity); @@ -63,6 +65,8 @@ namespace grapher public ToolStripMenuItem EnableVelocityAndGain { get; } + private Button WriteButton { get; } + public AccelData AccelData { get; } private EstimatedPoints Estimated { get; } @@ -132,6 +136,7 @@ namespace grapher VelocityChart.SetWidened(); GainChart.SetWidened(); UpdateFormWidth(); + AlignWriteButton(); } public void SetNarrowed() @@ -140,6 +145,7 @@ namespace grapher VelocityChart.SetNarrowed(); GainChart.SetNarrowed(); UpdateFormWidth(); + AlignWriteButton(); } private void OnEnableClick(object sender, EventArgs e) @@ -211,6 +217,11 @@ namespace grapher ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; } + private void AlignWriteButton() + { + WriteButton.Left = SensitivityChart.Left / 2 - WriteButton.Width / 2; + } + #endregion Methods } } -- cgit v1.2.3 From 25ab05b2854428891b1615b7b78e9257c2d6db35 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 14:44:53 -0700 Subject: Add option to turn off last mouse move dot --- grapher/Models/Charts/AccelCharts.cs | 31 +++++++++++++++++++++++++------ grapher/Models/Charts/ChartXY.cs | 8 +++++++- 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 9040851..84673b8 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -16,6 +16,7 @@ namespace grapher ChartXY velocityChart, ChartXY gainChart, ToolStripMenuItem enableVelocityAndGain, + ToolStripMenuItem enableLastMouseMove, Button writeButton) { Estimated = new EstimatedPoints(); @@ -28,6 +29,7 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; + EnableLastValue = enableLastMouseMove; WriteButton = writeButton; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); @@ -44,7 +46,9 @@ namespace grapher FormBorderHeight = screenRectangle.Top - ContaingForm.Top; EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick); - EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableCheckStateChange); + EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableVelocityGainCheckStateChange); + + EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange); HideVelocityAndGain(); Combined = false; @@ -65,6 +69,8 @@ namespace grapher public ToolStripMenuItem EnableVelocityAndGain { get; } + private ToolStripMenuItem EnableLastValue { get; } + private Button WriteButton { get; } public AccelData AccelData { get; } @@ -95,11 +101,14 @@ namespace grapher } } - public void DrawPoints() + public void DrawLastMovement() { - SensitivityChart.DrawPoints(); - VelocityChart.DrawPoints(); - GainChart.DrawPoints(); + if (EnableLastValue.Checked) + { + SensitivityChart.DrawLastMovementValue(); + VelocityChart.DrawLastMovementValue(); + GainChart.DrawLastMovementValue(); + } } public void Bind() @@ -153,7 +162,7 @@ namespace grapher EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; } - private void OnEnableCheckStateChange(object sender, EventArgs e) + private void OnEnableVelocityGainCheckStateChange(object sender, EventArgs e) { if (EnableVelocityAndGain.Checked) { @@ -165,6 +174,16 @@ namespace grapher } } + private void OnEnableLastMouseMoveCheckStateChange(object sender, EventArgs e) + { + if (!EnableLastValue.Checked) + { + SensitivityChart.ClearLastValue(); + VelocityChart.ClearLastValue(); + GainChart.ClearLastValue(); + } + } + private void ShowVelocityAndGain() { VelocityChart.Show(); diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 5ff2a8d..2037190 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -124,7 +124,7 @@ namespace grapher YPointData = y; } - public void DrawPoints() + public void DrawLastMovementValue() { if(Combined) { @@ -137,6 +137,12 @@ namespace grapher } } + public void ClearLastValue() + { + ChartX.Series[1].Points.Clear(); + ChartY.Series[1].Points.Clear(); + } + public void Bind(IDictionary data) { ChartX.Series[0].Points.DataBindXY(data.Keys, data.Values); -- cgit v1.2.3 From b8a8eb8a70cf71c61e5dc851229a83027f43194d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 15:20:31 -0700 Subject: By component, anisotropy full works --- grapher/Models/Charts/AccelCharts.cs | 6 ++++-- grapher/Models/Charts/ChartXY.cs | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'grapher/Models/Charts') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 84673b8..3f228c3 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,5 +1,6 @@ using grapher.Models.Calculations; using grapher.Models.Charts; +using grapher.Models.Serialized; using System; using System.Drawing; using System.Windows.Forms; @@ -51,6 +52,7 @@ namespace grapher EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange); HideVelocityAndGain(); + SensitivityChart.Show(); Combined = false; ShowCombined(); } @@ -127,9 +129,9 @@ namespace grapher } } - public void RefreshXY(bool isWhole) + public void ShowActive(DriverSettings driverSettings) { - if (isWhole) + if (driverSettings.combineMagnitudes) { ShowCombined(); } diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 2037190..30be229 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -21,6 +21,9 @@ namespace grapher SetupChart(ChartX); SetupChart(ChartY); + Combined = false; + SetCombined(); + Widened = false; SetWidened(); } @@ -72,6 +75,8 @@ namespace grapher public bool Widened { get; private set; } + public bool Visible { get; private set; } + private PointData CombinedPointData { get; set; } private PointData XPointData { get; set; } @@ -167,7 +172,7 @@ namespace grapher { if (Combined) { - if (ChartX.Visible) + if (Visible) { ChartY.Show(); } @@ -206,17 +211,26 @@ namespace grapher public void Hide() { - ChartX.Hide(); - ChartY.Hide(); + if (Visible) + { + ChartX.Hide(); + ChartY.Hide(); + Visible = false; + } } public void Show() { - ChartX.Show(); - - if (!Combined) + if (!Visible) { - ChartY.Show(); + ChartX.Show(); + + if (!Combined) + { + ChartY.Show(); + } + + Visible = true; } } -- cgit v1.2.3