diff options
| author | Jacob Palecki <[email protected]> | 2020-09-08 16:53:16 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-08 16:53:16 -0700 |
| commit | c6cc72badf507f13ef48e330efddb57fe3030a5d (patch) | |
| tree | e8960e5b9b9242bc18e4717acb5cdbb3ce524e1d | |
| parent | Merge pull request #20 from JacobPalecki/GUI (diff) | |
| download | rawaccel-c6cc72badf507f13ef48e330efddb57fe3030a5d.tar.xz rawaccel-c6cc72badf507f13ef48e330efddb57fe3030a5d.zip | |
Clean up chart titles, axes, legends
| -rw-r--r-- | grapher/Constants/Constants.cs | 15 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 82 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 6 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 15 |
4 files changed, 91 insertions, 27 deletions
diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index aaf8bb9..a51b09c 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -89,6 +89,21 @@ namespace grapher /// <summary> Default text to be displayed on write button. </summary> public const string WriteButtonDelayText = "Delay"; + /// <summary> Title of sensitivity chart. </summary> + public const string SensitivityChartTitle = "Sensitivity"; + + /// <summary> Title of velocity chart. </summary> + public const string VelocityChartTitle = "Velocity"; + + /// <summary> Title of gain chart. </summary> + public const string GainChartTitle = "Gain"; + + /// <summary> Text for x component. </summary> + public const string XComponent = "X"; + + /// <summary> Text for y component. </summary> + public const string YComponent = "Y"; + /// <summary> Default name of settings file. </summary> public const string DefaultSettingsFileName = @"settings.json"; diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index f8a6578..fd54051 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -34,26 +34,32 @@ namespace grapher System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title2 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title3 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series7 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series8 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title4 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series9 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series10 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title5 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series11 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series12 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title6 = new System.Windows.Forms.DataVisualization.Charting.Title(); this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.accelTypeDropX = new System.Windows.Forms.ComboBox(); this.sensitivityBoxX = new System.Windows.Forms.TextBox(); @@ -89,6 +95,7 @@ namespace grapher this.pollRateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PollRateTextBox = new System.Windows.Forms.ToolStripTextBox(); this.ScaleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showLastMouseMoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.capStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.gainCapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -138,7 +145,6 @@ namespace grapher this.OptionSetYTitle = new System.Windows.Forms.Label(); this.AccelTypeActiveLabelY = new System.Windows.Forms.Label(); this.ActiveValueTitleY = new System.Windows.Forms.Label(); - this.showLastMouseMoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.VelocityChart)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GainChart)).BeginInit(); @@ -151,7 +157,7 @@ namespace grapher // AccelerationChart // chartArea1.AxisX.Title = "Speed (counts/ms)"; - chartArea1.AxisY.Title = "Sensitivity (magnitude ratio)"; + chartArea1.AxisY.Title = "Ratio of Output to Input"; chartArea1.Name = "ChartArea1"; this.AccelerationChart.ChartAreas.Add(chartArea1); legend1.Name = "Legend1"; @@ -166,12 +172,17 @@ namespace grapher series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series2.Legend = "Legend1"; - series2.Name = "LastAccelVal"; + series2.Name = "Last Mouse Move"; this.AccelerationChart.Series.Add(series1); this.AccelerationChart.Series.Add(series2); this.AccelerationChart.Size = new System.Drawing.Size(698, 328); this.AccelerationChart.TabIndex = 0; this.AccelerationChart.Text = "Sensitivity"; + title1.DockedToChartArea = "ChartArea1"; + title1.IsDockedInsideChartArea = false; + title1.Name = "Title"; + title1.Text = "Sensitivity"; + this.AccelerationChart.Titles.Add(title1); // // accelTypeDropX // @@ -379,17 +390,22 @@ namespace grapher series3.ChartArea = "ChartArea1"; series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; series3.Legend = "Legend1"; - series3.Name = "Mouse Velocity"; + series3.Name = "Output Velocity"; series4.ChartArea = "ChartArea1"; series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series4.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series4.Legend = "Legend1"; - series4.Name = "LastVelocityVal"; + series4.Name = "Last Mouse Move"; this.VelocityChart.Series.Add(series3); this.VelocityChart.Series.Add(series4); this.VelocityChart.Size = new System.Drawing.Size(698, 307); this.VelocityChart.TabIndex = 28; this.VelocityChart.Text = "chart1"; + title2.DockedToChartArea = "ChartArea1"; + title2.IsDockedInsideChartArea = false; + title2.Name = "Title"; + title2.Text = "Velocity"; + this.VelocityChart.Titles.Add(title2); // // GainChart // @@ -409,12 +425,17 @@ namespace grapher series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series6.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series6.Legend = "Legend1"; - series6.Name = "LastGainVal"; + series6.Name = "Last Mouse Move"; this.GainChart.Series.Add(series5); this.GainChart.Series.Add(series6); this.GainChart.Size = new System.Drawing.Size(698, 309); this.GainChart.TabIndex = 29; this.GainChart.Text = "chart1"; + title3.DockedToChartArea = "ChartArea1"; + title3.IsDockedInsideChartArea = false; + title3.Name = "Title"; + title3.Text = "Gain"; + this.GainChart.Titles.Add(title3); // // menuStrip1 // @@ -491,6 +512,15 @@ namespace grapher this.ScaleMenuItem.Size = new System.Drawing.Size(169, 22); this.ScaleMenuItem.Text = "Re-scale by above"; // + // showLastMouseMoveToolStripMenuItem + // + this.showLastMouseMoveToolStripMenuItem.Checked = true; + this.showLastMouseMoveToolStripMenuItem.CheckOnClick = true; + this.showLastMouseMoveToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.showLastMouseMoveToolStripMenuItem.Name = "showLastMouseMoveToolStripMenuItem"; + this.showLastMouseMoveToolStripMenuItem.Size = new System.Drawing.Size(199, 22); + this.showLastMouseMoveToolStripMenuItem.Text = "Show Last Mouse Move"; + // // advancedToolStripMenuItem // this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -507,7 +537,7 @@ namespace grapher this.gainCapToolStripMenuItem, this.legacyCapToolStripMenuItem}); this.capStyleToolStripMenuItem.Name = "capStyleToolStripMenuItem"; - this.capStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.capStyleToolStripMenuItem.Size = new System.Drawing.Size(163, 22); this.capStyleToolStripMenuItem.Text = "Cap Style"; // // gainCapToolStripMenuItem @@ -530,7 +560,7 @@ namespace grapher this.gainOffsetToolStripMenuItem, this.legacyOffsetToolStripMenuItem}); this.offsetStyleToolStripMenuItem.Name = "offsetStyleToolStripMenuItem"; - this.offsetStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.offsetStyleToolStripMenuItem.Size = new System.Drawing.Size(163, 22); this.offsetStyleToolStripMenuItem.Text = "Offset Style"; // // gainOffsetToolStripMenuItem @@ -551,7 +581,7 @@ namespace grapher this.wholeVectorToolStripMenuItem, this.byVectorComponentToolStripMenuItem}); this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem1.Size = new System.Drawing.Size(163, 22); this.toolStripMenuItem1.Text = "Application Style"; // // wholeVectorToolStripMenuItem @@ -589,7 +619,7 @@ namespace grapher // AccelerationChartY // chartArea4.AxisX.Title = "Speed (counts/ms)"; - chartArea4.AxisY.Title = "Sensitivity (magnitude ratio)"; + chartArea4.AxisY.Title = "Ratio of Output to Input)"; chartArea4.Name = "ChartArea1"; this.AccelerationChartY.ChartAreas.Add(chartArea4); legend4.Name = "Legend1"; @@ -604,12 +634,17 @@ namespace grapher series8.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series8.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series8.Legend = "Legend1"; - series8.Name = "LastAccelVal"; + series8.Name = "Last Mouse Move"; this.AccelerationChartY.Series.Add(series7); this.AccelerationChartY.Series.Add(series8); this.AccelerationChartY.Size = new System.Drawing.Size(698, 328); this.AccelerationChartY.TabIndex = 31; this.AccelerationChartY.Text = "chart1"; + title4.DockedToChartArea = "ChartArea1"; + title4.IsDockedInsideChartArea = false; + title4.Name = "Title"; + title4.Text = "Sensitivity"; + this.AccelerationChartY.Titles.Add(title4); // // VelocityChartY // @@ -624,17 +659,22 @@ namespace grapher series9.ChartArea = "ChartArea1"; series9.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; series9.Legend = "Legend1"; - series9.Name = "Mouse Velocity"; + series9.Name = "Output Velocity"; series10.ChartArea = "ChartArea1"; series10.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series10.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series10.Legend = "Legend1"; - series10.Name = "LastVelocityVal"; + series10.Name = "Last Mouse Move"; this.VelocityChartY.Series.Add(series9); this.VelocityChartY.Series.Add(series10); this.VelocityChartY.Size = new System.Drawing.Size(698, 307); this.VelocityChartY.TabIndex = 32; this.VelocityChartY.Text = "chart1"; + title5.DockedToChartArea = "ChartArea1"; + title5.IsDockedInsideChartArea = false; + title5.Name = "Title"; + title5.Text = "Velocity"; + this.VelocityChartY.Titles.Add(title5); // // GainChartY // @@ -654,12 +694,17 @@ namespace grapher series12.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; series12.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); series12.Legend = "Legend1"; - series12.Name = "LastGainVal"; + series12.Name = "Last Mouse Move"; this.GainChartY.Series.Add(series11); this.GainChartY.Series.Add(series12); this.GainChartY.Size = new System.Drawing.Size(698, 309); this.GainChartY.TabIndex = 33; this.GainChartY.Text = "chart1"; + title6.DockedToChartArea = "ChartArea1"; + title6.IsDockedInsideChartArea = false; + title6.Name = "Title"; + title6.Text = "Gain"; + this.GainChartY.Titles.Add(title6); // // MouseLabel // @@ -961,15 +1006,6 @@ namespace grapher this.ActiveValueTitleY.TabIndex = 67; this.ActiveValueTitleY.Text = "Active"; // - // showLastMouseMoveToolStripMenuItem - // - this.showLastMouseMoveToolStripMenuItem.Checked = true; - this.showLastMouseMoveToolStripMenuItem.CheckOnClick = true; - this.showLastMouseMoveToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.showLastMouseMoveToolStripMenuItem.Name = "showLastMouseMoveToolStripMenuItem"; - this.showLastMouseMoveToolStripMenuItem.Size = new System.Drawing.Size(199, 22); - this.showLastMouseMoveToolStripMenuItem.Text = "Show Last Mouse Move"; - // // RawAcceleration // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 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 } } |