Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs @ 2131

Last change on this file since 2131 was 2131, checked in by gkronber, 15 years ago

Implemented basic visualization of variable impacts in the CEDMA bubble chart. #286 (Variable-usage diagrams for the CEDMA frontend)

File size: 2.8 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      xAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
43      xAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
44      yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
45      yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
46      yAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
47      yAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
48      sizeComboBox.Items.Add(CONSTANT_SIZE);
49      sizeComboBox.Items.AddRange(Results.OrdinalVariables);
50      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
51      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
52      xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
53    }
54
55    private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
56      UpdateChart();
57    }
58
59    private void UpdateChart() {
60      if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
61      bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
62    }
63
64    private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
65      double xJitterFactor = xTrackBar.Value / 100.0;
66      double yJitterFactor = yTrackBar.Value / 100.0;
67      bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
68      UpdateChart();
69    }
70
71    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
72      bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
73      UpdateChart();
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.