[1106] | 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;
|
---|
[1287] | 12 | using HeuristicLab.PluginInfrastructure;
|
---|
[1106] | 13 |
|
---|
| 14 | namespace HeuristicLab.CEDMA.Charting {
|
---|
| 15 | public partial class BubbleChartView : ViewBase {
|
---|
[1287] | 16 | private Results Results {
|
---|
| 17 | get { return (Results)Item; }
|
---|
| 18 | set { Item = value; }
|
---|
| 19 | }
|
---|
[1106] | 20 | private const string CONSTANT_SIZE = "<constant>";
|
---|
| 21 | private Label pleaseSelectAxisLabel = new Label();
|
---|
| 22 | public BubbleChartView(Results results) {
|
---|
| 23 | InitializeComponent();
|
---|
[1287] | 24 | Results = results;
|
---|
| 25 | bubbleChartControl.Chart = new BubbleChart(Results, 0, 0, 100, 100);
|
---|
| 26 | xAxisComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
| 27 | xAxisComboBox.Items.AddRange(Results.CategoricalVariables);
|
---|
[2131] | 28 | xAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
|
---|
| 29 | xAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
|
---|
[1287] | 30 | yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
| 31 | yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
|
---|
[2131] | 32 | yAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
|
---|
| 33 | yAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
|
---|
[1106] | 34 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
[1287] | 35 | sizeComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
[1106] | 36 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
| 37 | yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
|
---|
| 38 | xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
| 42 | UpdateChart();
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | private void UpdateChart() {
|
---|
| 46 | if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
|
---|
| 47 | bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
[1287] | 51 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
| 52 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
| 53 | bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
[1106] | 54 | UpdateChart();
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
[2135] | 58 | bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, false);
|
---|
[1287] | 59 | UpdateChart();
|
---|
[1106] | 60 | }
|
---|
| 61 | }
|
---|
[2135] | 62 |
|
---|
| 63 | public class BubbleChartViewFactory : IResultsViewFactory {
|
---|
| 64 | #region IResultsViewFactory Members
|
---|
| 65 |
|
---|
| 66 | public string Name {
|
---|
| 67 | get { return "Bubble chart"; }
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | public IControl CreateView(Results results) {
|
---|
| 71 | return new BubbleChartView(results);
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | #endregion
|
---|
| 75 | }
|
---|
[1106] | 76 | }
|
---|