[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 |
|
---|
| 373 | // insert 2 floating avg line aggregators (for each hacked line)
|
---|
| 374 |
|
---|
| 375 | // test floating avg aggregator without visible watcher line
|
---|
| 376 |
|
---|
| 377 | double i = 0;
|
---|
| 378 | Random rnd = new Random();
|
---|
| 379 |
|
---|
| 380 | while (!_shouldStop && i <= 240) {
|
---|
| 381 | i += 0.2;
|
---|
| 382 | double newY = Math.Sin(i);
|
---|
| 383 |
|
---|
| 384 | double hack = rnd.NextDouble() * i / 10;
|
---|
| 385 | row1.AddValue(newY * 10 + hack);
|
---|
| 386 |
|
---|
| 387 | hack = rnd.NextDouble() * i / 10;
|
---|
| 388 | row2.AddValue(i * 2 - 15 + hack);
|
---|
| 389 | //Thread.Sleep(100);
|
---|
| 390 | }
|
---|
| 391 | Console.WriteLine("worker thread: terminating gracefully.");
|
---|
| 392 | }
|
---|
| 393 |
|
---|
[1326] | 394 | public void RequestStop() {
|
---|
| 395 | _shouldStop = true;
|
---|
| 396 | }
|
---|
[1607] | 397 |
|
---|
[1326] | 398 | // Volatile is used as hint to the compiler that this data
|
---|
| 399 | // member will be accessed by multiple threads.
|
---|
| 400 | private volatile bool _shouldStop;
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 |
|
---|
| 404 | [Test]
|
---|
[1386] | 405 | public void TestAggregatorMultiLine() {
|
---|
[1326] | 406 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1386] | 407 |
|
---|
| 408 | // Create the thread object. This does not start the thread.
|
---|
| 409 | Worker workerObject = new Worker(model);
|
---|
| 410 | Thread workerThread = new Thread(workerObject.DoWorkMultiLine);
|
---|
| 411 |
|
---|
| 412 | // Start the worker thread.
|
---|
| 413 | workerThread.Start();
|
---|
| 414 |
|
---|
| 415 | f.ShowDialog();
|
---|
| 416 | workerObject.RequestStop();
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | [Test]
|
---|
| 420 | public void TestAggregatorSingleLine() {
|
---|
| 421 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 422 | model.Title = "SingleLineAggregator Tests";
|
---|
| 423 |
|
---|
[1326] | 424 | // Create the thread object. This does not start the thread.
|
---|
| 425 | Worker workerObject = new Worker(model);
|
---|
[1386] | 426 | Thread workerThread = new Thread(workerObject.DoWorkSingleLine);
|
---|
[1326] | 427 |
|
---|
| 428 | // Start the worker thread.
|
---|
| 429 | workerThread.Start();
|
---|
| 430 |
|
---|
| 431 | f.ShowDialog();
|
---|
| 432 | workerObject.RequestStop();
|
---|
| 433 | }
|
---|
[1607] | 434 |
|
---|
[1386] | 435 | [Test]
|
---|
| 436 | public void TestAggregatorAvgLine() {
|
---|
| 437 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
[1607] | 438 | model.Title = "AvgLineTest";
|
---|
[1326] | 439 |
|
---|
[1386] | 440 | // Create the thread object. This does not start the thread.
|
---|
| 441 | Worker workerObject = new Worker(model);
|
---|
| 442 | Thread workerThread = new Thread(workerObject.DoWorkAvgLine);
|
---|
| 443 |
|
---|
| 444 | // Start the worker thread.
|
---|
| 445 | workerThread.Start();
|
---|
| 446 |
|
---|
| 447 | f.ShowDialog();
|
---|
| 448 | workerObject.RequestStop();
|
---|
| 449 | }
|
---|
| 450 |
|
---|
[1607] | 451 | [Test]
|
---|
| 452 | public void TestFloatingAvg() {
|
---|
| 453 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 454 | model.Title = "FloatingAvg Test";
|
---|
| 455 | model.ViewSettings.LegendPosition = Legend.LegendPosition.Top;
|
---|
[1326] | 456 |
|
---|
[1607] | 457 | // Create the thread object. This does not start the thread.
|
---|
| 458 | Worker workerObject = new Worker(model);
|
---|
| 459 | Thread workerThread = new Thread(workerObject.DoWorkFloatingAvg);
|
---|
| 460 |
|
---|
| 461 | // Start the worker thread.
|
---|
| 462 | workerThread.Start();
|
---|
| 463 |
|
---|
| 464 | f.ShowDialog();
|
---|
| 465 | workerObject.RequestStop();
|
---|
| 466 | }
|
---|
| 467 |
|
---|
| 468 |
|
---|
[1326] | 469 | [Test]
|
---|
[1040] | 470 | public void TestAutoZoomInConstructor() {
|
---|
[1607] | 471 | IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
|
---|
[1040] | 472 |
|
---|
| 473 | model.AddDataRow(row1);
|
---|
| 474 |
|
---|
| 475 | row1.AddValue(10);
|
---|
| 476 | row1.AddValue(5);
|
---|
| 477 | row1.AddValue(7);
|
---|
| 478 | row1.AddValue(3);
|
---|
| 479 | row1.AddValue(10);
|
---|
| 480 | row1.AddValue(2);
|
---|
| 481 |
|
---|
| 482 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 483 | f.ShowDialog();
|
---|
| 484 | }
|
---|
[1240] | 485 |
|
---|
[1243] | 486 |
|
---|
[1240] | 487 | [Test]
|
---|
[1243] | 488 | public void TestSingleValueDataRows() {
|
---|
| 489 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
| 490 |
|
---|
| 491 | IDataRow row1 = new DataRow();
|
---|
| 492 | IDataRow row2 = new DataRow();
|
---|
| 493 | IDataRow row3 = new DataRow();
|
---|
| 494 |
|
---|
[1342] | 495 | IDataRow row4 = new DataRow();
|
---|
| 496 | IDataRow row5 = new DataRow();
|
---|
| 497 | IDataRow row6 = new DataRow();
|
---|
| 498 |
|
---|
[1243] | 499 | row1.Color = Color.Red;
|
---|
| 500 | row2.Color = Color.Green;
|
---|
| 501 | row3.Color = Color.Blue;
|
---|
| 502 |
|
---|
[1342] | 503 | row4.Color = Color.DeepPink;
|
---|
| 504 | row5.Color = Color.Firebrick;
|
---|
| 505 | row6.Color = Color.DarkSlateGray;
|
---|
| 506 |
|
---|
[1243] | 507 | row1.Thickness = 3;
|
---|
| 508 | row2.Thickness = 4;
|
---|
| 509 | row3.Thickness = 5;
|
---|
| 510 |
|
---|
[1342] | 511 | row4.Thickness = 3;
|
---|
| 512 | row5.Thickness = 4;
|
---|
| 513 | row6.Thickness = 5;
|
---|
| 514 |
|
---|
[1243] | 515 | row1.Label = "SingleValue";
|
---|
| 516 | row2.Label = "Gertschi";
|
---|
| 517 | row3.Label = "Maxi";
|
---|
| 518 |
|
---|
[1342] | 519 | row4.Label = "Simon";
|
---|
| 520 | row5.Label = "klausmuellerwesternhagenunddierasperies";
|
---|
| 521 | row6.Label = "anyways";
|
---|
| 522 |
|
---|
[1243] | 523 | row1.Style = DrawingStyle.Solid;
|
---|
| 524 | row2.Style = DrawingStyle.Solid;
|
---|
| 525 | row3.Style = DrawingStyle.Dashed;
|
---|
| 526 |
|
---|
[1342] | 527 | row4.Style = DrawingStyle.Solid;
|
---|
| 528 | row5.Style = DrawingStyle.Solid;
|
---|
| 529 | row6.Style = DrawingStyle.Dashed;
|
---|
| 530 |
|
---|
[1243] | 531 | row1.LineType = DataRowType.SingleValue;
|
---|
| 532 | row2.LineType = DataRowType.SingleValue;
|
---|
| 533 | row1.AddValue(12);
|
---|
| 534 |
|
---|
| 535 | row2.AddValue(5);
|
---|
| 536 |
|
---|
[1607] | 537 |
|
---|
[1243] | 538 | row3.AddValue(2);
|
---|
| 539 | row3.AddValue(5);
|
---|
| 540 | row3.AddValue(9);
|
---|
| 541 | row3.AddValue(1);
|
---|
| 542 | row3.AddValue(3);
|
---|
| 543 |
|
---|
| 544 |
|
---|
[1342] | 545 | row4.AddValue(10);
|
---|
| 546 | row5.AddValue(11);
|
---|
| 547 | row6.AddValue(11);
|
---|
[1243] | 548 |
|
---|
[1342] | 549 | model.AddDataRow(row1);
|
---|
| 550 | model.AddDataRow(row2);
|
---|
| 551 | model.AddDataRow(row3);
|
---|
| 552 | model.AddDataRow(row4);
|
---|
| 553 | model.AddDataRow(row5);
|
---|
| 554 | model.AddDataRow(row6);
|
---|
| 555 |
|
---|
[1243] | 556 | f.ShowDialog();
|
---|
| 557 | }
|
---|
| 558 |
|
---|
| 559 | [Test]
|
---|
[1240] | 560 | public void TestMainForm() {
|
---|
| 561 | MainForm f = new MainForm();
|
---|
| 562 | f.ShowDialog();
|
---|
| 563 | }
|
---|
[861] | 564 | }
|
---|
[1607] | 565 | } |
---|