Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/14 16:32:24 (10 years ago)
Author:
aesterer
Message:

Added variable selection in line chart

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartLogic.cs

    r10377 r10382  
    77namespace HeuristicLab.DataPreprocessing
    88{
    9   public class LineChartLogic:ILineChartLogic
     9  public class LineChartLogic : ILineChartLogic
    1010  {
    1111    private IPreprocessingData preprocessingData;
     12    private DataTable dataTable;
    1213
    1314    public LineChartLogic(IPreprocessingData preprocessingData) {
    1415      this.preprocessingData = preprocessingData;
    15  
     16      dataTable = new DataTable("LineChart");
     17      FillDataTable();
    1618    }
    1719
    18     public void FillDataTable(DataTable dataTable) {
     20    private void FillDataTable() {
    1921      IEnumerable<string> variableNames = preprocessingData.VariableNames;
    2022
     
    2729 
    2830    }
     31
     32    public IEnumerable<object> GetVariableNames()
     33    {
     34      return preprocessingData.VariableNames;
     35    }
     36
     37    public DataTable GetDataTable()
     38    {
     39      return dataTable;
     40    }
     41
     42
     43    #region ILineChartLogic Members
     44
     45    public void RemoveVariable(string name) {
     46      dataTable.Rows.Remove(name);
     47    }
     48
     49    public void AddVariable(string name) {
     50      IList<double> values = preprocessingData.GetValues<double>(name);
     51      DataRow row = new DataRow(name, "", values);
     52      dataTable.Rows.Add(row);
     53    }
     54
     55    #endregion
     56
     57    public bool VariableIsDisplayed(string name) {
     58
     59      foreach (var item in dataTable.Rows) {
     60         if(item.Name == name)
     61           return true;
     62      }
     63      return false;
     64    }
     65
    2966  }
    3067}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/ILineChartLogic.cs

    r10377 r10382  
    99  public interface ILineChartLogic
    1010  {
    11     void FillDataTable(DataTable dataTable);
     11
     12    void RemoveVariable(string name);
     13
     14    void AddVariable(string name);
     15
     16    IEnumerable<object> GetVariableNames();
     17
     18    DataTable GetDataTable();
     19
     20    bool VariableIsDisplayed(string name);
    1221  }
    1322}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/LineChartView.Designer.cs

    r10377 r10382  
    3636      this.viewHost.Content = null;
    3737      this.viewHost.Enabled = false;
    38       this.viewHost.Location = new System.Drawing.Point(155, 3);
     38      this.viewHost.Location = new System.Drawing.Point(155, 4);
    3939      this.viewHost.Name = "viewHost";
    4040      this.viewHost.ReadOnly = false;
    41       this.viewHost.Size = new System.Drawing.Size(922, 576);
     41      this.viewHost.Size = new System.Drawing.Size(922, 559);
    4242      this.viewHost.TabIndex = 0;
    4343      this.viewHost.ViewsLabelVisible = true;
     
    4949            | System.Windows.Forms.AnchorStyles.Left)));
    5050      this.variablesListBox.FormattingEnabled = true;
    51       this.variablesListBox.Location = new System.Drawing.Point(4, 4);
     51      this.variablesListBox.Location = new System.Drawing.Point(3, 4);
    5252      this.variablesListBox.Name = "variablesListBox";
    53       this.variablesListBox.Size = new System.Drawing.Size(145, 574);
     53      this.variablesListBox.Size = new System.Drawing.Size(146, 559);
    5454      this.variablesListBox.TabIndex = 1;
    5555      this.variablesListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.variablesListBox_ItemCheck);
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/LineChartView.cs

    r10377 r10382  
    1919  public partial class LineChartView : ItemView {
    2020
    21     private DataTable dataTable;
    22 
    2321    public LineChartView() {
    2422      InitializeComponent();
     
    2624
    2725    private void InitDataTable() {
    28       dataTable = new DataTable("LineChart");
    2926      ILineChartLogic logic = Content.LineChartLogic;
    30       logic.FillDataTable(dataTable);
     27      viewHost.Content = logic.GetDataTable();
    3128    }
    3229
     
    4138        InitDataTable();
    4239        InitVariablesListBox();
    43         viewHost.Content = dataTable;
    44 
    4540      }
    4641    }
     
    4944      ILineChartLogic logic = Content.LineChartLogic;
    5045
    51       //foreach (var variableName in logic.GetVariableNames()) {
    52       //  variablesListBox.Items.Add(variableName,true);
    53       //}
     46      foreach (var variableName in logic.GetVariableNames()) {
     47        variablesListBox.Items.Add(variableName,true);
     48      }
    5449    }
    5550
    5651    private void variablesListBox_ItemCheck(object sender, ItemCheckEventArgs e) {
    57       //string item = variablesListBox.Items[e.Index] as string;
     52      string item = variablesListBox.Items[e.Index] as string;
    5853
     54
     55      if (e.NewValue == CheckState.Checked && !Content.LineChartLogic.VariableIsDisplayed(item))
     56        Content.LineChartLogic.AddVariable(item);
     57      else if(e.NewValue == CheckState.Unchecked && Content.LineChartLogic.VariableIsDisplayed(item))
     58        Content.LineChartLogic.RemoveVariable(item);
    5959    }
    6060  }
Note: See TracChangeset for help on using the changeset viewer.