[983] | 1 | using System;
|
---|
[869] | 2 | using System.Drawing;
|
---|
[1326] | 3 | using System.Threading;
|
---|
[861] | 4 | using NUnit.Framework;
|
---|
| 5 |
|
---|
| 6 | namespace HeuristicLab.Visualization.Test {
|
---|
| 7 | [TestFixture]
|
---|
| 8 | public class LineChartTests {
|
---|
[1038] | 9 | private ChartDataRowsModel model;
|
---|
| 10 |
|
---|
| 11 | [SetUp]
|
---|
| 12 | public void SetUp() {
|
---|
| 13 | model = new ChartDataRowsModel();
|
---|
| 14 | }
|
---|
| 15 |
|
---|
[861] | 16 | [Test]
|
---|
| 17 | public void TestLineChart() {
|
---|
[1038] | 18 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[861] | 19 |
|
---|
[869] | 20 | IDataRow row1 = new DataRow();
|
---|
| 21 | IDataRow row2 = new DataRow();
|
---|
| 22 | IDataRow row3 = new DataRow();
|
---|
[861] | 23 |
|
---|
[869] | 24 | row1.Color = Color.Red;
|
---|
| 25 | row2.Color = Color.Green;
|
---|
| 26 | row3.Color = Color.Blue;
|
---|
[861] | 27 |
|
---|
[869] | 28 | row1.Thickness = 3;
|
---|
| 29 | row2.Thickness = 4;
|
---|
| 30 | row3.Thickness = 5;
|
---|
| 31 |
|
---|
[1049] | 32 | row1.Label = "Simon";
|
---|
| 33 | row2.Label = "Gertschi";
|
---|
| 34 | row3.Label = "Maxi";
|
---|
| 35 |
|
---|
[980] | 36 | row1.Style = DrawingStyle.Solid;
|
---|
| 37 | row2.Style = DrawingStyle.Solid;
|
---|
| 38 | row3.Style = DrawingStyle.Dashed;
|
---|
| 39 |
|
---|
[1607] | 40 |
|
---|
[1038] | 41 | model.AddDataRow(row1);
|
---|
| 42 | model.AddDataRow(row2);
|
---|
| 43 | model.AddDataRow(row3);
|
---|
[869] | 44 |
|
---|
| 45 | row1.AddValue(10);
|
---|
| 46 | row1.AddValue(5);
|
---|
| 47 | row1.AddValue(7);
|
---|
| 48 | row1.AddValue(3);
|
---|
| 49 | row1.AddValue(10);
|
---|
| 50 | row1.AddValue(2);
|
---|
| 51 |
|
---|
| 52 | row2.AddValue(5);
|
---|
| 53 | row2.AddValue(6);
|
---|
| 54 | row2.AddValue(5);
|
---|
| 55 |
|
---|
| 56 | row3.AddValue(2);
|
---|
| 57 | row3.AddValue(2);
|
---|
| 58 | row3.AddValue(2);
|
---|
| 59 | row3.AddValue(2);
|
---|
| 60 | row3.AddValue(2);
|
---|
| 61 |
|
---|
[983] | 62 | Random rand = new Random();
|
---|
| 63 |
|
---|
[1038] | 64 | for (int i = 0; i < 10000; i++) {
|
---|
[1607] | 65 | row1.AddValue(rand.NextDouble() * 10);
|
---|
| 66 | row2.AddValue(rand.NextDouble() * 10);
|
---|
| 67 | row3.AddValue(rand.NextDouble() * 10);
|
---|
[983] | 68 | }
|
---|
| 69 |
|
---|
[861] | 70 | f.ShowDialog();
|
---|
| 71 | }
|
---|
[1607] | 72 |
|
---|
[983] | 73 | [Test]
|
---|
| 74 | public void TestAxes() {
|
---|
[1038] | 75 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[983] | 76 |
|
---|
| 77 | IDataRow row1 = new DataRow();
|
---|
[1285] | 78 | IDataRow row2 = new DataRow();
|
---|
[1350] | 79 | IDataRow row3 = new DataRow();
|
---|
[983] | 80 |
|
---|
[1387] | 81 | YAxisDescriptor yaxis1 = model.DefaultYAxis;
|
---|
| 82 | YAxisDescriptor yaxis2 = new YAxisDescriptor();
|
---|
| 83 |
|
---|
[1881] | 84 | model.XAxis.Label = "X Axis";
|
---|
| 85 | model.XAxis.ShowLabel = true;
|
---|
[1462] | 86 |
|
---|
[1387] | 87 | yaxis1.Label = "Y-Axis 1";
|
---|
[1462] | 88 | yaxis1.ShowYAxisLabel = true;
|
---|
| 89 | yaxis1.Position = AxisPosition.Left;
|
---|
| 90 | yaxis1.ShowGrid = true;
|
---|
| 91 | yaxis1.GridColor = Color.Gray;
|
---|
| 92 |
|
---|
[1387] | 93 | yaxis2.Label = "Y-Axis 2";
|
---|
[1462] | 94 | yaxis2.ShowYAxisLabel = true;
|
---|
[1457] | 95 | yaxis2.Position = AxisPosition.Right;
|
---|
[1458] | 96 | yaxis2.ShowGrid = false;
|
---|
| 97 |
|
---|
[983] | 98 | row1.Color = Color.Red;
|
---|
| 99 | row1.Thickness = 3;
|
---|
| 100 | row1.Style = DrawingStyle.Solid;
|
---|
[1343] | 101 | row1.Label = "Die Rote";
|
---|
[983] | 102 |
|
---|
[1285] | 103 | row2.Color = Color.Green;
|
---|
| 104 | row2.Thickness = 3;
|
---|
| 105 | row2.Style = DrawingStyle.Solid;
|
---|
[1343] | 106 | row2.Label = "Die Grüne";
|
---|
[1285] | 107 |
|
---|
[1350] | 108 | row3.Color = Color.Blue;
|
---|
| 109 | row3.Thickness = 3;
|
---|
| 110 | row3.Style = DrawingStyle.Solid;
|
---|
| 111 | row3.Label = "Die Blaue";
|
---|
[1387] | 112 | row3.YAxis = yaxis2;
|
---|
[1350] | 113 |
|
---|
[1038] | 114 | model.AddDataRow(row1);
|
---|
[1285] | 115 | model.AddDataRow(row2);
|
---|
[1350] | 116 | model.AddDataRow(row3);
|
---|
[983] | 117 |
|
---|
[1285] | 118 | Random rand = new Random(42);
|
---|
[1350] | 119 |
|
---|
[1285] | 120 | for (int i = 0; i < 10; i++) {
|
---|
[1607] | 121 | row1.AddValue(rand.NextDouble() * 10);
|
---|
| 122 | row2.AddValue(rand.NextDouble() * 10);
|
---|
| 123 | row3.AddValue(rand.NextDouble() * 1);
|
---|
[1285] | 124 | }
|
---|
[983] | 125 |
|
---|
[1350] | 126 | f.AddValue += delegate {
|
---|
[1607] | 127 | row1.AddValue(rand.NextDouble() * 10);
|
---|
| 128 | row2.AddValue(rand.NextDouble() * 10);
|
---|
| 129 | row3.AddValue(rand.NextDouble() * 1);
|
---|
[1350] | 130 | };
|
---|
| 131 |
|
---|
[983] | 132 | f.ShowDialog();
|
---|
| 133 | }
|
---|
[1040] | 134 |
|
---|
| 135 | [Test]
|
---|
[1876] | 136 | public void TestGridX() {
|
---|
| 137 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 138 | IDataRow row1 = new DataRow();
|
---|
| 139 | model.AddDataRow(row1);
|
---|
| 140 |
|
---|
[1881] | 141 | model.XAxis.ShowGrid = false;
|
---|
[1876] | 142 |
|
---|
| 143 | Random rand = new Random(42);
|
---|
| 144 | for (int i = 0; i < 10; i++) {
|
---|
| 145 | row1.AddValue(rand.NextDouble() * 10);
|
---|
| 146 | }
|
---|
| 147 | f.ShowDialog();
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | [Test]
|
---|
[1607] | 151 | public void SimpleTestAggregator() {
|
---|
[1326] | 152 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 153 |
|
---|
[1607] | 154 | IDataRow row1 = new DataRow { Label = "row", Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
|
---|
[1326] | 155 |
|
---|
| 156 | model.AddDataRow(row1);
|
---|
| 157 |
|
---|
| 158 |
|
---|
[1607] | 159 | MaxAggregator aggregator = new MaxAggregator {
|
---|
| 160 | Label = "MinAggregator",
|
---|
| 161 | Color = Color.Pink,
|
---|
| 162 | Thickness = 5,
|
---|
| 163 | Style = DrawingStyle.Solid,
|
---|
| 164 | LineType = DataRowType.SingleValue
|
---|
| 165 | };
|
---|
[1326] | 166 | aggregator.AddWatch(row1);
|
---|
| 167 |
|
---|
| 168 | model.AddDataRow(aggregator);
|
---|
| 169 |
|
---|
| 170 | row1.AddValue(10);
|
---|
| 171 | row1.AddValue(5);
|
---|
| 172 | row1.AddValue(7);
|
---|
| 173 | row1.AddValue(3);
|
---|
| 174 | row1.AddValue(10);
|
---|
| 175 | row1.AddValue(2);
|
---|
| 176 |
|
---|
| 177 | f.ShowDialog();
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 |
|
---|
| 181 | public class Worker {
|
---|
| 182 | // This method will be called when the thread is started.
|
---|
[1607] | 183 | private readonly ChartDataRowsModel model;
|
---|
| 184 |
|
---|
[1326] | 185 | public Worker(ChartDataRowsModel model) {
|
---|
| 186 | this.model = model;
|
---|
| 187 | }
|
---|
[1607] | 188 |
|
---|
[1386] | 189 | public void DoWorkMultiLine() {
|
---|
[1607] | 190 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 2, Label = "Sinus", Style = DrawingStyle.Solid, ShowMarkers = false };
|
---|
[1326] | 191 | model.AddDataRow(row1);
|
---|
| 192 |
|
---|
[1607] | 193 | IDataRow row2 = new DataRow { Color = Color.Red, Thickness = 3, Label = "Growing", Style = DrawingStyle.Solid, ShowMarkers = false };
|
---|
[1326] | 194 | model.AddDataRow(row2);
|
---|
| 195 |
|
---|
[1607] | 196 | AvgAggregator multiAvgAggregator = new AvgAggregator {
|
---|
| 197 | Label = "MultiAvgAggregator",
|
---|
| 198 | Color = Color.DarkOliveGreen,
|
---|
| 199 | Thickness = 3,
|
---|
| 200 | Style = DrawingStyle.Solid,
|
---|
| 201 | LineType = DataRowType.SingleValue,
|
---|
| 202 | ShowMarkers = false
|
---|
| 203 | };
|
---|
[1326] | 204 | multiAvgAggregator.AddWatch(row1);
|
---|
| 205 | multiAvgAggregator.AddWatch(row2);
|
---|
| 206 | model.AddDataRow(multiAvgAggregator);
|
---|
| 207 |
|
---|
[1607] | 208 | MaxAggregator multiMaxAggregator = new MaxAggregator {
|
---|
| 209 | Label = "MultiMaxAggregator",
|
---|
| 210 | Color = Color.DarkKhaki,
|
---|
| 211 | Thickness = 3,
|
---|
| 212 | Style = DrawingStyle.Solid,
|
---|
| 213 | LineType = DataRowType.SingleValue,
|
---|
| 214 | ShowMarkers = false
|
---|
| 215 | };
|
---|
[1326] | 216 | multiMaxAggregator.AddWatch(row1);
|
---|
| 217 | multiMaxAggregator.AddWatch(row2);
|
---|
| 218 | model.AddDataRow(multiMaxAggregator);
|
---|
| 219 |
|
---|
[1607] | 220 | MinAggregator multiMinAggregator = new MinAggregator {
|
---|
| 221 | Label = "MultiMinAggregator",
|
---|
| 222 | Color = Color.DarkRed,
|
---|
| 223 | Thickness = 3,
|
---|
| 224 | Style = DrawingStyle.Solid,
|
---|
| 225 | LineType = DataRowType.SingleValue,
|
---|
| 226 | ShowMarkers = false
|
---|
| 227 | };
|
---|
[1326] | 228 | multiMinAggregator.AddWatch(row1);
|
---|
| 229 | multiMinAggregator.AddWatch(row2);
|
---|
| 230 | model.AddDataRow(multiMinAggregator);
|
---|
| 231 |
|
---|
[1607] | 232 | // AvgLineAggregator multiLineAvgAggregator = new AvgLineAggregator {
|
---|
| 233 | // Label = "MultiLineAvgAggregator",
|
---|
| 234 | // Color = Color.Red,
|
---|
| 235 | // Thickness = 4,
|
---|
| 236 | // Style = DrawingStyle.Solid,
|
---|
| 237 | // LineType = DataRowType.Normal,
|
---|
| 238 | // ShowMarkers = false
|
---|
| 239 | // };
|
---|
| 240 | // multiLineAvgAggregator.AddWatch(row1);
|
---|
| 241 | // multiLineAvgAggregator.AddWatch(row2);
|
---|
| 242 | // multiLineAvgAggregator.AddValue(0);
|
---|
| 243 | // model.AddDataRow(multiLineAvgAggregator);
|
---|
[1326] | 244 |
|
---|
| 245 | double i = 0;
|
---|
| 246 |
|
---|
[1607] | 247 |
|
---|
[1326] | 248 | while (!_shouldStop && i <= 24) {
|
---|
| 249 | i += 0.2;
|
---|
[1607] | 250 | double newY = Math.Sin(i);
|
---|
| 251 | Console.WriteLine("working");
|
---|
[1326] | 252 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 253 | row1.AddValue(newY * 10);
|
---|
[1607] | 254 | row2.AddValue(i * 2 - 15);
|
---|
| 255 | Thread.Sleep(100);
|
---|
[1326] | 256 | }
|
---|
| 257 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 258 | }
|
---|
[1607] | 259 |
|
---|
[1386] | 260 | public void DoWorkSingleLine() {
|
---|
[1607] | 261 | IDataRow row1 = new DataRow {
|
---|
| 262 | Color = Color.Red,
|
---|
| 263 | Thickness = 2,
|
---|
| 264 | Label = "Sinus",
|
---|
| 265 | Style = DrawingStyle.Solid,
|
---|
| 266 | ShowMarkers = false
|
---|
| 267 | };
|
---|
[1386] | 268 | model.AddDataRow(row1);
|
---|
| 269 |
|
---|
[1607] | 270 | IDataRow row2 = new DataRow {
|
---|
| 271 | Color = Color.Red,
|
---|
| 272 | Thickness = 3,
|
---|
| 273 | Label = "Growing",
|
---|
| 274 | Style = DrawingStyle.Solid,
|
---|
| 275 | ShowMarkers = false
|
---|
| 276 | };
|
---|
[1386] | 277 | model.AddDataRow(row2);
|
---|
| 278 |
|
---|
[1607] | 279 | MinAggregator aggregator = new MinAggregator {
|
---|
| 280 | Label = "MinAggregator",
|
---|
| 281 | Color = Color.Pink,
|
---|
| 282 | Thickness = 3,
|
---|
| 283 | Style = DrawingStyle.Solid,
|
---|
| 284 | LineType = DataRowType.SingleValue
|
---|
| 285 | };
|
---|
[1386] | 286 | aggregator.AddWatch(row1);
|
---|
| 287 | model.AddDataRow(aggregator);
|
---|
| 288 |
|
---|
[1607] | 289 | MaxAggregator maxAggregator = new MaxAggregator {
|
---|
| 290 | Label = "MaxAggregator",
|
---|
| 291 | Color = Color.DeepSkyBlue,
|
---|
| 292 | Thickness = 3,
|
---|
| 293 | Style = DrawingStyle.Solid,
|
---|
| 294 | LineType = DataRowType.SingleValue
|
---|
| 295 | };
|
---|
[1386] | 296 | maxAggregator.AddWatch(row1);
|
---|
| 297 | model.AddDataRow(maxAggregator);
|
---|
| 298 |
|
---|
[1607] | 299 | AvgAggregator avgAggregator = new AvgAggregator {
|
---|
| 300 | Label = "AvgAggregator",
|
---|
| 301 | Color = Color.Violet,
|
---|
| 302 | Thickness = 3,
|
---|
| 303 | Style = DrawingStyle.Solid,
|
---|
| 304 | LineType = DataRowType.SingleValue
|
---|
| 305 | };
|
---|
[1386] | 306 | avgAggregator.AddWatch(row1);
|
---|
| 307 | model.AddDataRow(avgAggregator);
|
---|
| 308 |
|
---|
| 309 | double i = 0;
|
---|
| 310 |
|
---|
[1607] | 311 |
|
---|
| 312 | while (!_shouldStop && i <= 240) {
|
---|
[1386] | 313 | i += 0.2;
|
---|
[1607] | 314 | double newY = Math.Sin(i);
|
---|
| 315 | Console.WriteLine("working");
|
---|
[1386] | 316 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 317 | row1.AddValue(newY * 10);
|
---|
| 318 | row2.AddValue(i * 2 - 15);
|
---|
[1607] | 319 | //System.Threading.Thread.Sleep(100);
|
---|
[1386] | 320 | }
|
---|
| 321 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 322 | }
|
---|
[1607] | 323 |
|
---|
[1386] | 324 | public void DoWorkAvgLine() {
|
---|
[1607] | 325 | IDataRow row1 = new DataRow {
|
---|
| 326 | Color = Color.Red,
|
---|
| 327 | Thickness = 2,
|
---|
| 328 | Label = "Sinus",
|
---|
| 329 | Style = DrawingStyle.Solid,
|
---|
| 330 | ShowMarkers = false
|
---|
| 331 | };
|
---|
[1386] | 332 | model.AddDataRow(row1);
|
---|
| 333 |
|
---|
[1607] | 334 | IDataRow row2 = new DataRow {
|
---|
| 335 | Color = Color.Red,
|
---|
| 336 | Thickness = 3,
|
---|
| 337 | Label = "Growing",
|
---|
| 338 | Style = DrawingStyle.Solid,
|
---|
| 339 | ShowMarkers = false
|
---|
| 340 | };
|
---|
[1386] | 341 | model.AddDataRow(row2);
|
---|
| 342 |
|
---|
[1607] | 343 | AvgLineAggregator avgLineAggregator = new AvgLineAggregator {
|
---|
| 344 | Label = "AvgLineAggregator",
|
---|
| 345 | Color = Color.Violet,
|
---|
| 346 | Thickness = 3,
|
---|
| 347 | Style = DrawingStyle.Solid,
|
---|
| 348 | LineType = DataRowType.Normal,
|
---|
| 349 | ShowMarkers = false
|
---|
| 350 | };
|
---|
[1386] | 351 | avgLineAggregator.AddWatch(row1);
|
---|
| 352 | avgLineAggregator.AddWatch(row2);
|
---|
| 353 | model.AddDataRow(avgLineAggregator);
|
---|
| 354 |
|
---|
| 355 | double i = 0;
|
---|
| 356 |
|
---|
[1607] | 357 | while (!_shouldStop && i <= 240) {
|
---|
[1386] | 358 | i += 0.2;
|
---|
[1607] | 359 | double newY = Math.Sin(i);
|
---|
| 360 | Console.WriteLine("working");
|
---|
[1386] | 361 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 362 | row1.AddValue(newY * 10);
|
---|
| 363 | row2.AddValue(i * 2 - 15);
|
---|
[1607] | 364 | //Thread.Sleep(100);
|
---|
[1386] | 365 | }
|
---|
| 366 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 367 | }
|
---|
[1607] | 368 |
|
---|
| 369 | public void DoWorkFloatingAvg() {
|
---|
| 370 | IDataRow row1 = new DataRow {
|
---|
| 371 | Color = Color.Red,
|
---|
| 372 | Thickness = 2,
|
---|
| 373 | Label = "SinusHacked",
|
---|
| 374 | Style = DrawingStyle.Solid,
|
---|
| 375 | ShowMarkers = false
|
---|
| 376 | };
|
---|
| 377 | model.AddDataRow(row1);
|
---|
| 378 |
|
---|
| 379 | IDataRow row2 = new DataRow {
|
---|
| 380 | Color = Color.Red,
|
---|
| 381 | Thickness = 3,
|
---|
| 382 | Label = "GrowingHacked",
|
---|
| 383 | Style = DrawingStyle.Solid,
|
---|
| 384 | ShowMarkers = false
|
---|
| 385 | };
|
---|
| 386 | model.AddDataRow(row2);
|
---|
| 387 |
|
---|
[1818] | 388 | FloatingAvgAggregator avgAggregator = new FloatingAvgAggregator {
|
---|
| 389 | Thickness = 2,
|
---|
| 390 | Label = "floatingAvg",
|
---|
| 391 | Color = Color.Peru,
|
---|
| 392 | ShowMarkers = false,
|
---|
| 393 | Style = DrawingStyle.Solid
|
---|
| 394 | };
|
---|
[1607] | 395 |
|
---|
[1818] | 396 | avgAggregator.AddWatch(row1);
|
---|
| 397 | model.AddDataRow(avgAggregator);
|
---|
[1607] | 398 |
|
---|
[1818] | 399 | FloatingAvgAggregator avgAggregator2 = new FloatingAvgAggregator {
|
---|
| 400 | Thickness = 2,
|
---|
| 401 | Label = "floatingAvg",
|
---|
| 402 | Color = Color.Aqua,
|
---|
| 403 | ShowMarkers = false,
|
---|
| 404 | Style = DrawingStyle.Solid
|
---|
| 405 | };
|
---|
| 406 |
|
---|
| 407 | avgAggregator2.AddWatch(row2);
|
---|
| 408 | model.AddDataRow(avgAggregator2);
|
---|
| 409 |
|
---|
| 410 |
|
---|
[1607] | 411 | double i = 0;
|
---|
| 412 | Random rnd = new Random();
|
---|
| 413 |
|
---|
[1818] | 414 | while (!_shouldStop && i <= 100) {
|
---|
[1607] | 415 | i += 0.2;
|
---|
| 416 | double newY = Math.Sin(i);
|
---|
| 417 |
|
---|
| 418 | double hack = rnd.NextDouble() * i / 10;
|
---|
| 419 | row1.AddValue(newY * 10 + hack);
|
---|
| 420 |
|
---|
| 421 | hack = rnd.NextDouble() * i / 10;
|
---|
| 422 | row2.AddValue(i * 2 - 15 + hack);
|
---|
| 423 | //Thread.Sleep(100);
|
---|
| 424 | }
|
---|
| 425 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 426 | }
|
---|
| 427 |
|
---|
[1326] | 428 | public void RequestStop() {
|
---|
| 429 | _shouldStop = true;
|
---|
| 430 | }
|
---|
[1607] | 431 |
|
---|
[1326] | 432 | // Volatile is used as hint to the compiler that this data
|
---|
| 433 | // member will be accessed by multiple threads.
|
---|
| 434 | private volatile bool _shouldStop;
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 |
|
---|
| 438 | [Test]
|
---|
[1386] | 439 | public void TestAggregatorMultiLine() {
|
---|
[1326] | 440 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1386] | 441 |
|
---|
| 442 | // Create the thread object. This does not start the thread.
|
---|
| 443 | Worker workerObject = new Worker(model);
|
---|
| 444 | Thread workerThread = new Thread(workerObject.DoWorkMultiLine);
|
---|
| 445 |
|
---|
| 446 | // Start the worker thread.
|
---|
| 447 | workerThread.Start();
|
---|
| 448 |
|
---|
| 449 | f.ShowDialog();
|
---|
| 450 | workerObject.RequestStop();
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | [Test]
|
---|
| 454 | public void TestAggregatorSingleLine() {
|
---|
| 455 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 456 | model.Title = "SingleLineAggregator Tests";
|
---|
| 457 |
|
---|
[1326] | 458 | // Create the thread object. This does not start the thread.
|
---|
| 459 | Worker workerObject = new Worker(model);
|
---|
[1386] | 460 | Thread workerThread = new Thread(workerObject.DoWorkSingleLine);
|
---|
[1326] | 461 |
|
---|
| 462 | // Start the worker thread.
|
---|
| 463 | workerThread.Start();
|
---|
| 464 |
|
---|
| 465 | f.ShowDialog();
|
---|
| 466 | workerObject.RequestStop();
|
---|
| 467 | }
|
---|
[1607] | 468 |
|
---|
[1386] | 469 | [Test]
|
---|
| 470 | public void TestAggregatorAvgLine() {
|
---|
| 471 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 472 | model.Title = "AvgLineTest";
|
---|
[1326] | 473 |
|
---|
[1386] | 474 | // Create the thread object. This does not start the thread.
|
---|
| 475 | Worker workerObject = new Worker(model);
|
---|
| 476 | Thread workerThread = new Thread(workerObject.DoWorkAvgLine);
|
---|
| 477 |
|
---|
| 478 | // Start the worker thread.
|
---|
| 479 | workerThread.Start();
|
---|
| 480 |
|
---|
| 481 | f.ShowDialog();
|
---|
| 482 | workerObject.RequestStop();
|
---|
| 483 | }
|
---|
| 484 |
|
---|
[1607] | 485 | [Test]
|
---|
| 486 | public void TestFloatingAvg() {
|
---|
| 487 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 488 | model.Title = "FloatingAvg Test";
|
---|
| 489 | model.ViewSettings.LegendPosition = Legend.LegendPosition.Top;
|
---|
[1326] | 490 |
|
---|
[1607] | 491 | // Create the thread object. This does not start the thread.
|
---|
| 492 | Worker workerObject = new Worker(model);
|
---|
| 493 | Thread workerThread = new Thread(workerObject.DoWorkFloatingAvg);
|
---|
| 494 |
|
---|
| 495 | // Start the worker thread.
|
---|
| 496 | workerThread.Start();
|
---|
| 497 |
|
---|
| 498 | f.ShowDialog();
|
---|
| 499 | workerObject.RequestStop();
|
---|
| 500 | }
|
---|
| 501 |
|
---|
| 502 |
|
---|
[1326] | 503 | [Test]
|
---|
[1040] | 504 | public void TestAutoZoomInConstructor() {
|
---|
[1607] | 505 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
|
---|
[1040] | 506 |
|
---|
| 507 | model.AddDataRow(row1);
|
---|
| 508 |
|
---|
| 509 | row1.AddValue(10);
|
---|
| 510 | row1.AddValue(5);
|
---|
| 511 | row1.AddValue(7);
|
---|
| 512 | row1.AddValue(3);
|
---|
| 513 | row1.AddValue(10);
|
---|
| 514 | row1.AddValue(2);
|
---|
| 515 |
|
---|
| 516 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 517 | f.ShowDialog();
|
---|
| 518 | }
|
---|
[1240] | 519 |
|
---|
[1243] | 520 |
|
---|
[1240] | 521 | [Test]
|
---|
[1243] | 522 | public void TestSingleValueDataRows() {
|
---|
| 523 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 524 |
|
---|
| 525 | IDataRow row1 = new DataRow();
|
---|
| 526 | IDataRow row2 = new DataRow();
|
---|
| 527 | IDataRow row3 = new DataRow();
|
---|
| 528 |
|
---|
[1342] | 529 | IDataRow row4 = new DataRow();
|
---|
| 530 | IDataRow row5 = new DataRow();
|
---|
| 531 | IDataRow row6 = new DataRow();
|
---|
| 532 |
|
---|
[1243] | 533 | row1.Color = Color.Red;
|
---|
| 534 | row2.Color = Color.Green;
|
---|
| 535 | row3.Color = Color.Blue;
|
---|
| 536 |
|
---|
[1342] | 537 | row4.Color = Color.DeepPink;
|
---|
| 538 | row5.Color = Color.Firebrick;
|
---|
| 539 | row6.Color = Color.DarkSlateGray;
|
---|
| 540 |
|
---|
[1243] | 541 | row1.Thickness = 3;
|
---|
| 542 | row2.Thickness = 4;
|
---|
| 543 | row3.Thickness = 5;
|
---|
| 544 |
|
---|
[1342] | 545 | row4.Thickness = 3;
|
---|
| 546 | row5.Thickness = 4;
|
---|
| 547 | row6.Thickness = 5;
|
---|
| 548 |
|
---|
[1243] | 549 | row1.Label = "SingleValue";
|
---|
| 550 | row2.Label = "Gertschi";
|
---|
| 551 | row3.Label = "Maxi";
|
---|
| 552 |
|
---|
[1342] | 553 | row4.Label = "Simon";
|
---|
| 554 | row5.Label = "klausmuellerwesternhagenunddierasperies";
|
---|
| 555 | row6.Label = "anyways";
|
---|
| 556 |
|
---|
[1243] | 557 | row1.Style = DrawingStyle.Solid;
|
---|
| 558 | row2.Style = DrawingStyle.Solid;
|
---|
| 559 | row3.Style = DrawingStyle.Dashed;
|
---|
| 560 |
|
---|
[1342] | 561 | row4.Style = DrawingStyle.Solid;
|
---|
| 562 | row5.Style = DrawingStyle.Solid;
|
---|
| 563 | row6.Style = DrawingStyle.Dashed;
|
---|
| 564 |
|
---|
[1243] | 565 | row1.LineType = DataRowType.SingleValue;
|
---|
| 566 | row2.LineType = DataRowType.SingleValue;
|
---|
| 567 | row1.AddValue(12);
|
---|
| 568 |
|
---|
| 569 | row2.AddValue(5);
|
---|
| 570 |
|
---|
[1607] | 571 |
|
---|
[1243] | 572 | row3.AddValue(2);
|
---|
| 573 | row3.AddValue(5);
|
---|
| 574 | row3.AddValue(9);
|
---|
| 575 | row3.AddValue(1);
|
---|
| 576 | row3.AddValue(3);
|
---|
| 577 |
|
---|
| 578 |
|
---|
[1342] | 579 | row4.AddValue(10);
|
---|
| 580 | row5.AddValue(11);
|
---|
| 581 | row6.AddValue(11);
|
---|
[1243] | 582 |
|
---|
[1342] | 583 | model.AddDataRow(row1);
|
---|
| 584 | model.AddDataRow(row2);
|
---|
| 585 | model.AddDataRow(row3);
|
---|
| 586 | model.AddDataRow(row4);
|
---|
| 587 | model.AddDataRow(row5);
|
---|
| 588 | model.AddDataRow(row6);
|
---|
| 589 |
|
---|
[1243] | 590 | f.ShowDialog();
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | [Test]
|
---|
[1240] | 594 | public void TestMainForm() {
|
---|
| 595 | MainForm f = new MainForm();
|
---|
| 596 | f.ShowDialog();
|
---|
| 597 | }
|
---|
[1884] | 598 |
|
---|
| 599 |
|
---|
| 600 | [Test]
|
---|
| 601 | public void TestPointLines() {
|
---|
| 602 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 3, Style = DrawingStyle.Dashed };
|
---|
| 603 |
|
---|
| 604 | row1.LineType = DataRowType.Points;
|
---|
| 605 | model.AddDataRow(row1);
|
---|
| 606 |
|
---|
| 607 | row1.AddValue(10);
|
---|
| 608 | row1.AddValue(5);
|
---|
| 609 | row1.AddValue(7);
|
---|
| 610 | row1.AddValue(3);
|
---|
| 611 | row1.AddValue(10);
|
---|
| 612 | row1.AddValue(2);
|
---|
| 613 |
|
---|
| 614 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 615 | f.ShowDialog();
|
---|
| 616 | }
|
---|
| 617 |
|
---|
| 618 |
|
---|
[861] | 619 | }
|
---|
[1607] | 620 | } |
---|