1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Data;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 | using HeuristicLab.Core;
|
---|
10 | using HeuristicLab.CEDMA.Charting;
|
---|
11 | using HeuristicLab.PluginInfrastructure;
|
---|
12 | using HeuristicLab.SparseMatrix;
|
---|
13 |
|
---|
14 | namespace 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 | }
|
---|