[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 |
|
---|
[1462] | 84 | model.XAxisLabel = "X Axis";
|
---|
| 85 | model.ShowXAxisLabel = true;
|
---|
| 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]
|
---|
[1607] | 136 | public void SimpleTestAggregator() {
|
---|
[1326] | 137 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 138 |
|
---|
[1607] | 139 | IDataRow row1 = new DataRow { Label = "row", Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
|
---|
[1326] | 140 |
|
---|
| 141 | model.AddDataRow(row1);
|
---|
| 142 |
|
---|
| 143 |
|
---|
[1607] | 144 | MaxAggregator aggregator = new MaxAggregator {
|
---|
| 145 | Label = "MinAggregator",
|
---|
| 146 | Color = Color.Pink,
|
---|
| 147 | Thickness = 5,
|
---|
| 148 | Style = DrawingStyle.Solid,
|
---|
| 149 | LineType = DataRowType.SingleValue
|
---|
| 150 | };
|
---|
[1326] | 151 | aggregator.AddWatch(row1);
|
---|
| 152 |
|
---|
| 153 | model.AddDataRow(aggregator);
|
---|
| 154 |
|
---|
| 155 | row1.AddValue(10);
|
---|
| 156 | row1.AddValue(5);
|
---|
| 157 | row1.AddValue(7);
|
---|
| 158 | row1.AddValue(3);
|
---|
| 159 | row1.AddValue(10);
|
---|
| 160 | row1.AddValue(2);
|
---|
| 161 |
|
---|
| 162 | f.ShowDialog();
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 |
|
---|
| 166 | public class Worker {
|
---|
| 167 | // This method will be called when the thread is started.
|
---|
[1607] | 168 | private readonly ChartDataRowsModel model;
|
---|
| 169 |
|
---|
[1326] | 170 | public Worker(ChartDataRowsModel model) {
|
---|
| 171 | this.model = model;
|
---|
| 172 | }
|
---|
[1607] | 173 |
|
---|
[1386] | 174 | public void DoWorkMultiLine() {
|
---|
[1607] | 175 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 2, Label = "Sinus", Style = DrawingStyle.Solid, ShowMarkers = false };
|
---|
[1326] | 176 | model.AddDataRow(row1);
|
---|
| 177 |
|
---|
[1607] | 178 | IDataRow row2 = new DataRow { Color = Color.Red, Thickness = 3, Label = "Growing", Style = DrawingStyle.Solid, ShowMarkers = false };
|
---|
[1326] | 179 | model.AddDataRow(row2);
|
---|
| 180 |
|
---|
[1607] | 181 | AvgAggregator multiAvgAggregator = new AvgAggregator {
|
---|
| 182 | Label = "MultiAvgAggregator",
|
---|
| 183 | Color = Color.DarkOliveGreen,
|
---|
| 184 | Thickness = 3,
|
---|
| 185 | Style = DrawingStyle.Solid,
|
---|
| 186 | LineType = DataRowType.SingleValue,
|
---|
| 187 | ShowMarkers = false
|
---|
| 188 | };
|
---|
[1326] | 189 | multiAvgAggregator.AddWatch(row1);
|
---|
| 190 | multiAvgAggregator.AddWatch(row2);
|
---|
| 191 | model.AddDataRow(multiAvgAggregator);
|
---|
| 192 |
|
---|
[1607] | 193 | MaxAggregator multiMaxAggregator = new MaxAggregator {
|
---|
| 194 | Label = "MultiMaxAggregator",
|
---|
| 195 | Color = Color.DarkKhaki,
|
---|
| 196 | Thickness = 3,
|
---|
| 197 | Style = DrawingStyle.Solid,
|
---|
| 198 | LineType = DataRowType.SingleValue,
|
---|
| 199 | ShowMarkers = false
|
---|
| 200 | };
|
---|
[1326] | 201 | multiMaxAggregator.AddWatch(row1);
|
---|
| 202 | multiMaxAggregator.AddWatch(row2);
|
---|
| 203 | model.AddDataRow(multiMaxAggregator);
|
---|
| 204 |
|
---|
[1607] | 205 | MinAggregator multiMinAggregator = new MinAggregator {
|
---|
| 206 | Label = "MultiMinAggregator",
|
---|
| 207 | Color = Color.DarkRed,
|
---|
| 208 | Thickness = 3,
|
---|
| 209 | Style = DrawingStyle.Solid,
|
---|
| 210 | LineType = DataRowType.SingleValue,
|
---|
| 211 | ShowMarkers = false
|
---|
| 212 | };
|
---|
[1326] | 213 | multiMinAggregator.AddWatch(row1);
|
---|
| 214 | multiMinAggregator.AddWatch(row2);
|
---|
| 215 | model.AddDataRow(multiMinAggregator);
|
---|
| 216 |
|
---|
[1607] | 217 | // AvgLineAggregator multiLineAvgAggregator = new AvgLineAggregator {
|
---|
| 218 | // Label = "MultiLineAvgAggregator",
|
---|
| 219 | // Color = Color.Red,
|
---|
| 220 | // Thickness = 4,
|
---|
| 221 | // Style = DrawingStyle.Solid,
|
---|
| 222 | // LineType = DataRowType.Normal,
|
---|
| 223 | // ShowMarkers = false
|
---|
| 224 | // };
|
---|
| 225 | // multiLineAvgAggregator.AddWatch(row1);
|
---|
| 226 | // multiLineAvgAggregator.AddWatch(row2);
|
---|
| 227 | // multiLineAvgAggregator.AddValue(0);
|
---|
| 228 | // model.AddDataRow(multiLineAvgAggregator);
|
---|
[1326] | 229 |
|
---|
| 230 | double i = 0;
|
---|
| 231 |
|
---|
[1607] | 232 |
|
---|
[1326] | 233 | while (!_shouldStop && i <= 24) {
|
---|
| 234 | i += 0.2;
|
---|
[1607] | 235 | double newY = Math.Sin(i);
|
---|
| 236 | Console.WriteLine("working");
|
---|
[1326] | 237 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 238 | row1.AddValue(newY * 10);
|
---|
[1607] | 239 | row2.AddValue(i * 2 - 15);
|
---|
| 240 | Thread.Sleep(100);
|
---|
[1326] | 241 | }
|
---|
| 242 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 243 | }
|
---|
[1607] | 244 |
|
---|
[1386] | 245 | public void DoWorkSingleLine() {
|
---|
[1607] | 246 | IDataRow row1 = new DataRow {
|
---|
| 247 | Color = Color.Red,
|
---|
| 248 | Thickness = 2,
|
---|
| 249 | Label = "Sinus",
|
---|
| 250 | Style = DrawingStyle.Solid,
|
---|
| 251 | ShowMarkers = false
|
---|
| 252 | };
|
---|
[1386] | 253 | model.AddDataRow(row1);
|
---|
| 254 |
|
---|
[1607] | 255 | IDataRow row2 = new DataRow {
|
---|
| 256 | Color = Color.Red,
|
---|
| 257 | Thickness = 3,
|
---|
| 258 | Label = "Growing",
|
---|
| 259 | Style = DrawingStyle.Solid,
|
---|
| 260 | ShowMarkers = false
|
---|
| 261 | };
|
---|
[1386] | 262 | model.AddDataRow(row2);
|
---|
| 263 |
|
---|
[1607] | 264 | MinAggregator aggregator = new MinAggregator {
|
---|
| 265 | Label = "MinAggregator",
|
---|
| 266 | Color = Color.Pink,
|
---|
| 267 | Thickness = 3,
|
---|
| 268 | Style = DrawingStyle.Solid,
|
---|
| 269 | LineType = DataRowType.SingleValue
|
---|
| 270 | };
|
---|
[1386] | 271 | aggregator.AddWatch(row1);
|
---|
| 272 | model.AddDataRow(aggregator);
|
---|
| 273 |
|
---|
[1607] | 274 | MaxAggregator maxAggregator = new MaxAggregator {
|
---|
| 275 | Label = "MaxAggregator",
|
---|
| 276 | Color = Color.DeepSkyBlue,
|
---|
| 277 | Thickness = 3,
|
---|
| 278 | Style = DrawingStyle.Solid,
|
---|
| 279 | LineType = DataRowType.SingleValue
|
---|
| 280 | };
|
---|
[1386] | 281 | maxAggregator.AddWatch(row1);
|
---|
| 282 | model.AddDataRow(maxAggregator);
|
---|
| 283 |
|
---|
[1607] | 284 | AvgAggregator avgAggregator = new AvgAggregator {
|
---|
| 285 | Label = "AvgAggregator",
|
---|
| 286 | Color = Color.Violet,
|
---|
| 287 | Thickness = 3,
|
---|
| 288 | Style = DrawingStyle.Solid,
|
---|
| 289 | LineType = DataRowType.SingleValue
|
---|
| 290 | };
|
---|
[1386] | 291 | avgAggregator.AddWatch(row1);
|
---|
| 292 | model.AddDataRow(avgAggregator);
|
---|
| 293 |
|
---|
| 294 | double i = 0;
|
---|
| 295 |
|
---|
[1607] | 296 |
|
---|
| 297 | while (!_shouldStop && i <= 240) {
|
---|
[1386] | 298 | i += 0.2;
|
---|
[1607] | 299 | double newY = Math.Sin(i);
|
---|
| 300 | Console.WriteLine("working");
|
---|
[1386] | 301 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 302 | row1.AddValue(newY * 10);
|
---|
| 303 | row2.AddValue(i * 2 - 15);
|
---|
[1607] | 304 | //System.Threading.Thread.Sleep(100);
|
---|
[1386] | 305 | }
|
---|
| 306 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 307 | }
|
---|
[1607] | 308 |
|
---|
[1386] | 309 | public void DoWorkAvgLine() {
|
---|
[1607] | 310 | IDataRow row1 = new DataRow {
|
---|
| 311 | Color = Color.Red,
|
---|
| 312 | Thickness = 2,
|
---|
| 313 | Label = "Sinus",
|
---|
| 314 | Style = DrawingStyle.Solid,
|
---|
| 315 | ShowMarkers = false
|
---|
| 316 | };
|
---|
[1386] | 317 | model.AddDataRow(row1);
|
---|
| 318 |
|
---|
[1607] | 319 | IDataRow row2 = new DataRow {
|
---|
| 320 | Color = Color.Red,
|
---|
| 321 | Thickness = 3,
|
---|
| 322 | Label = "Growing",
|
---|
| 323 | Style = DrawingStyle.Solid,
|
---|
| 324 | ShowMarkers = false
|
---|
| 325 | };
|
---|
[1386] | 326 | model.AddDataRow(row2);
|
---|
| 327 |
|
---|
[1607] | 328 | AvgLineAggregator avgLineAggregator = new AvgLineAggregator {
|
---|
| 329 | Label = "AvgLineAggregator",
|
---|
| 330 | Color = Color.Violet,
|
---|
| 331 | Thickness = 3,
|
---|
| 332 | Style = DrawingStyle.Solid,
|
---|
| 333 | LineType = DataRowType.Normal,
|
---|
| 334 | ShowMarkers = false
|
---|
| 335 | };
|
---|
[1386] | 336 | avgLineAggregator.AddWatch(row1);
|
---|
| 337 | avgLineAggregator.AddWatch(row2);
|
---|
| 338 | model.AddDataRow(avgLineAggregator);
|
---|
| 339 |
|
---|
| 340 | double i = 0;
|
---|
| 341 |
|
---|
[1607] | 342 | while (!_shouldStop && i <= 240) {
|
---|
[1386] | 343 | i += 0.2;
|
---|
[1607] | 344 | double newY = Math.Sin(i);
|
---|
| 345 | Console.WriteLine("working");
|
---|
[1386] | 346 | //row1.AddValue(rand.NextDouble() * 10);
|
---|
| 347 | row1.AddValue(newY * 10);
|
---|
| 348 | row2.AddValue(i * 2 - 15);
|
---|
[1607] | 349 | //Thread.Sleep(100);
|
---|
[1386] | 350 | }
|
---|
| 351 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 352 | }
|
---|
[1607] | 353 |
|
---|
| 354 | public void DoWorkFloatingAvg() {
|
---|
| 355 | IDataRow row1 = new DataRow {
|
---|
| 356 | Color = Color.Red,
|
---|
| 357 | Thickness = 2,
|
---|
| 358 | Label = "SinusHacked",
|
---|
| 359 | Style = DrawingStyle.Solid,
|
---|
| 360 | ShowMarkers = false
|
---|
| 361 | };
|
---|
| 362 | model.AddDataRow(row1);
|
---|
| 363 |
|
---|
| 364 | IDataRow row2 = new DataRow {
|
---|
| 365 | Color = Color.Red,
|
---|
| 366 | Thickness = 3,
|
---|
| 367 | Label = "GrowingHacked",
|
---|
| 368 | Style = DrawingStyle.Solid,
|
---|
| 369 | ShowMarkers = false
|
---|
| 370 | };
|
---|
| 371 | model.AddDataRow(row2);
|
---|
| 372 |
|
---|
[1818] | 373 | FloatingAvgAggregator avgAggregator = new FloatingAvgAggregator {
|
---|
| 374 | Thickness = 2,
|
---|
| 375 | Label = "floatingAvg",
|
---|
| 376 | Color = Color.Peru,
|
---|
| 377 | ShowMarkers = false,
|
---|
| 378 | Style = DrawingStyle.Solid
|
---|
| 379 | };
|
---|
[1607] | 380 |
|
---|
[1818] | 381 | avgAggregator.AddWatch(row1);
|
---|
| 382 | model.AddDataRow(avgAggregator);
|
---|
[1607] | 383 |
|
---|
[1818] | 384 | FloatingAvgAggregator avgAggregator2 = new FloatingAvgAggregator {
|
---|
| 385 | Thickness = 2,
|
---|
| 386 | Label = "floatingAvg",
|
---|
| 387 | Color = Color.Aqua,
|
---|
| 388 | ShowMarkers = false,
|
---|
| 389 | Style = DrawingStyle.Solid
|
---|
| 390 | };
|
---|
| 391 |
|
---|
| 392 | avgAggregator2.AddWatch(row2);
|
---|
| 393 | model.AddDataRow(avgAggregator2);
|
---|
| 394 |
|
---|
| 395 |
|
---|
[1607] | 396 | double i = 0;
|
---|
| 397 | Random rnd = new Random();
|
---|
| 398 |
|
---|
[1818] | 399 | while (!_shouldStop && i <= 100) {
|
---|
[1607] | 400 | i += 0.2;
|
---|
| 401 | double newY = Math.Sin(i);
|
---|
| 402 |
|
---|
| 403 | double hack = rnd.NextDouble() * i / 10;
|
---|
| 404 | row1.AddValue(newY * 10 + hack);
|
---|
| 405 |
|
---|
| 406 | hack = rnd.NextDouble() * i / 10;
|
---|
| 407 | row2.AddValue(i * 2 - 15 + hack);
|
---|
| 408 | //Thread.Sleep(100);
|
---|
| 409 | }
|
---|
| 410 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 411 | }
|
---|
| 412 |
|
---|
[1326] | 413 | public void RequestStop() {
|
---|
| 414 | _shouldStop = true;
|
---|
| 415 | }
|
---|
[1607] | 416 |
|
---|
[1326] | 417 | // Volatile is used as hint to the compiler that this data
|
---|
| 418 | // member will be accessed by multiple threads.
|
---|
| 419 | private volatile bool _shouldStop;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 |
|
---|
| 423 | [Test]
|
---|
[1386] | 424 | public void TestAggregatorMultiLine() {
|
---|
[1326] | 425 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1386] | 426 |
|
---|
| 427 | // Create the thread object. This does not start the thread.
|
---|
| 428 | Worker workerObject = new Worker(model);
|
---|
| 429 | Thread workerThread = new Thread(workerObject.DoWorkMultiLine);
|
---|
| 430 |
|
---|
| 431 | // Start the worker thread.
|
---|
| 432 | workerThread.Start();
|
---|
| 433 |
|
---|
| 434 | f.ShowDialog();
|
---|
| 435 | workerObject.RequestStop();
|
---|
| 436 | }
|
---|
| 437 |
|
---|
| 438 | [Test]
|
---|
| 439 | public void TestAggregatorSingleLine() {
|
---|
| 440 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 441 | model.Title = "SingleLineAggregator Tests";
|
---|
| 442 |
|
---|
[1326] | 443 | // Create the thread object. This does not start the thread.
|
---|
| 444 | Worker workerObject = new Worker(model);
|
---|
[1386] | 445 | Thread workerThread = new Thread(workerObject.DoWorkSingleLine);
|
---|
[1326] | 446 |
|
---|
| 447 | // Start the worker thread.
|
---|
| 448 | workerThread.Start();
|
---|
| 449 |
|
---|
| 450 | f.ShowDialog();
|
---|
| 451 | workerObject.RequestStop();
|
---|
| 452 | }
|
---|
[1607] | 453 |
|
---|
[1386] | 454 | [Test]
|
---|
| 455 | public void TestAggregatorAvgLine() {
|
---|
| 456 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 457 | model.Title = "AvgLineTest";
|
---|
[1326] | 458 |
|
---|
[1386] | 459 | // Create the thread object. This does not start the thread.
|
---|
| 460 | Worker workerObject = new Worker(model);
|
---|
| 461 | Thread workerThread = new Thread(workerObject.DoWorkAvgLine);
|
---|
| 462 |
|
---|
| 463 | // Start the worker thread.
|
---|
| 464 | workerThread.Start();
|
---|
| 465 |
|
---|
| 466 | f.ShowDialog();
|
---|
| 467 | workerObject.RequestStop();
|
---|
| 468 | }
|
---|
| 469 |
|
---|
[1607] | 470 | [Test]
|
---|
| 471 | public void TestFloatingAvg() {
|
---|
| 472 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 473 | model.Title = "FloatingAvg Test";
|
---|
| 474 | model.ViewSettings.LegendPosition = Legend.LegendPosition.Top;
|
---|
[1326] | 475 |
|
---|
[1607] | 476 | // Create the thread object. This does not start the thread.
|
---|
| 477 | Worker workerObject = new Worker(model);
|
---|
| 478 | Thread workerThread = new Thread(workerObject.DoWorkFloatingAvg);
|
---|
| 479 |
|
---|
| 480 | // Start the worker thread.
|
---|
| 481 | workerThread.Start();
|
---|
| 482 |
|
---|
| 483 | f.ShowDialog();
|
---|
| 484 | workerObject.RequestStop();
|
---|
| 485 | }
|
---|
| 486 |
|
---|
| 487 |
|
---|
[1326] | 488 | [Test]
|
---|
[1040] | 489 | public void TestAutoZoomInConstructor() {
|
---|
[1607] | 490 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
|
---|
[1040] | 491 |
|
---|
| 492 | model.AddDataRow(row1);
|
---|
| 493 |
|
---|
| 494 | row1.AddValue(10);
|
---|
| 495 | row1.AddValue(5);
|
---|
| 496 | row1.AddValue(7);
|
---|
| 497 | row1.AddValue(3);
|
---|
| 498 | row1.AddValue(10);
|
---|
| 499 | row1.AddValue(2);
|
---|
| 500 |
|
---|
| 501 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 502 | f.ShowDialog();
|
---|
| 503 | }
|
---|
[1240] | 504 |
|
---|
[1243] | 505 |
|
---|
[1240] | 506 | [Test]
|
---|
[1243] | 507 | public void TestSingleValueDataRows() {
|
---|
| 508 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 509 |
|
---|
| 510 | IDataRow row1 = new DataRow();
|
---|
| 511 | IDataRow row2 = new DataRow();
|
---|
| 512 | IDataRow row3 = new DataRow();
|
---|
| 513 |
|
---|
[1342] | 514 | IDataRow row4 = new DataRow();
|
---|
| 515 | IDataRow row5 = new DataRow();
|
---|
| 516 | IDataRow row6 = new DataRow();
|
---|
| 517 |
|
---|
[1243] | 518 | row1.Color = Color.Red;
|
---|
| 519 | row2.Color = Color.Green;
|
---|
| 520 | row3.Color = Color.Blue;
|
---|
| 521 |
|
---|
[1342] | 522 | row4.Color = Color.DeepPink;
|
---|
| 523 | row5.Color = Color.Firebrick;
|
---|
| 524 | row6.Color = Color.DarkSlateGray;
|
---|
| 525 |
|
---|
[1243] | 526 | row1.Thickness = 3;
|
---|
| 527 | row2.Thickness = 4;
|
---|
| 528 | row3.Thickness = 5;
|
---|
| 529 |
|
---|
[1342] | 530 | row4.Thickness = 3;
|
---|
| 531 | row5.Thickness = 4;
|
---|
| 532 | row6.Thickness = 5;
|
---|
| 533 |
|
---|
[1243] | 534 | row1.Label = "SingleValue";
|
---|
| 535 | row2.Label = "Gertschi";
|
---|
| 536 | row3.Label = "Maxi";
|
---|
| 537 |
|
---|
[1342] | 538 | row4.Label = "Simon";
|
---|
| 539 | row5.Label = "klausmuellerwesternhagenunddierasperies";
|
---|
| 540 | row6.Label = "anyways";
|
---|
| 541 |
|
---|
[1243] | 542 | row1.Style = DrawingStyle.Solid;
|
---|
| 543 | row2.Style = DrawingStyle.Solid;
|
---|
| 544 | row3.Style = DrawingStyle.Dashed;
|
---|
| 545 |
|
---|
[1342] | 546 | row4.Style = DrawingStyle.Solid;
|
---|
| 547 | row5.Style = DrawingStyle.Solid;
|
---|
| 548 | row6.Style = DrawingStyle.Dashed;
|
---|
| 549 |
|
---|
[1243] | 550 | row1.LineType = DataRowType.SingleValue;
|
---|
| 551 | row2.LineType = DataRowType.SingleValue;
|
---|
| 552 | row1.AddValue(12);
|
---|
| 553 |
|
---|
| 554 | row2.AddValue(5);
|
---|
| 555 |
|
---|
[1607] | 556 |
|
---|
[1243] | 557 | row3.AddValue(2);
|
---|
| 558 | row3.AddValue(5);
|
---|
| 559 | row3.AddValue(9);
|
---|
| 560 | row3.AddValue(1);
|
---|
| 561 | row3.AddValue(3);
|
---|
| 562 |
|
---|
| 563 |
|
---|
[1342] | 564 | row4.AddValue(10);
|
---|
| 565 | row5.AddValue(11);
|
---|
| 566 | row6.AddValue(11);
|
---|
[1243] | 567 |
|
---|
[1342] | 568 | model.AddDataRow(row1);
|
---|
| 569 | model.AddDataRow(row2);
|
---|
| 570 | model.AddDataRow(row3);
|
---|
| 571 | model.AddDataRow(row4);
|
---|
| 572 | model.AddDataRow(row5);
|
---|
| 573 | model.AddDataRow(row6);
|
---|
| 574 |
|
---|
[1243] | 575 | f.ShowDialog();
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | [Test]
|
---|
[1240] | 579 | public void TestMainForm() {
|
---|
| 580 | MainForm f = new MainForm();
|
---|
| 581 | f.ShowDialog();
|
---|
| 582 | }
|
---|
[861] | 583 | }
|
---|
[1607] | 584 | } |
---|