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, IResultsView {
|
---|
15 | private Results results;
|
---|
16 | private const string CONSTANT_SIZE = "<constant>";
|
---|
17 | private Label pleaseSelectAxisLabel = new Label();
|
---|
18 |
|
---|
19 | public BubbleChartView() {
|
---|
20 | InitializeComponent();
|
---|
21 | }
|
---|
22 |
|
---|
23 | private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
24 | UpdateChart();
|
---|
25 | }
|
---|
26 |
|
---|
27 | private void UpdateChart() {
|
---|
28 | if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
|
---|
29 | bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
|
---|
30 | }
|
---|
31 |
|
---|
32 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
33 | if (bubbleChartControl.Chart != null) {
|
---|
34 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
35 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
36 | bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
37 | }
|
---|
38 | UpdateChart();
|
---|
39 | }
|
---|
40 |
|
---|
41 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
42 | if (bubbleChartControl.Chart != null) {
|
---|
43 | bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
|
---|
44 | UpdateChart();
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | #region IResultsView Members
|
---|
49 |
|
---|
50 | public Control Control {
|
---|
51 | get { return this; }
|
---|
52 | }
|
---|
53 |
|
---|
54 | string IResultsView.Name {
|
---|
55 | get { return "Bubble chart"; }
|
---|
56 | }
|
---|
57 |
|
---|
58 | public void ShowResults(Results results) {
|
---|
59 | this.results = results;
|
---|
60 | bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);
|
---|
61 | xAxisComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
62 | xAxisComboBox.Items.AddRange(Results.CategoricalVariables);
|
---|
63 | yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
64 | yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
|
---|
65 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
66 | sizeComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
67 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
68 | yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
|
---|
69 | xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
|
---|
70 | }
|
---|
71 |
|
---|
72 | #endregion
|
---|
73 | }
|
---|
74 | }
|
---|