Line | |
---|
1 | using System;
|
---|
2 | using System.Windows.Forms;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 |
|
---|
5 | namespace 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.