[1106] | 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;
|
---|
[1287] | 12 | using HeuristicLab.PluginInfrastructure;
|
---|
[1106] | 13 |
|
---|
| 14 | namespace HeuristicLab.CEDMA.Charting {
|
---|
[1287] | 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 |
|
---|
[1106] | 29 | public partial class BubbleChartView : ViewBase {
|
---|
[1287] | 30 | private Results Results {
|
---|
| 31 | get { return (Results)Item; }
|
---|
| 32 | set { Item = value; }
|
---|
| 33 | }
|
---|
[1106] | 34 | private const string CONSTANT_SIZE = "<constant>";
|
---|
| 35 | private Label pleaseSelectAxisLabel = new Label();
|
---|
| 36 | public BubbleChartView(Results results) {
|
---|
| 37 | InitializeComponent();
|
---|
[1287] | 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 | yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
| 43 | yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
|
---|
[1106] | 44 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
[1287] | 45 | sizeComboBox.Items.AddRange(Results.OrdinalVariables);
|
---|
[1106] | 46 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
| 47 | yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
|
---|
| 48 | xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | private void axisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
| 52 | UpdateChart();
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | private void UpdateChart() {
|
---|
| 56 | if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
|
---|
| 57 | bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
[1287] | 61 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
| 62 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
| 63 | bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
[1106] | 64 | UpdateChart();
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
[1287] | 68 | bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
|
---|
| 69 | UpdateChart();
|
---|
[1106] | 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|