Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 10552 was 10552, checked in by aesterer, 10 years ago

Revised line chart and added histogram

File size: 1.8 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.Core.Views;
10using HeuristicLab.MainForm;
11using HeuristicLab.MainForm.WindowsForms;
12using HeuristicLab.Problems.DataAnalysis;
13using HeuristicLab.Data.Views;
14
15namespace HeuristicLab.DataPreprocessing.Views {
16
17  [View("Histogram View")]
18  [Content(typeof(HistogramContent), false)]
19  public partial class HistogramView : ItemView {
20    public HistogramView() {
21      InitializeComponent();
22    }
23
24    public new HistogramContent Content {
25      get { return (HistogramContent)base.Content; }
26      set { base.Content = value; }
27    }
28
29    protected override void OnContentChanged() {
30      base.OnContentChanged();
31      if (Content != null) {
32        InitDataTable();
33        InitVariablesListBox();
34      }
35    }
36
37    private void InitVariablesListBox() {
38      IHistogramLogic logic = Content.HistogramLogic;
39
40      foreach (var variableName in logic.GetVariableNames()) {
41        variablesListBox.Items.Add(variableName, true);
42      }
43    }
44
45    private void InitDataTable() {
46      IHistogramLogic logic = Content.HistogramLogic;
47      viewHost.Content = logic.GetDataTable();
48    }
49
50    private void variablesListBox_ItemCheck(object sender, ItemCheckEventArgs e) {
51      string item = variablesListBox.Items[e.Index] as string;
52
53      if (e.NewValue == CheckState.Checked && !Content.HistogramLogic.VariableIsDisplayed(item))
54        Content.HistogramLogic.AddVariable(item);
55      else if (e.NewValue == CheckState.Unchecked && Content.HistogramLogic.VariableIsDisplayed(item))
56        Content.HistogramLogic.RemoveVariable(item);
57    }
58  }
59}
60
61
62
63
64
Note: See TracBrowser for help on using the repository browser.