Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/SingleScatterPlotView.cs @ 10915

Last change on this file since 10915 was 10915, checked in by aesterer, 8 years ago

Splitted scatter plot view in single and multi view

File size: 2.0 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.Analysis;
10using HeuristicLab.Analysis.Views;
11using HeuristicLab.Collections;
12using HeuristicLab.Core;
13using HeuristicLab.Core.Views;
14using HeuristicLab.Data;
15using HeuristicLab.DataPreprocessing.Implementations;
16using HeuristicLab.MainForm;
17
18namespace HeuristicLab.DataPreprocessing.Views {
19
20  [View("Single Scatter Plot View")]
21  [Content(typeof(ScatterPlotContent), false)]
22  public partial class SingleScatterPlotView : ItemView {
23
24    private IChartLogic logic;
25
26    public SingleScatterPlotView() {
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) {
67        ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
68        scatterPlotView.Content = scatterPlot;
69      }
70    }
71
72  }
73
74 
75}
Note: See TracBrowser for help on using the repository browser.