Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Exporter-715/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs @ 3921

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

Improved layout and rendering of bubble chart. #686 (More compact layout of controls in the CEDMA bubble chart control)

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 partial class BubbleChartView : ViewBase {
16    private Results Results {
17      get { return (Results)Item; }
18      set { Item = value; }
19    }
20    private const string CONSTANT_SIZE = "<constant>";
21    private Label pleaseSelectAxisLabel = new Label();
22    public BubbleChartView(Results results) {
23      InitializeComponent();
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);
28      xAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
29      xAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
30      yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
31      yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
32      yAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables);
33      yAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables);
34      sizeComboBox.Items.Add(CONSTANT_SIZE);
35      sizeComboBox.Items.AddRange(Results.OrdinalVariables);
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) {
51      double xJitterFactor = xTrackBar.Value / 100.0;
52      double yJitterFactor = yTrackBar.Value / 100.0;
53      bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
54      UpdateChart();
55    }
56
57    private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
58      bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, false);
59      UpdateChart();
60    }
61  }
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  }
76}
Note: See TracBrowser for help on using the repository browser.