using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Analysis; namespace HeuristicLab.DataPreprocessing { public class LineChartLogic : ILineChartLogic { private IPreprocessingData preprocessingData; private DataTable dataTable; public LineChartLogic(IPreprocessingData preprocessingData) { this.preprocessingData = preprocessingData; dataTable = new DataTable("LineChart"); FillDataTable(); } private void FillDataTable() { IEnumerable variableNames = preprocessingData.VariableNames; foreach(string variableName in variableNames) { IList values = preprocessingData.GetValues(variableName); DataRow row = new DataRow(variableName, "", values); dataTable.Rows.Add(row); } } public IEnumerable GetVariableNames() { return preprocessingData.VariableNames; } public DataTable GetDataTable() { return dataTable; } #region ILineChartLogic Members public void RemoveVariable(string name) { dataTable.Rows.Remove(name); } public void AddVariable(string name) { IList values = preprocessingData.GetValues(name); DataRow row = new DataRow(name, "", values); dataTable.Rows.Add(row); } #endregion public bool VariableIsDisplayed(string name) { foreach (var item in dataTable.Rows) { if(item.Name == name) return true; } return false; } } }