Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultListView.cs @ 1073

Last change on this file since 1073 was 1073, checked in by gkronber, 15 years ago

worked on CEDMA analysis frontend. #419 (Refactor CEDMA plugins)

File size: 3.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.Core;
10
11namespace HeuristicLab.CEDMA.Core {
12  public partial class ResultListView : ViewBase {
13    private ResultList results;
14    private const string FREQUENCY = "<Frequency>";
15    private const string CONSTANT_SIZE = "<constant>";
16    private BubbleChartControl bubbleChartControl;
17    private HistogramControl histogramControl;
18    private Label pleaseSelectAxisLabel = new Label();
19
20    public ResultListView(ResultList results) {
21      this.results = results;
22      InitializeComponent();
23      InitCharts();
24      xAxisComboBox.Items.AddRange(results.VariableNames);
25      yAxisComboBox.Items.Add(FREQUENCY);
26      yAxisComboBox.Items.AddRange(results.VariableNames);
27      sizeComboBox.Items.Add(CONSTANT_SIZE);
28      sizeComboBox.Items.AddRange(results.VariableNames);
29      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
30      sizeComboBox.Enabled = false;
31      invertCheckbox.Enabled = false;
32      sizeLabel.Enabled = false;
33      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
34      xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
35    }
36
37    private void InitCharts() {
38      bubbleChartControl = new BubbleChartControl();
39      bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);
40      histogramControl = new HistogramControl();
41      histogramControl.Chart = new Histogram(results, 0, 0, 100, 100);
42    }
43
44    private void yAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
45      UpdateChart();
46    }
47
48    private void xAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
49      UpdateChart();
50    }
51
52    private void UpdateChart() {
53      if(xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
54      if(yAxisComboBox.SelectedItem.Equals(FREQUENCY)) {
55        xJitterlabel.Enabled = false;
56        xTrackBar.Enabled = false;
57        yJitterLabel.Enabled = false;
58        yTrackBar.Enabled = false;
59        sizeComboBox.Enabled = false;
60        invertCheckbox.Enabled = false;
61        sizeLabel.Enabled = false;
62        chartPanel.Controls.Clear();
63        chartPanel.Controls.Add(histogramControl);
64        histogramControl.Chart.ShowFrequency((string)xAxisComboBox.SelectedItem);
65        histogramControl.Dock = DockStyle.Fill;
66      } else {
67        xJitterlabel.Enabled = true;
68        xTrackBar.Enabled = true;
69        yJitterLabel.Enabled = true;
70        yTrackBar.Enabled = true;
71        sizeComboBox.Enabled = true;
72        invertCheckbox.Enabled = true;
73        sizeLabel.Enabled = true;
74        chartPanel.Controls.Clear();
75        chartPanel.Controls.Add(bubbleChartControl);
76        bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
77        bubbleChartControl.Dock = DockStyle.Fill;
78      }
79    }
80
81    private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
82      if(bubbleChartControl.Chart != null) {
83        double xJitterFactor = xTrackBar.Value / 100.0;
84        double yJitterFactor = yTrackBar.Value / 100.0;
85        bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
86      }
87      UpdateChart();
88    }
89
90    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
91      if(bubbleChartControl.Chart != null) {
92        bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
93        UpdateChart();
94      }
95    }
96  }
97}
Note: See TracBrowser for help on using the repository browser.