From a6a9f6785eb416ac48d34bb320265c812efc600b Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 12 Aug 2020 19:04:23 -0700 Subject: Add ability to have x\y graphs --- grapher/AccelCharts.cs | 50 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 14 deletions(-) (limited to 'grapher/AccelCharts.cs') diff --git a/grapher/AccelCharts.cs b/grapher/AccelCharts.cs index 62c60e5..9952016 100644 --- a/grapher/AccelCharts.cs +++ b/grapher/AccelCharts.cs @@ -11,16 +11,16 @@ namespace grapher { public class AccelCharts { - public const int ChartSeparation = 10; + public const int ChartSeparationVertical = 10; /// Needed to show full contents in form. Unsure why. public const int FormHeightPadding = 35; public AccelCharts( Form form, - Chart sensitivityChart, - Chart velocityChart, - Chart gainChart, + ChartXY sensitivityChart, + ChartXY velocityChart, + ChartXY gainChart, ToolStripMenuItem enableVelocityAndGain) { ContaingForm = form; @@ -29,11 +29,11 @@ namespace grapher GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; - SensitivityChart.Top = 0; - VelocityChart.Height = SensitivityChart.Height; - VelocityChart.Top = SensitivityChart.Height + ChartSeparation; - GainChart.Height = SensitivityChart.Height; - GainChart.Top = VelocityChart.Top + VelocityChart.Height + ChartSeparation; + SensitivityChart.SetTop(0); + VelocityChart.SetHeight(SensitivityChart.Height); + VelocityChart.SetTop(SensitivityChart.Height + ChartSeparationVertical); + GainChart.SetHeight(SensitivityChart.Height); + GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + ChartSeparationVertical); Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); FormBorderHeight = screenRectangle.Top - ContaingForm.Top; @@ -42,15 +42,16 @@ namespace grapher EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableCheckStateChange); HideVelocityAndGain(); + ShowCombined(); } public Form ContaingForm { get; } - public Chart SensitivityChart { get; } + public ChartXY SensitivityChart { get; } - public Chart VelocityChart { get; } + public ChartXY VelocityChart { get; } - public Chart GainChart { get; } + public ChartXY GainChart { get; } public ToolStripMenuItem EnableVelocityAndGain { get; } @@ -78,9 +79,9 @@ namespace grapher VelocityChart.Show(); GainChart.Show(); ContaingForm.Height = SensitivityChart.Height + - ChartSeparation + + ChartSeparationVertical + VelocityChart.Height + - ChartSeparation + + ChartSeparationVertical + GainChart.Height + FormBorderHeight; } @@ -91,5 +92,26 @@ namespace grapher GainChart.Hide(); ContaingForm.Height = SensitivityChart.Height + FormBorderHeight; } + + private void ShowXandYSeparate() + { + SensitivityChart.SetSeparate(); + VelocityChart.SetSeparate(); + GainChart.SetSeparate(); + UpdateFormWidth(); + } + + private void ShowCombined() + { + SensitivityChart.SetCombined(); + VelocityChart.SetCombined(); + GainChart.SetCombined(); + UpdateFormWidth(); + } + + private void UpdateFormWidth() + { + ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; + } } } -- cgit v1.2.3 From cc531c79f2bd664551071ef315a54814bd9ab914 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 12 Aug 2020 19:22:21 -0700 Subject: Reorganized solution into directories --- grapher/AccelCharts.cs | 117 ------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 grapher/AccelCharts.cs (limited to 'grapher/AccelCharts.cs') diff --git a/grapher/AccelCharts.cs b/grapher/AccelCharts.cs deleted file mode 100644 index 9952016..0000000 --- a/grapher/AccelCharts.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -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; - -namespace grapher -{ - public class AccelCharts - { - public const int ChartSeparationVertical = 10; - - /// Needed to show full contents in form. Unsure why. - public const int FormHeightPadding = 35; - - public AccelCharts( - Form form, - ChartXY sensitivityChart, - ChartXY velocityChart, - ChartXY gainChart, - ToolStripMenuItem enableVelocityAndGain) - { - ContaingForm = form; - SensitivityChart = sensitivityChart; - VelocityChart = velocityChart; - GainChart = gainChart; - EnableVelocityAndGain = enableVelocityAndGain; - - SensitivityChart.SetTop(0); - VelocityChart.SetHeight(SensitivityChart.Height); - VelocityChart.SetTop(SensitivityChart.Height + ChartSeparationVertical); - GainChart.SetHeight(SensitivityChart.Height); - GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + ChartSeparationVertical); - - Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); - FormBorderHeight = screenRectangle.Top - ContaingForm.Top; - - EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick); - EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableCheckStateChange); - - HideVelocityAndGain(); - ShowCombined(); - } - - public Form ContaingForm { get; } - - public ChartXY SensitivityChart { get; } - - public ChartXY VelocityChart { get; } - - public ChartXY GainChart { get; } - - public ToolStripMenuItem EnableVelocityAndGain { get; } - - private int FormBorderHeight { get; } - - private void OnEnableClick(object sender, EventArgs e) - { - EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; - } - - private void OnEnableCheckStateChange(object sender, EventArgs e) - { - if (EnableVelocityAndGain.Checked) - { - ShowVelocityAndGain(); - } - else - { - HideVelocityAndGain(); - } - } - - private void ShowVelocityAndGain() - { - VelocityChart.Show(); - GainChart.Show(); - ContaingForm.Height = SensitivityChart.Height + - ChartSeparationVertical + - VelocityChart.Height + - ChartSeparationVertical + - GainChart.Height + - FormBorderHeight; - } - - private void HideVelocityAndGain() - { - VelocityChart.Hide(); - GainChart.Hide(); - ContaingForm.Height = SensitivityChart.Height + FormBorderHeight; - } - - private void ShowXandYSeparate() - { - SensitivityChart.SetSeparate(); - VelocityChart.SetSeparate(); - GainChart.SetSeparate(); - UpdateFormWidth(); - } - - private void ShowCombined() - { - SensitivityChart.SetCombined(); - VelocityChart.SetCombined(); - GainChart.SetCombined(); - UpdateFormWidth(); - } - - private void UpdateFormWidth() - { - ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; - } - } -} -- cgit v1.2.3