Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 15692 was 15584, checked in by swagner, 7 years ago

#2640: Updated year of copyrights in license headers on stable

File size: 3.5 KB
RevLine 
[10914]1#region License Information
2/* HeuristicLab
[15584]3 * Copyright (C) 2002-2018 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
[14075]21
[10914]22using System;
[15242]23using System.Drawing;
[10658]24using HeuristicLab.Analysis;
25using HeuristicLab.MainForm;
26
27namespace HeuristicLab.DataPreprocessing.Views {
28  [View("Histogram View")]
[10712]29  [Content(typeof(HistogramContent), true)]
[10658]30  public partial class HistogramView : PreprocessingChartView {
[15242]31    public new HistogramContent Content {
32      get { return (HistogramContent)base.Content; }
33      set { base.Content = value; }
34    }
[10658]35
36    public HistogramView() {
37      InitializeComponent();
[15242]38      aggregationComboBox.DataSource = Enum.GetValues(typeof(DataTableVisualProperties.DataTableHistogramAggregation));
39      aggregationComboBox.SelectedItem = DataTableVisualProperties.DataTableHistogramAggregation.Overlapping;
40      orderComboBox.DataSource = Enum.GetValues(typeof(PreprocessingChartContent.LegendOrder));
41      orderComboBox.SelectedItem = PreprocessingChartContent.LegendOrder.Alphabetically;
[10658]42    }
43
[10914]44    protected override void OnContentChanged() {
[10867]45      base.OnContentChanged();
[15242]46      groupingComboBox.Items.Clear();
47      groupingComboBox.Items.Add(string.Empty);
48
[10914]49      if (Content != null) {
[15242]50        foreach (string var in PreprocessingChartContent.GetVariableNamesForGrouping(Content.PreprocessingData)) {
51          groupingComboBox.Items.Add(var);
[10867]52        }
53
[15242]54        groupingComboBox.SelectedItem = Content.GroupingVariableName ?? string.Empty;
[10867]55      }
56    }
57
[15242]58    protected override DataTable CreateDataTable(string variableName) {
59      var aggregation = (DataTableVisualProperties.DataTableHistogramAggregation)aggregationComboBox.SelectedItem;
60      var hist = HistogramContent.CreateHistogram(Content.PreprocessingData, variableName, Content.GroupingVariableName, aggregation, Content.Order);
61      hist.VisualProperties.TitleFont = new Font(DefaultFont.FontFamily, 10, FontStyle.Bold);
62      return hist;
[10658]63    }
64
[10908]65    private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) {
[15242]66      Content.GroupingVariableName = groupingComboBox.SelectedItem.ToString();
[10736]67
[15242]68      // rebuild datatables
69      InitData();
70      GenerateLayout();
71    }
[10867]72
[15242]73    private void aggregationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
74      foreach (var dt in dataTables.Values) {
75        dt.VisualProperties.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)aggregationComboBox.SelectedItem;
[12718]76      }
[10818]77    }
[15242]78
79    private void orderComboBox_SelectedIndexChanged(object sender, EventArgs e) {
80      if (Content == null) return;
81
82      Content.Order = (PreprocessingChartContent.LegendOrder)orderComboBox.SelectedItem;
83
84      // rebuild datatables
85      InitData();
86      GenerateLayout();
[12718]87    }
[10658]88  }
89}
Note: See TracBrowser for help on using the repository browser.