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