Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs @ 1069

Last change on this file since 1069 was 1049, checked in by shofstad, 16 years ago

Legend implementation finished (#407)

File size: 2.5 KB
Line 
1using System;
2using System.Drawing;
3using NUnit.Framework;
4
5namespace HeuristicLab.Visualization.Test {
6  [TestFixture]
7  public class LineChartTests {
8    private ChartDataRowsModel model;
9
10    [SetUp]
11    public void SetUp() {
12      model = new ChartDataRowsModel();
13    }
14
15    [Test]
16    public void TestLineChart() {
17      LineChartTestForm f = new LineChartTestForm(model);
18
19      IDataRow row1 = new DataRow();
20      IDataRow row2 = new DataRow();
21      IDataRow row3 = new DataRow();
22
23      row1.Color = Color.Red;
24      row2.Color = Color.Green;
25      row3.Color = Color.Blue;
26
27      row1.Thickness = 3;
28      row2.Thickness = 4;
29      row3.Thickness = 5;
30
31      row1.Label = "Simon";
32      row2.Label = "Gertschi";
33      row3.Label = "Maxi";
34
35      row1.Style = DrawingStyle.Solid;
36      row2.Style = DrawingStyle.Solid;
37      row3.Style = DrawingStyle.Dashed;
38     
39
40      model.AddDataRow(row1);
41      model.AddDataRow(row2);
42      model.AddDataRow(row3);
43
44      row1.AddValue(10);
45      row1.AddValue(5);
46      row1.AddValue(7);
47      row1.AddValue(3);
48      row1.AddValue(10);
49      row1.AddValue(2);
50
51      row2.AddValue(5);
52      row2.AddValue(6);
53      row2.AddValue(5);
54
55      row3.AddValue(2);
56      row3.AddValue(2);
57      row3.AddValue(2);
58      row3.AddValue(2);
59      row3.AddValue(2);
60
61      Random rand = new Random();
62
63      for (int i = 0; i < 10000; i++) {
64        row1.AddValue(rand.NextDouble()*10);
65        row2.AddValue(rand.NextDouble()*10);
66        row3.AddValue(rand.NextDouble()*10);
67      }
68
69      f.ShowDialog();
70    }
71
72    [Test]
73    public void TestAxes() {
74      LineChartTestForm f = new LineChartTestForm(model);
75
76      IDataRow row1 = new DataRow();
77
78      row1.Color = Color.Red;
79      row1.Thickness = 3;
80      row1.Style = DrawingStyle.Solid;
81
82      model.AddDataRow(row1);
83
84      row1.AddValue(10);
85      row1.AddValue(5);
86      row1.AddValue(7);
87      row1.AddValue(3);
88      row1.AddValue(10);
89      row1.AddValue(2);
90
91      f.ShowDialog();
92    }
93
94    [Test]
95    public void TestAutoZoomInConstructor() {
96      IDataRow row1 = new DataRow();
97
98      row1.Color = Color.Red;
99      row1.Thickness = 3;
100      row1.Style = DrawingStyle.Solid;
101
102      model.AddDataRow(row1);
103
104      row1.AddValue(10);
105      row1.AddValue(5);
106      row1.AddValue(7);
107      row1.AddValue(3);
108      row1.AddValue(10);
109      row1.AddValue(2);
110
111      LineChartTestForm f = new LineChartTestForm(model);
112      f.ShowDialog();
113    }
114  }
115}
Note: See TracBrowser for help on using the repository browser.