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 | using HeuristicLab.CEDMA.Charting;
|
---|
11 | using HeuristicLab.CEDMA.Core;
|
---|
12 |
|
---|
13 | namespace HeuristicLab.CEDMA.Charting {
|
---|
14 | public partial class BubbleChartView : ViewBase {
|
---|
15 | private Results results;
|
---|
16 | private const string CONSTANT_SIZE = "<constant>";
|
---|
17 | private Label pleaseSelectAxisLabel = new Label();
|
---|
18 |
|
---|
19 | public BubbleChartView(Results results) {
|
---|
20 | this.results = results;
|
---|
21 | InitializeComponent();
|
---|
22 | bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);
|
---|
23 | xAxisComboBox.Items.AddRange(results.OrdinalVariableNames);
|
---|
24 | yAxisComboBox.Items.AddRange(results.OrdinalVariableNames);
|
---|
25 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
26 | sizeComboBox.Items.AddRange(results.VariableNames);
|
---|
27 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
28 | sizeComboBox.Enabled = false;
|
---|
29 | invertCheckbox.Enabled = false;
|
---|
30 | sizeLabel.Enabled = false;
|
---|
31 | yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
|
---|
32 | xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
|
---|
33 | }
|
---|
34 |
|
---|
35 | private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
36 | UpdateChart();
|
---|
37 | }
|
---|
38 |
|
---|
39 | private void UpdateChart() {
|
---|
40 | if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
|
---|
41 | xJitterlabel.Enabled = true;
|
---|
42 | xTrackBar.Enabled = true;
|
---|
43 | yJitterLabel.Enabled = true;
|
---|
44 | yTrackBar.Enabled = true;
|
---|
45 | sizeComboBox.Enabled = true;
|
---|
46 | invertCheckbox.Enabled = true;
|
---|
47 | sizeLabel.Enabled = true;
|
---|
48 | bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
|
---|
49 | }
|
---|
50 |
|
---|
51 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
52 | if (bubbleChartControl.Chart != null) {
|
---|
53 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
54 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
55 | bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
56 | }
|
---|
57 | UpdateChart();
|
---|
58 | }
|
---|
59 |
|
---|
60 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
61 | if (bubbleChartControl.Chart != null) {
|
---|
62 | bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
|
---|
63 | UpdateChart();
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
67 | }
|
---|