Free cookie consent management tool by TermsFeed Policy Generator

source: branches/plugins/HeuristicLab.CEDMA.Charting/3.2/BubbleChartView.cs @ 3021

Last change on this file since 3021 was 1109, checked in by gkronber, 16 years ago

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

File size: 2.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.Core;
10using HeuristicLab.CEDMA.Charting;
11using HeuristicLab.CEDMA.Core;
12using HeuristicLab.PluginInfrastructure;
13
14namespace HeuristicLab.CEDMA.Charting {
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    }
34    private const string CONSTANT_SIZE = "<constant>";
35    private Label pleaseSelectAxisLabel = new Label();
36    public BubbleChartView(Results results) {
37      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];
49    }
50
51    private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
52      UpdateChart();
53    }
54
55    private void UpdateChart() {
56      if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
57      bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
58    }
59
60    private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
61      double xJitterFactor = xTrackBar.Value / 100.0;
62      double yJitterFactor = yTrackBar.Value / 100.0;
63      bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
64      UpdateChart();
65    }
66
67    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
68      bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
69      UpdateChart();
70    }
71  }
72}
Note: See TracBrowser for help on using the repository browser.