Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2354 was 2295, checked in by mkommend, 15 years ago

adapted CEDMA.BubbleChart to meet needs of new ModelAnalyzer (ticket #723)

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