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.CEDMA.Core;
|
---|
12 | using HeuristicLab.PluginInfrastructure;
|
---|
13 |
|
---|
14 | namespace 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 | }
|
---|