Changeset 10552 for branches/DataPreprocessing
- Timestamp:
- 03/05/14 17:27:27 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj
r10550 r10552 247 247 </ProjectReference> 248 248 </ItemGroup> 249 <ItemGroup>250 <EmbeddedResource Include="Views\DataPreprocessingView.resx">251 <DependentUpon>DataPreprocessingView.cs</DependentUpon>252 </EmbeddedResource>253 </ItemGroup>254 249 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 255 250 <PropertyGroup> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/HistogramLogic.cs
r10539 r10552 21 21 22 22 23 using System; 24 using System.Collections.Generic; 25 using HeuristicLab.Analysis; 26 23 27 namespace HeuristicLab.DataPreprocessing { 24 28 public class HistogramLogic : IHistogramLogic { 29 private IPreprocessingData preprocessingData; 30 private DataTable dataTable; 31 32 public HistogramLogic(IPreprocessingData preprocessingData) { 33 this.preprocessingData = preprocessingData; 34 dataTable = new DataTable("Histogram"); 35 FillDataTable(); 36 preprocessingData.Changed += PreprocessingData_Changed; 37 } 38 39 private void FillDataTable() { 40 IEnumerable<string> variableNames = preprocessingData.VariableNames; 41 42 foreach (string variableName in variableNames) { 43 IList<double> values = preprocessingData.GetValues<double>(variableName); 44 DataRow row = new DataRow(variableName, "", values); 45 row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram; 46 dataTable.Rows.Add(row); 47 } 48 49 } 50 51 public IEnumerable<object> GetVariableNames() { 52 List<string> doubleVariableNames = new List<string>(); 53 54 //only return variable names from type double 55 foreach (string variableName in preprocessingData.VariableNames) { 56 if (preprocessingData.IsType<double>(preprocessingData.GetColumnIndex(variableName))) 57 doubleVariableNames.Add(variableName); 58 } 59 60 return doubleVariableNames; 61 } 62 63 public DataTable GetDataTable() { 64 return dataTable; 65 } 66 67 public void RemoveVariable(string name) { 68 dataTable.Rows.Remove(name); 69 } 70 71 public void AddVariable(string name) { 72 IList<double> values = preprocessingData.GetValues<double>(name); 73 DataRow row = new DataRow(name, "", values); 74 row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram; 75 dataTable.Rows.Add(row); 76 } 77 78 public bool VariableIsDisplayed(string name) { 79 80 foreach (var item in dataTable.Rows) { 81 if (item.Name == name) 82 return true; 83 } 84 return false; 85 } 86 87 void PreprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e) { 88 var variableName = preprocessingData.GetVariableName(e.Column); 89 switch (e.Type) { 90 case DataPreprocessingChangedEventType.DeleteColumn: 91 dataTable.Rows.Remove(variableName); 92 break; 93 case DataPreprocessingChangedEventType.AddColumn: 94 dataTable.Rows.Add(new DataRow(variableName, String.Empty, preprocessingData.GetValues<double>(e.Column))); 95 break; 96 case DataPreprocessingChangedEventType.ChangeColumn: 97 case DataPreprocessingChangedEventType.ChangeItem: 98 dataTable.Rows.Remove(variableName); 99 dataTable.Rows.Add(new DataRow(variableName, String.Empty, preprocessingData.GetValues<double>(e.Column))); 100 break; 101 case DataPreprocessingChangedEventType.DeleteRow: 102 case DataPreprocessingChangedEventType.AddRow: 103 dataTable.Rows.Clear(); 104 FillDataTable(); 105 break; 106 } 107 } 25 108 } 26 109 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartLogic.cs
r10544 r10552 48 48 49 49 public IEnumerable<object> GetVariableNames() { 50 return preprocessingData.VariableNames; 50 List<string> doubleVariableNames = new List<string>(); 51 52 //only return variable names from type double 53 foreach (string variableName in preprocessingData.VariableNames) { 54 if (preprocessingData.IsType<double>(preprocessingData.GetColumnIndex(variableName))) 55 doubleVariableNames.Add(variableName); 56 } 57 58 return doubleVariableNames; 51 59 } 52 60 … … 54 62 return dataTable; 55 63 } 56 57 58 #region ILineChartLogic Members59 64 60 65 public void RemoveVariable(string name) { … … 67 72 dataTable.Rows.Add(row); 68 73 } 69 70 #endregion71 74 72 75 public bool VariableIsDisplayed(string name) { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IHistogramLogic.cs
r10539 r10552 21 21 22 22 23 using System.Collections.Generic; 24 using HeuristicLab.Analysis; 25 23 26 namespace HeuristicLab.DataPreprocessing { 24 27 public interface IHistogramLogic { 28 void RemoveVariable(string name); 29 30 void AddVariable(string name); 31 32 IEnumerable<object> GetVariableNames(); 33 34 DataTable GetDataTable(); 35 36 bool VariableIsDisplayed(string name); 25 37 } 26 38 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs
r10550 r10552 73 73 tranformationContent = new TransformationContent(new TransformationLogic(data, searchLogic, statisticsLogic)); 74 74 lineChartContent = new LineChartContent(new LineChartLogic(data)); 75 histogramContent = new HistogramContent(new HistogramLogic( ));75 histogramContent = new HistogramContent(new HistogramLogic(data)); 76 76 77 77 //create view items -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/HistogramView.Designer.cs
r10303 r10552 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 components = new System.ComponentModel.Container(); 26 this.groupBoxAttributs = new System.Windows.Forms.GroupBox(); 27 this.variablesListBox = new System.Windows.Forms.CheckedListBox(); 28 this.groupBoxOptions = new System.Windows.Forms.GroupBox(); 29 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 30 this.groupBoxAttributs.SuspendLayout(); 31 this.SuspendLayout(); 32 // 33 // groupBoxAttributs 34 // 35 this.groupBoxAttributs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 36 | System.Windows.Forms.AnchorStyles.Left))); 37 this.groupBoxAttributs.Controls.Add(this.variablesListBox); 38 this.groupBoxAttributs.Location = new System.Drawing.Point(3, 4); 39 this.groupBoxAttributs.Name = "groupBoxAttributs"; 40 this.groupBoxAttributs.Size = new System.Drawing.Size(153, 252); 41 this.groupBoxAttributs.TabIndex = 3; 42 this.groupBoxAttributs.TabStop = false; 43 this.groupBoxAttributs.Text = "Attributes"; 44 // 45 // variablesListBox 46 // 47 this.variablesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 48 | System.Windows.Forms.AnchorStyles.Left) 49 | System.Windows.Forms.AnchorStyles.Right))); 50 this.variablesListBox.FormattingEnabled = true; 51 this.variablesListBox.Location = new System.Drawing.Point(6, 19); 52 this.variablesListBox.Name = "variablesListBox"; 53 this.variablesListBox.Size = new System.Drawing.Size(141, 229); 54 this.variablesListBox.TabIndex = 1; 55 this.variablesListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.variablesListBox_ItemCheck); 56 // 57 // groupBoxOptions 58 // 59 this.groupBoxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 60 this.groupBoxOptions.Location = new System.Drawing.Point(4, 262); 61 this.groupBoxOptions.Name = "groupBoxOptions"; 62 this.groupBoxOptions.Size = new System.Drawing.Size(152, 138); 63 this.groupBoxOptions.TabIndex = 4; 64 this.groupBoxOptions.TabStop = false; 65 this.groupBoxOptions.Text = "Options"; 66 // 67 // viewHost 68 // 69 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 70 | System.Windows.Forms.AnchorStyles.Left) 71 | System.Windows.Forms.AnchorStyles.Right))); 72 this.viewHost.Caption = "View"; 73 this.viewHost.Content = null; 74 this.viewHost.Enabled = false; 75 this.viewHost.Location = new System.Drawing.Point(163, 4); 76 this.viewHost.Name = "viewHost"; 77 this.viewHost.ReadOnly = false; 78 this.viewHost.Size = new System.Drawing.Size(524, 396); 79 this.viewHost.TabIndex = 5; 80 this.viewHost.ViewsLabelVisible = true; 81 this.viewHost.ViewType = null; 82 // 83 // HistogramView 84 // 85 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 27 86 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 87 this.Controls.Add(this.viewHost); 88 this.Controls.Add(this.groupBoxOptions); 89 this.Controls.Add(this.groupBoxAttributs); 90 this.Name = "HistogramView"; 91 this.Size = new System.Drawing.Size(690, 403); 92 this.groupBoxAttributs.ResumeLayout(false); 93 this.ResumeLayout(false); 94 28 95 } 29 96 30 97 #endregion 98 99 private System.Windows.Forms.GroupBox groupBoxAttributs; 100 private System.Windows.Forms.CheckedListBox variablesListBox; 101 private System.Windows.Forms.GroupBox groupBoxOptions; 102 private MainForm.WindowsForms.ViewHost viewHost; 31 103 } 32 104 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/HistogramView.cs
r10303 r10552 29 29 protected override void OnContentChanged() { 30 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); 31 57 } 32 58 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/LineChartView.Designer.cs
r10539 r10552 47 47 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 48 48 this.variablesListBox = new System.Windows.Forms.CheckedListBox(); 49 this.groupBoxAttributs = new System.Windows.Forms.GroupBox(); 50 this.groupBoxOptions = new System.Windows.Forms.GroupBox(); 51 this.groupBoxAttributs.SuspendLayout(); 49 52 this.SuspendLayout(); 50 53 // 51 54 // viewHost 52 55 // 53 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 54 | System.Windows.Forms.AnchorStyles.Left) 56 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | System.Windows.Forms.AnchorStyles.Left) 55 58 | System.Windows.Forms.AnchorStyles.Right))); 56 59 this.viewHost.Caption = "View"; 57 60 this.viewHost.Content = null; 58 61 this.viewHost.Enabled = false; 59 this.viewHost.Location = new System.Drawing.Point(1 55, 4);62 this.viewHost.Location = new System.Drawing.Point(162, 4); 60 63 this.viewHost.Name = "viewHost"; 61 64 this.viewHost.ReadOnly = false; 62 this.viewHost.Size = new System.Drawing.Size( 922, 559);65 this.viewHost.Size = new System.Drawing.Size(489, 396); 63 66 this.viewHost.TabIndex = 0; 64 67 this.viewHost.ViewsLabelVisible = true; … … 67 70 // variablesListBox 68 71 // 69 this.variablesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 70 | System.Windows.Forms.AnchorStyles.Left))); 72 this.variablesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 73 | System.Windows.Forms.AnchorStyles.Left) 74 | System.Windows.Forms.AnchorStyles.Right))); 71 75 this.variablesListBox.FormattingEnabled = true; 72 this.variablesListBox.Location = new System.Drawing.Point( 3, 4);76 this.variablesListBox.Location = new System.Drawing.Point(6, 19); 73 77 this.variablesListBox.Name = "variablesListBox"; 74 this.variablesListBox.Size = new System.Drawing.Size(14 6, 559);78 this.variablesListBox.Size = new System.Drawing.Size(141, 229); 75 79 this.variablesListBox.TabIndex = 1; 76 80 this.variablesListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.variablesListBox_ItemCheck); 81 // 82 // groupBoxAttributs 83 // 84 this.groupBoxAttributs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 85 | System.Windows.Forms.AnchorStyles.Left))); 86 this.groupBoxAttributs.Controls.Add(this.variablesListBox); 87 this.groupBoxAttributs.Location = new System.Drawing.Point(3, 4); 88 this.groupBoxAttributs.Name = "groupBoxAttributs"; 89 this.groupBoxAttributs.Size = new System.Drawing.Size(153, 252); 90 this.groupBoxAttributs.TabIndex = 2; 91 this.groupBoxAttributs.TabStop = false; 92 this.groupBoxAttributs.Text = "Attributes"; 93 // 94 // groupBoxOptions 95 // 96 this.groupBoxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 97 this.groupBoxOptions.Location = new System.Drawing.Point(4, 262); 98 this.groupBoxOptions.Name = "groupBoxOptions"; 99 this.groupBoxOptions.Size = new System.Drawing.Size(152, 138); 100 this.groupBoxOptions.TabIndex = 3; 101 this.groupBoxOptions.TabStop = false; 102 this.groupBoxOptions.Text = "Options"; 77 103 // 78 104 // LineChartView … … 80 106 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 81 107 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 82 this.Controls.Add(this.variablesListBox); 108 this.Controls.Add(this.groupBoxOptions); 109 this.Controls.Add(this.groupBoxAttributs); 83 110 this.Controls.Add(this.viewHost); 84 111 this.Name = "LineChartView"; 85 this.Size = new System.Drawing.Size(1080, 582); 112 this.Size = new System.Drawing.Size(654, 403); 113 this.groupBoxAttributs.ResumeLayout(false); 86 114 this.ResumeLayout(false); 87 115 … … 92 120 private MainForm.WindowsForms.ViewHost viewHost; 93 121 private System.Windows.Forms.CheckedListBox variablesListBox; 122 private System.Windows.Forms.GroupBox groupBoxAttributs; 123 private System.Windows.Forms.GroupBox groupBoxOptions; 94 124 } 95 125 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/PreprocessingDataTableView.cs
r10546 r10552 28 28 InitializeComponent(); 29 29 30 this.Controls.Remove(nameLabel);31 this.Controls.Remove(nameTextBox);32 this.Controls.Remove(infoLabel);33 30 } 34 31
Note: See TracChangeset
for help on using the changeset viewer.