Changeset 14511
- Timestamp:
- 12/20/16 15:28:14 (8 years ago)
- Location:
- branches/DataPreprocessing Enhancements
- Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj
r14460 r14511 281 281 <Compile Include="PreprocessingCheckedVariablesView.Designer.cs"> 282 282 <DependentUpon>PreprocessingCheckedVariablesView.cs</DependentUpon> 283 </Compile>284 <Compile Include="PreprocessingCheckedItemListView.cs">285 <SubType>UserControl</SubType>286 </Compile>287 <Compile Include="PreprocessingCheckedItemListView.Designer.cs">288 <DependentUpon>PreprocessingCheckedItemListView.cs</DependentUpon>289 283 </Compile> 290 284 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.Designer.cs
r14268 r14511 62 62 // optionsBox 63 63 // 64 this.optionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)65 | System.Windows.Forms.AnchorStyles.Right)));66 64 this.optionsBox.Controls.Add(this.allInOneCheckBox); 67 this.optionsBox.Location = new System.Drawing.Point(4, 262); 65 this.optionsBox.Dock = System.Windows.Forms.DockStyle.Bottom; 66 this.optionsBox.Location = new System.Drawing.Point(0, 357); 68 67 this.optionsBox.Name = "optionsBox"; 69 this.optionsBox.Size = new System.Drawing.Size( 84, 138);68 this.optionsBox.Size = new System.Drawing.Size(180, 46); 70 69 this.optionsBox.TabIndex = 7; 71 70 this.optionsBox.TabStop = false; -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.cs
r14473 r14511 62 62 63 63 allInOneDataTable.Rows.Clear(); 64 foreach (var variable in Content.VariableItemList.CheckedItems) { 65 allInOneDataTable.Rows.Add(allInOneDataRows[variable.Value.Value]); 66 } 64 var rows = Content.VariableItemList.CheckedItems.Select(v => allInOneDataRows[v.Value.Value]); 65 allInOneDataTable.Rows.AddRange(rows); 67 66 } 68 67 … … 83 82 dt.Rows.Add(row); 84 83 85 try { 86 double axisMin, axisMax, axisInterval; 87 ChartUtil.CalculateOptimalAxisInterval(row.Values.Min(), row.Values.Max(), out axisMin, out axisMax, out axisInterval); 88 dt.VisualProperties.YAxisMinimumAuto = false; 89 dt.VisualProperties.YAxisMaximumAuto = false; 90 dt.VisualProperties.YAxisMinimumFixedValue = axisMin; 91 dt.VisualProperties.YAxisMaximumFixedValue = axisMax; 92 } catch (ArgumentOutOfRangeException) { } // missing values lead to NaNs 84 var validValues = row.Values.Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList(); 85 if (validValues.Any()) { 86 try { 87 double axisMin, axisMax, axisInterval; 88 ChartUtil.CalculateOptimalAxisInterval(validValues.Min(), validValues.Max(), out axisMin, out axisMax, out axisInterval); 89 dt.VisualProperties.YAxisMinimumAuto = false; 90 dt.VisualProperties.YAxisMaximumAuto = false; 91 dt.VisualProperties.YAxisMinimumFixedValue = axisMin; 92 dt.VisualProperties.YAxisMaximumFixedValue = axisMax; 93 } catch (ArgumentOutOfRangeException) { } 94 } 93 95 return dt; 94 96 } … … 116 118 // ToDo: avoid clearing all rows, but how? 117 119 allInOneDataTable.Rows.Clear(); 118 foreach (var variable in Content.VariableItemList.CheckedItems) { 119 allInOneDataTable.Rows.Add(allInOneDataRows[variable.Value.Value]); 120 } 120 var rows = Content.VariableItemList.CheckedItems.Select(r => allInOneDataRows[r.Value.Value]); 121 allInOneDataTable.Rows.AddRange(rows); 121 122 } else { 122 123 allInOneDataTable.Rows.Remove(variableName); -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
r14459 r14511 66 66 67 67 protected virtual int GetNumberOfVisibleDataTables() { 68 return checkedItemList.Content.CheckedItems.Count();68 return Content.VariableItemList.CheckedItems.Count(); 69 69 } 70 70 … … 150 150 #endregion 151 151 152 protected override void CheckedChangedUpdate() { 153 GenerateLayout(); 154 } 155 152 156 #region Generate Layout 153 157 protected void GenerateLayout() { 158 if (suppressCheckedChangedUpdate) 159 return; 160 154 161 tableLayoutPanel.SuspendRepaint(); 155 162 -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.Designer.cs
r14381 r14511 47 47 this.components = new System.ComponentModel.Container(); 48 48 this.splitContainer = new System.Windows.Forms.SplitContainer(); 49 this.checkedItemList = new HeuristicLab.DataPreprocessing.Views.PreprocessingCheckedItemListView(); 50 this.variablesListcontextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 51 this.checkInputsTargetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 this.checkOnlyInputsTargetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.checkAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 this.uncheckAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49 this.groupBox1 = new System.Windows.Forms.GroupBox(); 50 this.uncheckAllButton = new System.Windows.Forms.Button(); 51 this.checkAllButton = new System.Windows.Forms.Button(); 52 this.checkInputsTargetButton = new System.Windows.Forms.Button(); 53 this.variablesListView = new System.Windows.Forms.ListView(); 54 this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 55 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 55 56 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 56 57 this.splitContainer.Panel1.SuspendLayout(); 57 58 this.splitContainer.SuspendLayout(); 58 this. variablesListcontextMenuStrip.SuspendLayout();59 this.groupBox1.SuspendLayout(); 59 60 this.SuspendLayout(); 60 61 // … … 62 63 // 63 64 this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 65 this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; 64 66 this.splitContainer.Location = new System.Drawing.Point(0, 0); 65 67 this.splitContainer.Name = "splitContainer"; … … 67 69 // splitContainer.Panel1 68 70 // 69 this.splitContainer.Panel1.Controls.Add(this. checkedItemList);71 this.splitContainer.Panel1.Controls.Add(this.groupBox1); 70 72 this.splitContainer.Size = new System.Drawing.Size(654, 403); 71 this.splitContainer.SplitterDistance = 91;73 this.splitContainer.SplitterDistance = 180; 72 74 this.splitContainer.TabIndex = 7; 73 75 // 74 // checkedItemList76 // groupBox1 75 77 // 76 this.checkedItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 77 | System.Windows.Forms.AnchorStyles.Left) 78 this.groupBox1.Controls.Add(this.uncheckAllButton); 79 this.groupBox1.Controls.Add(this.checkAllButton); 80 this.groupBox1.Controls.Add(this.checkInputsTargetButton); 81 this.groupBox1.Controls.Add(this.variablesListView); 82 this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; 83 this.groupBox1.Location = new System.Drawing.Point(0, 0); 84 this.groupBox1.Name = "groupBox1"; 85 this.groupBox1.Size = new System.Drawing.Size(180, 403); 86 this.groupBox1.TabIndex = 7; 87 this.groupBox1.TabStop = false; 88 this.groupBox1.Text = "Variables"; 89 // 90 // uncheckAllButton 91 // 92 this.uncheckAllButton.Location = new System.Drawing.Point(66, 19); 93 this.uncheckAllButton.Name = "uncheckAllButton"; 94 this.uncheckAllButton.Size = new System.Drawing.Size(24, 24); 95 this.uncheckAllButton.TabIndex = 7; 96 this.uncheckAllButton.Text = "N"; 97 this.toolTip.SetToolTip(this.uncheckAllButton, "Uncheck all variables"); 98 this.uncheckAllButton.UseVisualStyleBackColor = true; 99 this.uncheckAllButton.Click += new System.EventHandler(this.uncheckAllButton_Click); 100 // 101 // checkAllButton 102 // 103 this.checkAllButton.Location = new System.Drawing.Point(36, 19); 104 this.checkAllButton.Name = "checkAllButton"; 105 this.checkAllButton.Size = new System.Drawing.Size(24, 24); 106 this.checkAllButton.TabIndex = 7; 107 this.checkAllButton.Text = "A"; 108 this.toolTip.SetToolTip(this.checkAllButton, "Check all variables"); 109 this.checkAllButton.UseVisualStyleBackColor = true; 110 this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click); 111 // 112 // checkInputsTargetButton 113 // 114 this.checkInputsTargetButton.Location = new System.Drawing.Point(6, 19); 115 this.checkInputsTargetButton.Name = "checkInputsTargetButton"; 116 this.checkInputsTargetButton.Size = new System.Drawing.Size(24, 24); 117 this.checkInputsTargetButton.TabIndex = 7; 118 this.checkInputsTargetButton.Text = "I"; 119 this.toolTip.SetToolTip(this.checkInputsTargetButton, "Check only inputs and target variable"); 120 this.checkInputsTargetButton.UseVisualStyleBackColor = true; 121 this.checkInputsTargetButton.Click += new System.EventHandler(this.checkInputsTargetButton_Click); 122 // 123 // variablesListView 124 // 125 this.variablesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 126 | System.Windows.Forms.AnchorStyles.Left) 78 127 | System.Windows.Forms.AnchorStyles.Right))); 79 this.checkedItemList.Caption = "View"; 80 this.checkedItemList.Content = null; 81 this.checkedItemList.ContextMenuStrip = this.variablesListcontextMenuStrip; 82 this.checkedItemList.Location = new System.Drawing.Point(4, 4); 83 this.checkedItemList.Name = "checkedItemList"; 84 this.checkedItemList.ReadOnly = false; 85 this.checkedItemList.Size = new System.Drawing.Size(84, 252); 86 this.checkedItemList.TabIndex = 4; 128 this.variablesListView.CheckBoxes = true; 129 this.variablesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 130 this.columnHeader}); 131 this.variablesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; 132 this.variablesListView.HideSelection = false; 133 this.variablesListView.Location = new System.Drawing.Point(6, 49); 134 this.variablesListView.Name = "variablesListView"; 135 this.variablesListView.Size = new System.Drawing.Size(168, 348); 136 this.variablesListView.TabIndex = 6; 137 this.variablesListView.UseCompatibleStateImageBehavior = false; 138 this.variablesListView.View = System.Windows.Forms.View.Details; 87 139 // 88 // variablesListcontextMenuStrip140 // columnHeader 89 141 // 90 this.variablesListcontextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 91 this.checkInputsTargetToolStripMenuItem, 92 this.checkOnlyInputsTargetToolStripMenuItem, 93 this.checkAllToolStripMenuItem, 94 this.uncheckAllToolStripMenuItem}); 95 this.variablesListcontextMenuStrip.Name = "variablesListcontextMenuStrip"; 96 this.variablesListcontextMenuStrip.Size = new System.Drawing.Size(211, 92); 97 this.variablesListcontextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.variablesListcontextMenuStrip_Opening); 98 // 99 // checkInputsTargetToolStripMenuItem 100 // 101 this.checkInputsTargetToolStripMenuItem.Name = "checkInputsTargetToolStripMenuItem"; 102 this.checkInputsTargetToolStripMenuItem.Size = new System.Drawing.Size(210, 22); 103 this.checkInputsTargetToolStripMenuItem.Text = "Check Inputs+Target"; 104 this.checkInputsTargetToolStripMenuItem.Click += new System.EventHandler(this.checkInputsTargetToolStripMenuItem_Click); 105 // 106 // checkOnlyInputsTargetToolStripMenuItem 107 // 108 this.checkOnlyInputsTargetToolStripMenuItem.Name = "checkOnlyInputsTargetToolStripMenuItem"; 109 this.checkOnlyInputsTargetToolStripMenuItem.Size = new System.Drawing.Size(210, 22); 110 this.checkOnlyInputsTargetToolStripMenuItem.Text = "Check only Inputs+Target"; 111 this.checkOnlyInputsTargetToolStripMenuItem.Click += new System.EventHandler(this.checkOnlyInputsTargetToolStripMenuItem_Click); 112 // 113 // checkAllToolStripMenuItem 114 // 115 this.checkAllToolStripMenuItem.Name = "checkAllToolStripMenuItem"; 116 this.checkAllToolStripMenuItem.Size = new System.Drawing.Size(210, 22); 117 this.checkAllToolStripMenuItem.Text = "Check All"; 118 this.checkAllToolStripMenuItem.Click += new System.EventHandler(this.checkAllToolStripMenuItem_Click); 119 // 120 // uncheckAllToolStripMenuItem 121 // 122 this.uncheckAllToolStripMenuItem.Name = "uncheckAllToolStripMenuItem"; 123 this.uncheckAllToolStripMenuItem.Size = new System.Drawing.Size(210, 22); 124 this.uncheckAllToolStripMenuItem.Text = "Uncheck All"; 125 this.uncheckAllToolStripMenuItem.Click += new System.EventHandler(this.uncheckAllToolStripMenuItem_Click); 142 this.columnHeader.Text = ""; 143 this.columnHeader.Width = 164; 126 144 // 127 145 // PreprocessingCheckedVariablesView … … 135 153 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 136 154 this.splitContainer.ResumeLayout(false); 137 this. variablesListcontextMenuStrip.ResumeLayout(false);155 this.groupBox1.ResumeLayout(false); 138 156 this.ResumeLayout(false); 139 157 … … 141 159 142 160 #endregion 143 144 protected PreprocessingCheckedItemListView checkedItemList;145 161 protected System.Windows.Forms.SplitContainer splitContainer; 146 private System.Windows.Forms.ContextMenuStrip variablesListcontextMenuStrip; 147 private System.Windows.Forms.ToolStripMenuItem checkInputsTargetToolStripMenuItem; 148 private System.Windows.Forms.ToolStripMenuItem checkAllToolStripMenuItem; 149 private System.Windows.Forms.ToolStripMenuItem uncheckAllToolStripMenuItem; 150 private System.Windows.Forms.ToolStripMenuItem checkOnlyInputsTargetToolStripMenuItem; 162 private System.Windows.Forms.ListView variablesListView; 163 private System.Windows.Forms.GroupBox groupBox1; 164 private System.Windows.Forms.ToolTip toolTip; 165 private System.Windows.Forms.ColumnHeader columnHeader; 166 private System.Windows.Forms.Button checkInputsTargetButton; 167 private System.Windows.Forms.Button uncheckAllButton; 168 private System.Windows.Forms.Button checkAllButton; 151 169 } 152 170 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs
r14459 r14511 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Drawing; … … 26 25 using System.Windows.Forms; 27 26 using HeuristicLab.Collections; 27 using HeuristicLab.Common.Resources; 28 28 using HeuristicLab.Core.Views; 29 29 using HeuristicLab.Data; … … 35 35 public partial class PreprocessingCheckedVariablesView : ItemView { 36 36 37 protected bool suppressCheckedChangedUpdate = false; 38 37 39 public new PreprocessingChartContent Content { 38 40 get { return (PreprocessingChartContent)base.Content; } … … 42 44 protected PreprocessingCheckedVariablesView() { 43 45 InitializeComponent(); 46 checkInputsTargetButton.Text = string.Empty; 47 checkInputsTargetButton.Image = VSImageLibrary.Namespace; 48 checkAllButton.Text = string.Empty; 49 checkAllButton.Image = VSImageLibrary.Expand; 50 uncheckAllButton.Text = string.Empty; 51 uncheckAllButton.Image = VSImageLibrary.Collapse; 44 52 } 45 53 … … 48 56 } 49 57 protected IList<string> GetCheckedVariables() { 50 return checkedItemList.Content.CheckedItems.Select(i => i.Value.Value).ToList();58 return Content.VariableItemList.CheckedItems.Select(i => i.Value.Value).ToList(); 51 59 } 52 60 … … 55 63 if (Content == null) return; 56 64 57 if (Content.VariableItemList == null) { 58 IList<string> inputs = Content.PreprocessingData.InputVariables; 59 if (Content.PreprocessingData.TargetVariable != null) 60 inputs = inputs.Union(new[] { Content.PreprocessingData.TargetVariable }).ToList(); 61 Content.VariableItemList = Content.CreateVariableItemList(inputs); 62 } else { 63 var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value); 64 Content.VariableItemList = Content.CreateVariableItemList(checkedNames.ToList()); 65 variablesListView.ItemChecked -= variablesListView_ItemChecked; 66 variablesListView.Items.Clear(); 67 foreach (var variable in Content.VariableItemList) { 68 bool isInputTarget = Content.PreprocessingData.InputVariables.Contains(variable.Value) 69 || Content.PreprocessingData.TargetVariable == variable.Value; 70 variablesListView.Items.Add(new ListViewItem(variable.Value) { 71 Tag = variable, 72 Checked = IsVariableChecked(variable.Value), 73 ForeColor = isInputTarget ? Color.Black : Color.Gray 74 }); 65 75 } 66 Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged; 67 68 checkedItemList.Content = Content.VariableItemList; 69 var target = Content.PreprocessingData.TargetVariable; 70 var inputAndTarget = Content.PreprocessingData.InputVariables.Union(target != null ? new[] { target } : new string[] { }); 71 foreach (var col in Content.PreprocessingData.GetDoubleVariableNames().Except(inputAndTarget)) { 72 var listViewItem = checkedItemList.ItemsListView.FindItemWithText(col, false, 0, false); 73 listViewItem.ForeColor = Color.LightGray; 74 } 76 variablesListView.ItemChecked += variablesListView_ItemChecked; 75 77 } 76 78 protected override void RegisterContentEvents() { 77 79 base.RegisterContentEvents(); 78 80 Content.PreprocessingData.Changed += PreprocessingData_Changed; 79 Content. PreprocessingData.SelectionChanged += PreprocessingData_SelctionChanged;81 Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged; 80 82 } 83 81 84 protected override void DeregisterContentEvents() { 82 85 Content.PreprocessingData.Changed -= PreprocessingData_Changed; 83 Content. PreprocessingData.SelectionChanged -= PreprocessingData_SelctionChanged;86 Content.VariableItemList.CheckedItemsChanged -= CheckedItemsChanged; 84 87 base.DeregisterContentEvents(); 85 88 } 86 89 87 90 protected virtual void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) { 91 // sync listview 92 foreach (var item in checkedItems.Items) 93 variablesListView.Items[item.Index].Checked = Content.VariableItemList.ItemChecked(item.Value); 94 } 95 private void variablesListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 96 // sync checked item list 97 var variable = (StringValue)e.Item.Tag; 98 Content.VariableItemList.SetItemCheckedState(variable, e.Item.Checked); 88 99 } 89 100 … … 109 120 Content.VariableItemList.Add(new StringValue(name)); 110 121 if (!Content.PreprocessingData.InputVariables.Contains(name) && Content.PreprocessingData.TargetVariable != name) { 111 var listViewItem = checkedItemList.ItemsListView.FindItemWithText(name, false, 0, false);122 var listViewItem = variablesListView.FindItemWithText(name, false, 0, false); 112 123 listViewItem.ForeColor = Color.LightGray; 113 124 } … … 123 134 } 124 135 125 protected virtual void PreprocessingData_SelctionChanged(object sender, EventArgs e) { 136 protected virtual void CheckedChangedUpdate() { 137 126 138 } 127 139 128 #region ContextMenu Events 129 private void variablesListcontextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 130 var data = Content.PreprocessingData; 131 checkInputsTargetToolStripMenuItem.Text = "Check Inputs" + (data.TargetVariable != null ? "+Target" : ""); 132 checkOnlyInputsTargetToolStripMenuItem.Text = "Check only Inputs" + (data.TargetVariable != null ? "+Target" : ""); 140 private void checkInputsTargetButton_Click(object sender, System.EventArgs e) { 141 suppressCheckedChangedUpdate = true; 142 foreach (var name in Content.VariableItemList) { 143 var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value; 144 Content.VariableItemList.SetItemCheckedState(name, isInputTarget); 145 } 146 suppressCheckedChangedUpdate = false; 147 CheckedChangedUpdate(); 133 148 } 134 private void checkInputsTargetToolStripMenuItem_Click(object sender, EventArgs e) { 135 foreach (var name in checkedItemList.Content) { 136 var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value; 137 if (isInputTarget) { 138 checkedItemList.Content.SetItemCheckedState(name, true); 139 } 149 150 private void checkAllButton_Click(object sender, System.EventArgs e) { 151 suppressCheckedChangedUpdate = true; 152 foreach (var name in Content.VariableItemList) { 153 Content.VariableItemList.SetItemCheckedState(name, true); 140 154 } 155 suppressCheckedChangedUpdate = false; 156 CheckedChangedUpdate(); 141 157 } 142 private void checkOnlyInputsTargetToolStripMenuItem_Click(object sender, EventArgs e) { 143 foreach (var name in checkedItemList.Content) { 144 var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value; 145 checkedItemList.Content.SetItemCheckedState(name, isInputTarget); 158 159 private void uncheckAllButton_Click(object sender, System.EventArgs e) { 160 suppressCheckedChangedUpdate = true; 161 foreach (var name in Content.VariableItemList) { 162 Content.VariableItemList.SetItemCheckedState(name, false); 146 163 } 164 suppressCheckedChangedUpdate = false; 165 CheckedChangedUpdate(); 147 166 } 148 private void checkAllToolStripMenuItem_Click(object sender, EventArgs e) {149 foreach (var name in checkedItemList.Content) {150 checkedItemList.Content.SetItemCheckedState(name, true);151 }152 }153 private void uncheckAllToolStripMenuItem_Click(object sender, EventArgs e) {154 foreach (var name in checkedItemList.Content) {155 checkedItemList.Content.SetItemCheckedState(name, false);156 }157 }158 #endregion159 167 } 160 168 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs
r14388 r14511 70 70 this.SuspendLayout(); 71 71 // 72 // checkedItemList73 //74 this.checkedItemList.Size = new System.Drawing.Size(113, 369);75 //76 72 // splitContainer 77 73 // … … 84 80 // 85 81 this.splitContainer.Panel2.Controls.Add(this.frameTableLayoutPanel); 86 this.splitContainer.Size = new System.Drawing.Size(863, 520);87 this.splitContainer.SplitterDistance = 120;88 82 // 89 83 // frameTableLayoutPanel … … 101 95 this.frameTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); 102 96 this.frameTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 103 this.frameTableLayoutPanel.Size = new System.Drawing.Size( 739, 520);97 this.frameTableLayoutPanel.Size = new System.Drawing.Size(470, 403); 104 98 this.frameTableLayoutPanel.TabIndex = 0; 105 99 // … … 188 182 // sizeGroupBox 189 183 // 190 this.sizeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)191 | System.Windows.Forms.AnchorStyles.Right)));192 184 this.sizeGroupBox.Controls.Add(this.heightLabel); 193 185 this.sizeGroupBox.Controls.Add(this.widthLabel); 194 186 this.sizeGroupBox.Controls.Add(this.heightTrackBar); 195 187 this.sizeGroupBox.Controls.Add(this.widthTrackBar); 196 this.sizeGroupBox.Location = new System.Drawing.Point(4, 379); 188 this.sizeGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom; 189 this.sizeGroupBox.Location = new System.Drawing.Point(0, 267); 197 190 this.sizeGroupBox.Name = "sizeGroupBox"; 198 this.sizeGroupBox.Size = new System.Drawing.Size(1 13, 124);191 this.sizeGroupBox.Size = new System.Drawing.Size(180, 136); 199 192 this.sizeGroupBox.TabIndex = 5; 200 193 this.sizeGroupBox.TabStop = false; … … 227 220 this.heightTrackBar.Maximum = 100; 228 221 this.heightTrackBar.Name = "heightTrackBar"; 229 this.heightTrackBar.Size = new System.Drawing.Size(1 01, 45);222 this.heightTrackBar.Size = new System.Drawing.Size(168, 45); 230 223 this.heightTrackBar.SmallChange = 10; 231 224 this.heightTrackBar.TabIndex = 0; … … 242 235 this.widthTrackBar.Maximum = 100; 243 236 this.widthTrackBar.Name = "widthTrackBar"; 244 this.widthTrackBar.Size = new System.Drawing.Size(1 01, 45);237 this.widthTrackBar.Size = new System.Drawing.Size(168, 45); 245 238 this.widthTrackBar.SmallChange = 10; 246 239 this.widthTrackBar.TabIndex = 0; … … 254 247 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 255 248 this.Name = "ScatterPlotMultiView"; 256 this.Size = new System.Drawing.Size(863, 520);257 249 this.splitContainer.Panel1.ResumeLayout(false); 258 250 this.splitContainer.Panel2.ResumeLayout(false); -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
r14495 r14511 61 61 protected override void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) { 62 62 base.CheckedItemsChanged(sender, checkedItems); 63 if (suppressCheckedChangedUpdate) 64 return; 63 65 foreach (var variable in checkedItems.Items.Select(i => i.Value.Value)) { 64 66 if (IsVariableChecked(variable)) … … 74 76 75 77 // find index to insert 76 var variables = checkedItemList.Content.Select(v => v.Value).ToList();78 var variables = Content.VariableItemList.Select(v => v.Value).ToList(); 77 79 int idx = variables // all variables 78 80 .TakeWhile(t => t != variable) // ... until the variable that was checked … … 285 287 #endregion 286 288 289 protected override void CheckedChangedUpdate() { 290 GenerateCharts(); 291 } 292 287 293 #region Generate Charts 288 294 private void GenerateCharts() { 295 if (suppressCheckedChangedUpdate) return; 296 289 297 var variables = GetCheckedVariables(); 290 298 … … 365 373 DataTableControl pcv = (DataTableControl)sender; 366 374 HistogramContent histoContent = new HistogramContent(Content.PreprocessingData); // create new content 367 histoContent.VariableItemList = Content.CreateVariableItemList();375 //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList(); 368 376 var dataTable = pcv.Content; 369 377 -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r14467 r14511 36 36 private ICheckedItemList<StringValue> variableItemList = null; 37 37 public ICheckedItemList<StringValue> VariableItemList { 38 get { return this.variableItemList; } 39 set { this.variableItemList = value; } 38 get { 39 if (variableItemList == null) 40 variableItemList = CreateVariableItemList(); 41 return this.variableItemList; 42 } 43 //set { this.variableItemList = value; } 40 44 } 41 45 … … 65 69 66 70 67 public ICheckedItemList<StringValue> CreateVariableItemList(IList<string> checkedItems = null) { 68 if (checkedItems == null) checkedItems = new string[0]; 71 public ICheckedItemList<StringValue> CreateVariableItemList() { 69 72 ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>(); 70 73 foreach (string name in PreprocessingData.GetDoubleVariableNames()) { 71 74 var n = new StringValue(name); 72 itemList.Add(n, checkedItems.Contains(name)); 75 bool isInputTarget = PreprocessingData.InputVariables.Contains(name) || PreprocessingData.TargetVariable == name; 76 itemList.Add(n, isInputTarget); 73 77 } 74 78 return new ReadOnlyCheckedItemList<StringValue>(itemList); -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs
r14495 r14511 42 42 ScatterPlot scatterPlot = new ScatterPlot(); 43 43 44 IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX)) .Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();45 IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY)) .Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();44 IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX)); 45 IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY)); 46 46 47 if (xValues.Any()) { 47 var points = xValues.Zip(yValues, (x, y) => new Point2D<double>(x, y)).ToList(); 48 var validPoints = points.Where(p => !double.IsNaN(p.X) && !double.IsNaN(p.Y) && !double.IsInfinity(p.X) && !double.IsInfinity(p.Y)).ToList(); 49 if (validPoints.Any()) { 48 50 try { 49 51 double axisMin, axisMax, axisInterval; 50 ChartUtil.CalculateOptimalAxisInterval( xValues.Min(), xValues.Max(), out axisMin, out axisMax, out axisInterval);52 ChartUtil.CalculateOptimalAxisInterval(validPoints.Min(p => p.X), validPoints.Max(p => p.X), out axisMin, out axisMax, out axisInterval); 51 53 scatterPlot.VisualProperties.XAxisMinimumAuto = false; 52 54 scatterPlot.VisualProperties.XAxisMaximumAuto = false; … … 54 56 scatterPlot.VisualProperties.XAxisMaximumFixedValue = axisMax; 55 57 } catch (ArgumentOutOfRangeException) { } // error during CalculateOptimalAxisInterval 56 }57 if (yValues.Any()) {58 58 try { 59 59 double axisMin, axisMax, axisInterval; 60 ChartUtil.CalculateOptimalAxisInterval( yValues.Min(), yValues.Max(), out axisMin, out axisMax, out axisInterval);60 ChartUtil.CalculateOptimalAxisInterval(validPoints.Min(p => p.Y), validPoints.Max(p => p.Y), out axisMin, out axisMax, out axisInterval); 61 61 scatterPlot.VisualProperties.YAxisMinimumAuto = false; 62 62 scatterPlot.VisualProperties.YAxisMaximumAuto = false; … … 67 67 68 68 if (variableNameGroup == null || variableNameGroup == "-") { 69 List<Point2D<double>> points = new List<Point2D<double>>(); 70 71 for (int i = 0; i < xValues.Count; i++) { 72 Point2D<double> point = new Point2D<double>(xValues[i], yValues[i]); 73 points.Add(point); 74 } 75 76 ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points); 69 ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", validPoints); 77 70 scdr.VisualProperties.IsVisibleInLegend = false; 78 71 scatterPlot.Rows.Add(scdr); 79 80 72 } else { 81 73 var groupValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameGroup)); 82 var data = xValues.Zip(yValues, (x, y) => new { x, y }).Zip(groupValues, (v, c) => new { v.x, v.y, c }).ToList();74 var data = points.Zip(groupValues, (p, g) => new { p, g }); 83 75 foreach (var groupValue in groupValues.Distinct()) { 84 var values = data.Where(x => x.c == groupValue); 85 var row = new ScatterPlotDataRow( 86 variableNameGroup + " (" + groupValue + ")", 87 "", 88 values.Select(v => new Point2D<double>(v.x, v.y))) { 76 var values = data.Where(x => x.g == groupValue).Select(v => v.p); 77 var row = new ScatterPlotDataRow(string.Format("{0} ({1})", variableNameGroup, groupValue), "", values) { 89 78 VisualProperties = { PointSize = 6 } 90 79 };
Note: See TracChangeset
for help on using the changeset viewer.