[560] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Drawing;
|
---|
| 5 | using System.Data;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Windows.Forms;
|
---|
| 9 | using HeuristicLab.Core;
|
---|
| 10 |
|
---|
[1073] | 11 | namespace HeuristicLab.CEDMA.Core {
|
---|
[560] | 12 | public partial class ResultListView : ViewBase {
|
---|
| 13 | private ResultList results;
|
---|
| 14 | private const string FREQUENCY = "<Frequency>";
|
---|
[561] | 15 | private const string CONSTANT_SIZE = "<constant>";
|
---|
[571] | 16 | private BubbleChartControl bubbleChartControl;
|
---|
| 17 | private HistogramControl histogramControl;
|
---|
| 18 | private Label pleaseSelectAxisLabel = new Label();
|
---|
[560] | 19 |
|
---|
| 20 | public ResultListView(ResultList results) {
|
---|
| 21 | this.results = results;
|
---|
| 22 | InitializeComponent();
|
---|
[571] | 23 | InitCharts();
|
---|
[560] | 24 | xAxisComboBox.Items.AddRange(results.VariableNames);
|
---|
| 25 | yAxisComboBox.Items.Add(FREQUENCY);
|
---|
| 26 | yAxisComboBox.Items.AddRange(results.VariableNames);
|
---|
[561] | 27 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
| 28 | sizeComboBox.Items.AddRange(results.VariableNames);
|
---|
| 29 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
[571] | 30 | sizeComboBox.Enabled = false;
|
---|
| 31 | invertCheckbox.Enabled = false;
|
---|
| 32 | sizeLabel.Enabled = false;
|
---|
| 33 | yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
|
---|
| 34 | xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
|
---|
[560] | 35 | }
|
---|
| 36 |
|
---|
[571] | 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);
|
---|
[561] | 42 | }
|
---|
| 43 |
|
---|
[560] | 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)) {
|
---|
[571] | 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;
|
---|
[560] | 66 | } else {
|
---|
[571] | 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;
|
---|
[560] | 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
[561] | 81 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
[571] | 82 | if(bubbleChartControl.Chart != null) {
|
---|
[562] | 83 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
| 84 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
[571] | 85 | bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
[560] | 86 | }
|
---|
| 87 | UpdateChart();
|
---|
| 88 | }
|
---|
| 89 |
|
---|
[561] | 90 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
[571] | 91 | if(bubbleChartControl.Chart != null) {
|
---|
| 92 | bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
|
---|
[561] | 93 | UpdateChart();
|
---|
[560] | 94 | }
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 | }
|
---|