[10882] | 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.Analysis;
|
---|
| 10 | using HeuristicLab.Analysis.Views;
|
---|
| 11 | using HeuristicLab.Collections;
|
---|
| 12 | using HeuristicLab.Core;
|
---|
| 13 | using HeuristicLab.Core.Views;
|
---|
| 14 | using HeuristicLab.Data;
|
---|
| 15 | using HeuristicLab.DataPreprocessing.Implementations;
|
---|
| 16 | using HeuristicLab.MainForm;
|
---|
| 17 |
|
---|
| 18 | namespace HeuristicLab.DataPreprocessing.Views {
|
---|
| 19 |
|
---|
[10915] | 20 | [View("Single Scatter Plot View")]
|
---|
[10882] | 21 | [Content(typeof(ScatterPlotContent), false)]
|
---|
[10915] | 22 | public partial class SingleScatterPlotView : ItemView {
|
---|
[10882] | 23 |
|
---|
| 24 | private IChartLogic logic;
|
---|
| 25 |
|
---|
[10915] | 26 | public SingleScatterPlotView() {
|
---|
[10882] | 27 | InitializeComponent();
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public new ScatterPlotContent Content {
|
---|
| 31 | get { return (ScatterPlotContent)base.Content; }
|
---|
| 32 | set { base.Content = value; }
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | public void InitData() {
|
---|
| 36 |
|
---|
| 37 | IEnumerable<string> variables = logic.GetVariableNames();
|
---|
| 38 | comboBoxXVariable.Items.Clear();
|
---|
| 39 | comboBoxYVariable.Items.Clear();
|
---|
| 40 |
|
---|
| 41 | comboBoxXVariable.Items.AddRange(variables.ToArray());
|
---|
| 42 | comboBoxYVariable.Items.AddRange(variables.ToArray());
|
---|
| 43 |
|
---|
| 44 | if (variables.Count() >= 2) {
|
---|
| 45 | comboBoxXVariable.SelectedIndex = 0;
|
---|
| 46 | comboBoxYVariable.SelectedIndex = 1;
|
---|
| 47 | UpdateScatterPlot();
|
---|
| 48 |
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | protected override void OnContentChanged() {
|
---|
| 54 | base.OnContentChanged();
|
---|
| 55 | if (Content != null) {
|
---|
| 56 | logic = Content.ChartLogic;
|
---|
| 57 | InitData();
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | private void comboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
| 62 | UpdateScatterPlot();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | private void UpdateScatterPlot() {
|
---|
| 66 | if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) {
|
---|
[10915] | 67 | ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
|
---|
[10882] | 68 | scatterPlotView.Content = scatterPlot;
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | }
|
---|