diff options
| author | Jacob Palecki <[email protected]> | 2020-08-12 19:04:23 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-12 19:04:23 -0700 |
| commit | a6a9f6785eb416ac48d34bb320265c812efc600b (patch) | |
| tree | 871ca3005e21f1c172f955a457610ebd91cdc788 /grapher/AccelCharts.cs | |
| parent | Fixed some edge cases around not using enter (diff) | |
| download | rawaccel-a6a9f6785eb416ac48d34bb320265c812efc600b.tar.xz rawaccel-a6a9f6785eb416ac48d34bb320265c812efc600b.zip | |
Add ability to have x\y graphs
Diffstat (limited to 'grapher/AccelCharts.cs')
| -rw-r--r-- | grapher/AccelCharts.cs | 50 |
1 files changed, 36 insertions, 14 deletions
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; /// <summary> Needed to show full contents in form. Unsure why. </summary> 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; + } } } |