From 4046426b2e948bceb6e39af8d1e50586e90bec11 Mon Sep 17 00:00:00 2001 From: Matthew Strasiotto <39424834+matthewstrasiotto@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:44:22 +1000 Subject: set chart props in own function --- grapher/App.config | 12 ++++++++ grapher/Models/Charts/ChartXY.cs | 50 +++++++++++++++++++++++++++++++-- grapher/Properties/Settings.Designer.cs | 48 +++++++++++++++++++++++++++++++ grapher/Properties/Settings.settings | 12 ++++++++ 4 files changed, 120 insertions(+), 2 deletions(-) (limited to 'grapher') 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 @@ Window + + 15 + + + 12 + + + 3 + + + Desktop + \ 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 @@ Window + + 15 + + + 12 + + + 3 + + + Desktop + \ No newline at end of file -- cgit v1.2.3