Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GraphSettings.cs
1using System;
2using SkiaSharp;
3
5{
9 public class GraphSettings
10 {
11 private SKColor backgroundColor = SKColors.White;
12 private SKColor axisColor = SKColors.Black;
13 private SKColor gridColor = SKColors.LightGray;
14 private string fontName = "Segoe UI";
15 private double labelFontSize = 12;
16 private int axisWidth = 2;
17 private int gridWidth = 1;
18 private int approxNrLabelsX = 5;
19 private int approxNrLabelsY = 10;
20 private int width = 640;
21 private int height = 480;
22 private int marginTop = 10;
23 private int marginBottom = 10;
24 private int marginLeft = 15;
25 private int marginRight = 15;
26 private int marginLabel = 5;
27
32 {
33 }
34
40 {
41 return new GraphSettings()
42 {
43 backgroundColor = this.backgroundColor,
44 axisColor = this.axisColor,
45 gridColor = this.gridColor,
46 fontName = this.fontName,
47 labelFontSize = this.labelFontSize,
48 axisWidth = this.axisWidth,
49 gridWidth = this.gridWidth,
50 approxNrLabelsX = this.approxNrLabelsX,
51 approxNrLabelsY = this.approxNrLabelsY,
52 width = this.width,
53 height = this.height,
54 marginTop = this.marginTop,
55 marginBottom = this.marginBottom,
56 marginLeft = this.marginLeft,
57 marginRight = this.marginRight,
58 marginLabel = this.marginLabel
59 };
60 }
61
65 public int Width
66 {
67 get => this.width;
68 set
69 {
70 if (value < 1)
71 throw new ArgumentOutOfRangeException("Value must be positive.", nameof(this.Width));
72
73 this.width = value;
74 }
75 }
76
80 public int Height
81 {
82 get => this.height;
83 set
84 {
85 if (value < 1)
86 throw new ArgumentOutOfRangeException("Value must be positive.", nameof(this.Height));
87
88 this.height = value;
89 }
90 }
91
95 public SKColor BackgroundColor
96 {
97 get => this.backgroundColor;
98 set => this.backgroundColor = value;
99 }
100
104 public SKColor AxisColor
105 {
106 get => this.axisColor;
107 set => this.axisColor = value;
108 }
109
113 public int AxisWidth
114 {
115 get => this.axisWidth;
116 set
117 {
118 if (value < 0)
119 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.AxisWidth));
120
121 this.axisWidth = value;
122 }
123 }
124
128 public SKColor GridColor
129 {
130 get => this.gridColor;
131 set => this.gridColor = value;
132 }
133
137 public int GridWidth
138 {
139 get => this.gridWidth;
140 set
141 {
142 if (value < 0)
143 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.GridWidth));
144
145 this.gridWidth = value;
146 }
147 }
148
152 public int MarginTop
153 {
154 get => this.marginTop;
155 set
156 {
157 if (value < 0)
158 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.MarginTop));
159
160 this.marginTop = value;
161 }
162 }
163
167 public int MarginBottom
168 {
169 get => this.marginBottom;
170 set
171 {
172 if (value < 0)
173 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.MarginBottom));
174
175 this.marginBottom = value;
176 }
177 }
178
182 public int MarginLeft
183 {
184 get => this.marginLeft;
185 set
186 {
187 if (value < 0)
188 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.MarginLeft));
189
190 this.marginLeft = value;
191 }
192 }
193
197 public int MarginRight
198 {
199 get => this.marginRight;
200 set
201 {
202 if (value < 0)
203 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.MarginRight));
204
205 this.marginRight = value;
206 }
207 }
208
212 public int MarginLabel
213 {
214 get => this.marginLabel;
215 set
216 {
217 if (value < 0)
218 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.MarginLabel));
219
220 this.marginLabel = value;
221 }
222 }
223
227 public string FontName
228 {
229 get => this.fontName;
230 set
231 {
232 if (string.IsNullOrEmpty(value))
233 throw new ArgumentException("Value cannot be empty.", nameof(this.FontName));
234
235 this.fontName = value;
236 }
237 }
238
242 public double LabelFontSize
243 {
244 get => this.labelFontSize;
245 set
246 {
247 if (value < 0)
248 throw new ArgumentOutOfRangeException("Value must be positive.", nameof(this.LabelFontSize));
249
250 this.labelFontSize = value;
251 }
252 }
253
258 {
259 get => this.approxNrLabelsX;
260 set
261 {
262 if (value < 0)
263 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.ApproxNrLabelsX));
264
265 this.approxNrLabelsX = value;
266 }
267 }
268
273 {
274 get => this.approxNrLabelsY;
275 set
276 {
277 if (value < 0)
278 throw new ArgumentOutOfRangeException("Value must be non-negative.", nameof(this.ApproxNrLabelsY));
279
280 this.approxNrLabelsY = value;
281 }
282 }
283
284 }
285}
SKColor BackgroundColor
Background color.
int ApproxNrLabelsY
Approximate number of labels along the Y-axis.
int ApproxNrLabelsX
Approximate number of labels along the X-axis.
double LabelFontSize
Label font size
int Width
Width of graph, in pixels. (Default=640 pixels.)
int Height
Height of graph, in pixels. (Default=480 pixels.)
GraphSettings Copy()
Copies the graph settings.