Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTestForm.cs @ 3410

Last change on this file since 3410 was 1981, checked in by mstoeger, 15 years ago

added a few tests. #498

File size: 1.2 KB
Line 
1using System;
2using System.Windows.Forms;
3using HeuristicLab.Core;
4
5namespace HeuristicLab.Visualization.Test {
6  public delegate void AddValueHandler();
7
8  public partial class LineChartTestForm : Form {
9    private readonly IView view;
10    private readonly ChartDataRowsModel model;
11
12    public LineChartTestForm() {
13      InitializeComponent();
14    }
15
16    public LineChartTestForm(ChartDataRowsModel model) : this() {
17      this.model = model;
18      view = model.CreateView();
19
20      Control viewControl = (Control)view;
21      viewControl.Dock = DockStyle.Fill;
22
23      lineChartGroupBox.Controls.Add(viewControl);
24    }
25
26    private void btnResetView_Click(object sender, EventArgs e) {
27      if (view != null) {
28        LineChart lineChart = (LineChart)view;
29        lineChart.ZoomToFullView();
30      }
31    }
32
33    public event AddValueHandler AddValue;
34
35    private void btnAddRandomValue_Click(object sender, EventArgs e) {
36      if (AddValue != null) {
37        AddValue();
38      } else {
39        Random rand = new Random();
40
41        foreach (IDataRow row in model.Rows)
42          row.AddValue(rand.NextDouble() * 100);
43      }
44    }
45  }
46}
Note: See TracBrowser for help on using the repository browser.