Changeset 1038 for trunk/sources/HeuristicLab.Visualization.Test
- Timestamp:
- 12/18/08 23:17:23 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization.Test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/LineChartTestForm.Designer.cs
r986 r1038 26 26 this.lineChartGroupBox = new System.Windows.Forms.GroupBox(); 27 27 this.btnResetView = new System.Windows.Forms.Button(); 28 this.btnAddRandomValue = new System.Windows.Forms.Button(); 28 29 this.SuspendLayout(); 29 30 // … … 35 36 this.lineChartGroupBox.Location = new System.Drawing.Point(12, 12); 36 37 this.lineChartGroupBox.Name = "lineChartGroupBox"; 37 this.lineChartGroupBox.Size = new System.Drawing.Size(6 07, 318);38 this.lineChartGroupBox.Size = new System.Drawing.Size(673, 376); 38 39 this.lineChartGroupBox.TabIndex = 0; 39 40 this.lineChartGroupBox.TabStop = false; … … 43 44 // 44 45 this.btnResetView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 45 this.btnResetView.Location = new System.Drawing.Point( 544, 346);46 this.btnResetView.Location = new System.Drawing.Point(610, 404); 46 47 this.btnResetView.Name = "btnResetView"; 47 48 this.btnResetView.Size = new System.Drawing.Size(75, 23); … … 51 52 this.btnResetView.Click += new System.EventHandler(this.btnResetView_Click); 52 53 // 54 // btnAddRandomValue 55 // 56 this.btnAddRandomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 57 this.btnAddRandomValue.Location = new System.Drawing.Point(529, 404); 58 this.btnAddRandomValue.Name = "btnAddRandomValue"; 59 this.btnAddRandomValue.Size = new System.Drawing.Size(75, 23); 60 this.btnAddRandomValue.TabIndex = 2; 61 this.btnAddRandomValue.Text = "Add Value"; 62 this.btnAddRandomValue.UseVisualStyleBackColor = true; 63 this.btnAddRandomValue.Click += new System.EventHandler(this.btnAddRandomValue_Click); 64 // 53 65 // LineChartTestForm 54 66 // 55 67 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 56 68 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 57 this.ClientSize = new System.Drawing.Size(631, 395); 69 this.ClientSize = new System.Drawing.Size(697, 453); 70 this.Controls.Add(this.btnAddRandomValue); 58 71 this.Controls.Add(this.lineChartGroupBox); 59 72 this.Controls.Add(this.btnResetView); … … 68 81 private System.Windows.Forms.GroupBox lineChartGroupBox; 69 82 private System.Windows.Forms.Button btnResetView; 83 private System.Windows.Forms.Button btnAddRandomValue; 70 84 71 85 } -
trunk/sources/HeuristicLab.Visualization.Test/LineChartTestForm.cs
r985 r1038 1 using System.Windows.Forms; 1 using System; 2 using System.Windows.Forms; 2 3 using HeuristicLab.Core; 3 4 4 5 namespace HeuristicLab.Visualization.Test { 5 6 public partial class LineChartTestForm : Form { 7 private readonly IView view; 6 8 private ChartDataRowsModel model; 7 private IView view;8 9 9 10 public LineChartTestForm() { 10 11 InitializeComponent(); 12 } 11 13 12 model = new ChartDataRowsModel(); 13 14 14 public LineChartTestForm(ChartDataRowsModel model) : this() { 15 this.model = model; 15 16 view = model.CreateView(); 16 17 … … 21 22 } 22 23 23 public ChartDataRowsModel Model { 24 get { return model; } 24 private void btnResetView_Click(object sender, EventArgs e) { 25 if (view != null) { 26 LineChart lineChart = (LineChart)view; 27 lineChart.ResetView(); 28 } 25 29 } 26 30 27 private void btnResetView_Click(object sender, System.EventArgs e) { 28 LineChart lineChart = (LineChart)view; 29 lineChart.ResetView(); 31 private void btnAddRandomValue_Click(object sender, EventArgs e) { 32 Random rand = new Random(); 33 34 foreach (IDataRow row in model.Rows) 35 row.AddValue(rand.NextDouble()*100); 30 36 } 31 37 } -
trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs
r983 r1038 6 6 [TestFixture] 7 7 public class LineChartTests { 8 private ChartDataRowsModel model; 9 10 [SetUp] 11 public void SetUp() { 12 model = new ChartDataRowsModel(); 13 } 14 8 15 [Test] 9 16 public void TestLineChart() { 10 LineChartTestForm f = new LineChartTestForm( );17 LineChartTestForm f = new LineChartTestForm(model); 11 18 12 19 IDataRow row1 = new DataRow(); … … 27 34 28 35 29 f.Model.AddDataRow(row1);30 f.Model.AddDataRow(row2);31 f.Model.AddDataRow(row3);36 model.AddDataRow(row1); 37 model.AddDataRow(row2); 38 model.AddDataRow(row3); 32 39 33 40 row1.AddValue(10); … … 50 57 Random rand = new Random(); 51 58 52 for (int i = 0; i < 1000 ; i++) {59 for (int i = 0; i < 10000; i++) { 53 60 row1.AddValue(rand.NextDouble()*10); 54 61 row2.AddValue(rand.NextDouble()*10); … … 61 68 [Test] 62 69 public void TestAxes() { 63 LineChartTestForm f = new LineChartTestForm( );70 LineChartTestForm f = new LineChartTestForm(model); 64 71 65 72 IDataRow row1 = new DataRow(); … … 69 76 row1.Style = DrawingStyle.Solid; 70 77 71 f.Model.AddDataRow(row1);78 model.AddDataRow(row1); 72 79 73 80 row1.AddValue(10); -
trunk/sources/HeuristicLab.Visualization.Test/MainForm.cs
r865 r1038 30 30 WorldShape mainWorld = canvasUI.MainCanvas.WorldShape; 31 31 // simple rectangle shape 32 RectangleShape rect7 = new RectangleShape(5, 5, 50, 50, 0,Color.Black);32 RectangleShape rect7 = new RectangleShape(5, 5, 50, 50, Color.Black); 33 33 mainWorld.AddShape(rect7); 34 34 } … … 43 43 44 44 for (int i = 0; i < 10000; i++) { 45 RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, 0,Color.Maroon);45 RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, Color.Maroon); 46 46 x1 += 0.4; 47 47 y1 += 0.4; … … 57 57 CompositeShape middleComp = new CompositeShape(); 58 58 59 RectangleShape rect5 = new RectangleShape(400, 10, 500, 300, 0,Color.Navy);60 RectangleShape rect6 = new RectangleShape(510, 310, 580, 590, 0,Color.Magenta);59 RectangleShape rect5 = new RectangleShape(400, 10, 500, 300, Color.Navy); 60 RectangleShape rect6 = new RectangleShape(510, 310, 580, 590, Color.Magenta); 61 61 62 62 middleComp.AddShape(rect5); … … 71 71 WorldShape leftWorld = new WorldShape(new RectangleD(0, 0, 1000, 1000), new RectangleD(10, 10, 380, 590)); 72 72 73 RectangleShape fillRect = new RectangleShape(0, 0, 1000, 1000, 0,Color.LightBlue);73 RectangleShape fillRect = new RectangleShape(0, 0, 1000, 1000, Color.LightBlue); 74 74 75 RectangleShape rect1 = new RectangleShape(100, 100, 500, 500, 0,Color.Red);76 RectangleShape rect2 = new RectangleShape(800, -200, 1200, 500, 0,Color.Green);75 RectangleShape rect1 = new RectangleShape(100, 100, 500, 500, Color.Red); 76 RectangleShape rect2 = new RectangleShape(800, -200, 1200, 500, Color.Green); 77 77 78 78 CompositeShape comp1 = new CompositeShape(); 79 79 80 RectangleShape rect3 = new RectangleShape(510, 580, 590, 700, 0,Color.Blue);81 RectangleShape rect4 = new RectangleShape(600, 710, 800, 900, 0,Color.Orange);80 RectangleShape rect3 = new RectangleShape(510, 580, 590, 700, Color.Blue); 81 RectangleShape rect4 = new RectangleShape(600, 710, 800, 900, Color.Orange); 82 82 83 83 comp1.AddShape(rect3);
Note: See TracChangeset
for help on using the changeset viewer.