From c6cc72badf507f13ef48e330efddb57fe3030a5d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 16:53:16 -0700 Subject: Clean up chart titles, axes, legends --- grapher/Models/AccelGUIFactory.cs | 6 +++--- grapher/Models/Charts/ChartXY.cs | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'grapher/Models') diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 42a7b83..189c82a 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -91,9 +91,9 @@ namespace grapher.Models { var accelCharts = new AccelCharts( form, - new ChartXY(accelerationChart, accelerationChartY), - new ChartXY(velocityChart, velocityChartY), - new ChartXY(gainChart, gainChartY), + new ChartXY(accelerationChart, accelerationChartY, Constants.SensitivityChartTitle), + new ChartXY(velocityChart, velocityChartY, Constants.VelocityChartTitle), + new ChartXY(gainChart, gainChartY, Constants.GainChartTitle), showVelocityGainToolStripMenuItem, showLastMouseMoveMenuItem, writeButton); diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 30be229..1360409 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -8,10 +8,11 @@ namespace grapher { #region Constructors - public ChartXY(Chart chartX, Chart chartY) + public ChartXY(Chart chartX, Chart chartY, string title) { ChartX = chartX; ChartY = chartY; + Title = title; ChartY.Top = ChartX.Top; ChartY.Height = ChartX.Height; @@ -77,6 +78,8 @@ namespace grapher public bool Visible { get; private set; } + public string Title { get; } + private PointData CombinedPointData { get; set; } private PointData XPointData { get; set; } @@ -110,6 +113,8 @@ namespace grapher chart.Series[1].Points.Clear(); chart.Series[1].Points.AddXY(0, 0); + + chart.Titles[0].Font = new System.Drawing.Font(chart.Titles[0].Font.Name, 9.0f, System.Drawing.FontStyle.Italic); } public static void DrawPoint(Chart chart, PointData point) @@ -165,6 +170,7 @@ namespace grapher { ChartY.Hide(); Combined = true; + ChartX.Titles[0].Text = Title; } } @@ -177,6 +183,9 @@ namespace grapher ChartY.Show(); } + ChartX.Titles[0].Text = SetComponentTitle(Constants.XComponent); + ChartY.Titles[0].Text = SetComponentTitle(Constants.YComponent); + Combined = false; } } @@ -246,6 +255,10 @@ namespace grapher ChartY.Height = height; } + private string SetComponentTitle(string component) + { + return $"{Title} : {component}"; + } #endregion Methods } } -- cgit v1.2.3