Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HistogramView.cs @ 10867

Last change on this file since 10867 was 10867, checked in by mleitner, 8 years ago

Add colors to histogram / remove all in one mode

File size: 1.6 KB
Line 
1using System;
2using System.Windows.Forms;
3using HeuristicLab.Analysis;
4using HeuristicLab.MainForm;
5
6namespace HeuristicLab.DataPreprocessing.Views {
7
8  [View("Histogram View")]
9  [Content(typeof(HistogramContent), true)]
10  public partial class HistogramView : PreprocessingChartView {
11
12    private const string HISTOGRAM_CHART_TITLE = "Histogram";
13
14    public HistogramView() {
15      InitializeComponent();
16      chartType = DataRowVisualProperties.DataRowChartType.Histogram;
17      chartTitle = HISTOGRAM_CHART_TITLE;
18    }
19
20    protected override void OnContentChanged()
21    {
22      base.OnContentChanged();
23      if (Content != null)
24      {
25        logic = Content.ChartLogic;
26        Content.AllInOneMode = false;
27
28        classifierComboBox.Items.Clear();
29
30        classifierComboBox.Items.Add("None");
31
32        foreach(string var in logic.GetVariableNames()){
33          classifierComboBox.Items.Add(var);
34        }
35
36        if (classifierComboBox.SelectedIndex == -1) {
37          classifierComboBox.SelectedIndex = 0;
38        }
39      }
40    }
41
42    public new HistogramContent Content {
43      get { return (HistogramContent)base.Content; }
44      set { base.Content = value; }
45    }
46
47    private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e)
48    {
49      if (classifierComboBox.SelectedItem == null)
50        return;
51
52
53      if (classifierComboBox.SelectedIndex != 0)
54      {
55        classification = logic.GetVariableValues(classifierComboBox.SelectedItem.ToString());
56      }
57      else {
58        classification = null;
59      }
60
61      GenerateChart();
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.