diff options
| author | Matthew Strasiotto <[email protected]> | 2021-04-27 19:44:22 +1000 |
|---|---|---|
| committer | Matthew Strasiotto <[email protected]> | 2021-04-27 19:44:22 +1000 |
| commit | 4046426b2e948bceb6e39af8d1e50586e90bec11 (patch) | |
| tree | 91b211865d900dda6995d58a84b67a64055e2723 | |
| parent | chartarea is transparent for all charts now (diff) | |
| download | rawaccel-4046426b2e948bceb6e39af8d1e50586e90bec11.tar.xz rawaccel-4046426b2e948bceb6e39af8d1e50586e90bec11.zip | |
set chart props in own function
| -rw-r--r-- | grapher/App.config | 12 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 50 | ||||
| -rw-r--r-- | grapher/Properties/Settings.Designer.cs | 48 | ||||
| -rw-r--r-- | grapher/Properties/Settings.settings | 12 |
4 files changed, 120 insertions, 2 deletions
diff --git a/grapher/App.config b/grapher/App.config index da209d6..62b54de 100644 --- a/grapher/App.config +++ b/grapher/App.config @@ -13,6 +13,18 @@ <setting name="Chart_BG_Colour" serializeAs="String"> <value>Window</value> </setting> + <setting name="Chart_Font_Size" serializeAs="String"> + <value>15</value> + </setting> + <setting name="Chart_Axis_Font_Size" serializeAs="String"> + <value>12</value> + </setting> + <setting name="Chart_Series_Line_Width" serializeAs="String"> + <value>3</value> + </setting> + <setting name="Chart_FG_Colour" serializeAs="String"> + <value>Desktop</value> + </setting> </grapher.Properties.Settings> </userSettings> </configuration>
\ No newline at end of file diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index bd80ea2..133d314 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -89,6 +89,39 @@ namespace grapher #region Methods + public static void setChartColors(Chart chart) + { + //global::grapher.Models.Serialized.GUISettings + System.Drawing.Color fgColor = global::grapher.Properties.Settings.Default.Chart_FG_Colour; + System.Drawing.Color bgColor = global::grapher.Properties.Settings.Default.Chart_BG_Colour; + System.Drawing.Color bgTrans = System.Drawing.Color.Transparent; + + chart.ForeColor = fgColor; + chart.Titles[0].ForeColor = fgColor; + + chart.ChartAreas[0].AxisX.LabelStyle.ForeColor = fgColor; + chart.ChartAreas[0].AxisY.LabelStyle.ForeColor = fgColor; + + chart.ChartAreas[0].AxisX.LineColor = fgColor; + chart.ChartAreas[0].AxisY.LineColor = fgColor; + chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = fgColor; + chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = fgColor; + + chart.ChartAreas[0].AxisX.MajorGrid.LineColor = fgColor; + chart.ChartAreas[0].AxisY.MajorGrid.LineColor = fgColor; + + chart.ChartAreas[0].AxisX.MinorGrid.LineColor = fgColor; + chart.Legends[0].ForeColor = fgColor; + + chart.ChartAreas[0].AxisX.TitleForeColor = fgColor; + chart.ChartAreas[0].AxisY.TitleForeColor = fgColor; + + chart.ChartAreas[0].BorderColor = fgColor; + + chart.Legends[0].BackColor = bgTrans; + chart.ChartAreas[0].BackColor = bgTrans; + } + public static void SetupChart(Chart chart) { chart.ChartAreas[0].AxisX.RoundAxisValues(); @@ -98,7 +131,7 @@ namespace grapher chart.ChartAreas[0].AxisY.ScaleView.MinSize = 0.01; chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = 0.001; - + chart.ChartAreas[0].AxisX.LabelStyle.Format = "0.##"; chart.ChartAreas[0].AxisY.LabelStyle.Format = "0.##"; @@ -116,7 +149,20 @@ 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); + chart.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font(chart.ChartAreas[0].AxisX.TitleFont.Name, global::grapher.Properties.Settings.Default.Chart_Axis_Font_Size, System.Drawing.FontStyle.Bold); + chart.ChartAreas[0].AxisY.TitleFont = chart.ChartAreas[0].AxisX.TitleFont; + + chart.Titles[0].Font = new System.Drawing.Font(chart.Titles[0].Font.Name, global::grapher.Properties.Settings.Default.Chart_Font_Size, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold); + int line_width = global::grapher.Properties.Settings.Default.Chart_Series_Line_Width; + chart.Series[0].BorderWidth = line_width; + chart.Series[0].MarkerSize = line_width; + chart.Series[2].BorderWidth = line_width; + chart.Series[2].MarkerSize = line_width; + + chart.ChartAreas[0].AxisX.MinorGrid.Enabled = true; + chart.ChartAreas[0].AxisX.MinorGrid.LineDashStyle = ChartDashStyle.Dot; + + setChartColors(chart); } public static void DrawPoint(Chart chart, PointData pointOne, PointData pointTwo = null) diff --git a/grapher/Properties/Settings.Designer.cs b/grapher/Properties/Settings.Designer.cs index 285e18e..51f559a 100644 --- a/grapher/Properties/Settings.Designer.cs +++ b/grapher/Properties/Settings.Designer.cs @@ -34,5 +34,53 @@ namespace grapher.Properties { this["Chart_BG_Colour"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("15")] + public float Chart_Font_Size { + get { + return ((float)(this["Chart_Font_Size"])); + } + set { + this["Chart_Font_Size"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("12")] + public float Chart_Axis_Font_Size { + get { + return ((float)(this["Chart_Axis_Font_Size"])); + } + set { + this["Chart_Axis_Font_Size"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("3")] + public int Chart_Series_Line_Width { + get { + return ((int)(this["Chart_Series_Line_Width"])); + } + set { + this["Chart_Series_Line_Width"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Desktop")] + public global::System.Drawing.Color Chart_FG_Colour { + get { + return ((global::System.Drawing.Color)(this["Chart_FG_Colour"])); + } + set { + this["Chart_FG_Colour"] = value; + } + } } } diff --git a/grapher/Properties/Settings.settings b/grapher/Properties/Settings.settings index 7c46209..74b2acf 100644 --- a/grapher/Properties/Settings.settings +++ b/grapher/Properties/Settings.settings @@ -5,5 +5,17 @@ <Setting Name="Chart_BG_Colour" Type="System.Drawing.Color" Scope="User"> <Value Profile="(Default)">Window</Value> </Setting> + <Setting Name="Chart_Font_Size" Type="System.Single" Scope="User"> + <Value Profile="(Default)">15</Value> + </Setting> + <Setting Name="Chart_Axis_Font_Size" Type="System.Single" Scope="User"> + <Value Profile="(Default)">12</Value> + </Setting> + <Setting Name="Chart_Series_Line_Width" Type="System.Int32" Scope="User"> + <Value Profile="(Default)">3</Value> + </Setting> + <Setting Name="Chart_FG_Colour" Type="System.Drawing.Color" Scope="User"> + <Value Profile="(Default)">Desktop</Value> + </Setting> </Settings> </SettingsFile>
\ No newline at end of file |