source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs @ 10992

Last change on this file since 10992 was 10992, checked in by rstoll, 8 years ago
  • removed ChartLogic and

moved logic accordingly to PreprocessingChartContent, ScatterPlotContent
modified views etc. to use IFilteredPreprocessingData instead of ChartLogic

  • reordered code
File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21using System;
22using System.Windows.Forms;
23using HeuristicLab.Analysis;
24using HeuristicLab.MainForm;
25
26namespace HeuristicLab.DataPreprocessing.Views {
27
28  [View("Histogram View")]
29  [Content(typeof(HistogramContent), true)]
30  public partial class HistogramView : PreprocessingChartView {
31    private const string HISTOGRAM_CHART_TITLE = "Histogram";
32
33    public HistogramView() {
34      InitializeComponent();
35      chartType = DataRowVisualProperties.DataRowChartType.Histogram;
36      chartTitle = HISTOGRAM_CHART_TITLE;
37    }
38
39    protected override void OnContentChanged() {
40      base.OnContentChanged();
41      if (Content != null) {
42
43        classifierComboBox.Items.Clear();
44        classifierComboBox.Items.Add("None");
45
46        foreach (string var in Content.GetVariableNamesForHistogramClassification()) {
47          classifierComboBox.Items.Add(var);
48        }
49
50
51        if (classifierComboBox.SelectedItem == null && Content.ClassifierVariableIndex < classifierComboBox.Items.Count) {
52          classifierComboBox.SelectedIndex = Content.ClassifierVariableIndex;
53        }
54      }
55    }
56
57    public new HistogramContent Content {
58      get { return (HistogramContent)base.Content; }
59      set { base.Content = value; }
60    }
61
62    private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) {
63      if (classifierComboBox.SelectedItem == null)
64        return;
65
66      if (classifierComboBox.SelectedIndex != 0) {
67        int columndIndex = Content.PreprocessingData.GetColumnIndex(classifierComboBox.SelectedItem.ToString());
68        Classification = Content.PreprocessingData.GetValues<double>(columndIndex);
69      } else {
70        Classification = null;
71      }
72
73      Content.ClassifierVariableIndex = classifierComboBox.SelectedIndex;
74
75      GenerateChart();
76    }
77  }
78}
Note: See TracBrowser for help on using the repository browser.