Ignore:
Timestamp:
01/11/09 23:25:59 (12 years ago)
Author:
gkronber
Message:

worked on presentation layer for CEDMA (brushing) (#419)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChartView.cs

    r1108 r1109  
    1010using HeuristicLab.CEDMA.Charting;
    1111using HeuristicLab.CEDMA.Core;
     12using HeuristicLab.PluginInfrastructure;
    1213
    1314namespace HeuristicLab.CEDMA.Charting {
    14   public partial class BubbleChartView : ViewBase, IResultsView {
    15     private Results results;
     15  public class BubbleChartViewFactory : IResultsViewFactory {
     16    #region IResultsViewFactory Members
     17
     18    public string Name {
     19      get { return "Bubble chart"; }
     20    }
     21
     22    public IControl CreateView(Results results) {
     23      return new BubbleChartView(results);
     24    }
     25
     26    #endregion
     27  }
     28
     29  public partial class BubbleChartView : ViewBase {
     30    private Results Results {
     31      get { return (Results)Item; }
     32      set { Item = value; }
     33    }
    1634    private const string CONSTANT_SIZE = "<constant>";
    1735    private Label pleaseSelectAxisLabel = new Label();
    18 
    19     public BubbleChartView() {
     36    public BubbleChartView(Results results) {
    2037      InitializeComponent();
     38      Results = results;
     39      bubbleChartControl.Chart = new BubbleChart(Results, 0, 0, 100, 100);
     40      xAxisComboBox.Items.AddRange(Results.OrdinalVariables);
     41      xAxisComboBox.Items.AddRange(Results.CategoricalVariables);
     42      yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
     43      yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
     44      sizeComboBox.Items.Add(CONSTANT_SIZE);
     45      sizeComboBox.Items.AddRange(Results.OrdinalVariables);
     46      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
     47      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
     48      xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
    2149    }
    2250
     
    3159
    3260    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       }
     61      double xJitterFactor = xTrackBar.Value / 100.0;
     62      double yJitterFactor = yTrackBar.Value / 100.0;
     63      bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
    3864      UpdateChart();
    3965    }
    4066
    4167    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       }
     68      bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
     69      UpdateChart();
    4670    }
    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
    7371  }
    7472}
Note: See TracChangeset for help on using the changeset viewer.