Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartLogic.cs @ 10382

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

Added variable selection in line chart

File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Analysis;
6
7namespace HeuristicLab.DataPreprocessing
8{
9  public class LineChartLogic : ILineChartLogic
10  {
11    private IPreprocessingData preprocessingData;
12    private DataTable dataTable;
13
14    public LineChartLogic(IPreprocessingData preprocessingData) {
15      this.preprocessingData = preprocessingData;
16      dataTable = new DataTable("LineChart");
17      FillDataTable();
18    }
19
20    private void FillDataTable() {
21      IEnumerable<string> variableNames = preprocessingData.VariableNames;
22
23      foreach(string variableName in variableNames)
24      {
25        IList<double> values = preprocessingData.GetValues<double>(variableName);
26        DataRow row = new DataRow(variableName, "", values);
27        dataTable.Rows.Add(row);
28      }
29 
30    }
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
66  }
67}
Note: See TracBrowser for help on using the repository browser.