Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs @ 12924

Last change on this file since 12924 was 12718, checked in by mkommend, 9 years ago

#2335: Merged all changes into stable.

File size: 3.2 KB
RevLine 
[10914]1#region License Information
2/* HeuristicLab
[12009]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[10914]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 */
[10992]20#endregion
[10914]21using System;
[10736]22using System.Windows.Forms;
[10658]23using HeuristicLab.Analysis;
24using HeuristicLab.MainForm;
25
26namespace HeuristicLab.DataPreprocessing.Views {
27
28  [View("Histogram View")]
[10712]29  [Content(typeof(HistogramContent), true)]
[10658]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
[10914]39    protected override void OnContentChanged() {
[10867]40      base.OnContentChanged();
[10914]41      if (Content != null) {
[10867]42        classifierComboBox.Items.Clear();
43        classifierComboBox.Items.Add("None");
44
[10992]45        foreach (string var in Content.GetVariableNamesForHistogramClassification()) {
[10867]46          classifierComboBox.Items.Add(var);
47        }
48
[10942]49        if (classifierComboBox.SelectedItem == null && Content.ClassifierVariableIndex < classifierComboBox.Items.Count) {
[10871]50          classifierComboBox.SelectedIndex = Content.ClassifierVariableIndex;
[10867]51        }
52      }
53    }
54
[10658]55    public new HistogramContent Content {
56      get { return (HistogramContent)base.Content; }
57      set { base.Content = value; }
58    }
59
[10908]60    private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) {
[10867]61      if (classifierComboBox.SelectedItem == null)
62        return;
[10736]63
[10908]64      if (classifierComboBox.SelectedIndex != 0) {
[10992]65        int columndIndex = Content.PreprocessingData.GetColumnIndex(classifierComboBox.SelectedItem.ToString());
66        Classification = Content.PreprocessingData.GetValues<double>(columndIndex);
[10908]67      } else {
68        Classification = null;
[10818]69      }
[10867]70
[10871]71      Content.ClassifierVariableIndex = classifierComboBox.SelectedIndex;
[12718]72      if (Content.IsDetailedChartViewEnabled != IsDetailedChartViewEnabled) {
73        displayDetailsCheckBox.Checked = Content.IsDetailedChartViewEnabled;
74      } else {
75        GenerateChart();
76      }
[10818]77    }
[12718]78    private void displayDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
79      bool isChecked = displayDetailsCheckBox.Checked;
80      if (IsDetailedChartViewEnabled != isChecked) {
81        IsDetailedChartViewEnabled = isChecked;
82        Content.IsDetailedChartViewEnabled = isChecked;
83        GenerateChart();
84      }
85    }
[10658]86  }
87}
Note: See TracBrowser for help on using the repository browser.