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