Changeset 13995 for branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
- Timestamp:
- 07/04/16 23:43:46 (8 years ago)
- Location:
- branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.Designer.cs
r13853 r13995 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.variableListView = new System.Windows.Forms.ListView(); 27 28 this.gradientChartTableLayout = new System.Windows.Forms.TableLayoutPanel(); … … 33 34 this.configSplitContainer = new System.Windows.Forms.SplitContainer(); 34 35 this.variableGroupBox = new System.Windows.Forms.GroupBox(); 36 this.layoutGroupBox = new System.Windows.Forms.GroupBox(); 37 this.columnsTextBox = new System.Windows.Forms.TextBox(); 38 this.columnsLabel = new System.Windows.Forms.Label(); 35 39 this.scrollPanel = new System.Windows.Forms.Panel(); 40 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 36 41 this.yAxisConfigGroupBox.SuspendLayout(); 37 42 this.densityGroupBox.SuspendLayout(); … … 41 46 this.configSplitContainer.SuspendLayout(); 42 47 this.variableGroupBox.SuspendLayout(); 48 this.layoutGroupBox.SuspendLayout(); 43 49 this.scrollPanel.SuspendLayout(); 50 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 44 51 this.SuspendLayout(); 45 52 // … … 50 57 this.variableListView.Location = new System.Drawing.Point(3, 16); 51 58 this.variableListView.Name = "variableListView"; 52 this.variableListView.Size = new System.Drawing.Size(163, 503);59 this.variableListView.Size = new System.Drawing.Size(163, 458); 53 60 this.variableListView.TabIndex = 0; 54 61 this.variableListView.UseCompatibleStateImageBehavior = false; … … 142 149 // 143 150 this.configSplitContainer.Panel1.Controls.Add(this.variableGroupBox); 151 this.configSplitContainer.Panel1.Controls.Add(this.layoutGroupBox); 144 152 this.configSplitContainer.Panel1.Controls.Add(this.densityGroupBox); 145 153 this.configSplitContainer.Panel1.Controls.Add(this.yAxisConfigGroupBox); … … 156 164 this.variableGroupBox.Controls.Add(this.variableListView); 157 165 this.variableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 158 this.variableGroupBox.Location = new System.Drawing.Point(0, 1 26);166 this.variableGroupBox.Location = new System.Drawing.Point(0, 171); 159 167 this.variableGroupBox.Name = "variableGroupBox"; 160 this.variableGroupBox.Size = new System.Drawing.Size(169, 522);168 this.variableGroupBox.Size = new System.Drawing.Size(169, 477); 161 169 this.variableGroupBox.TabIndex = 1; 162 170 this.variableGroupBox.TabStop = false; 163 171 this.variableGroupBox.Text = "Variables"; 172 // 173 // layoutGroupBox 174 // 175 this.layoutGroupBox.Controls.Add(this.columnsTextBox); 176 this.layoutGroupBox.Controls.Add(this.columnsLabel); 177 this.layoutGroupBox.Dock = System.Windows.Forms.DockStyle.Top; 178 this.layoutGroupBox.Location = new System.Drawing.Point(0, 126); 179 this.layoutGroupBox.Name = "layoutGroupBox"; 180 this.layoutGroupBox.Size = new System.Drawing.Size(169, 45); 181 this.layoutGroupBox.TabIndex = 5; 182 this.layoutGroupBox.TabStop = false; 183 this.layoutGroupBox.Text = "Layout"; 184 // 185 // columnsTextBox 186 // 187 this.columnsTextBox.Location = new System.Drawing.Point(66, 17); 188 this.columnsTextBox.Name = "columnsTextBox"; 189 this.columnsTextBox.Size = new System.Drawing.Size(94, 20); 190 this.columnsTextBox.TabIndex = 1; 191 this.columnsTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.columnsTextBox_Validating); 192 this.columnsTextBox.Validated += new System.EventHandler(this.columnsTextBox_Validated); 193 // 194 // columnsLabel 195 // 196 this.columnsLabel.AutoSize = true; 197 this.columnsLabel.Location = new System.Drawing.Point(7, 20); 198 this.columnsLabel.Name = "columnsLabel"; 199 this.columnsLabel.Size = new System.Drawing.Size(50, 13); 200 this.columnsLabel.TabIndex = 0; 201 this.columnsLabel.Text = "Columns:"; 164 202 // 165 203 // scrollPanel … … 171 209 this.scrollPanel.Size = new System.Drawing.Size(542, 648); 172 210 this.scrollPanel.TabIndex = 0; 211 // 212 // errorProvider 213 // 214 this.errorProvider.ContainerControl = this; 173 215 // 174 216 // RegressionSolutionTargetResponseGradientView … … 187 229 this.configSplitContainer.ResumeLayout(false); 188 230 this.variableGroupBox.ResumeLayout(false); 231 this.layoutGroupBox.ResumeLayout(false); 232 this.layoutGroupBox.PerformLayout(); 189 233 this.scrollPanel.ResumeLayout(false); 190 234 this.scrollPanel.PerformLayout(); 235 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 191 236 this.ResumeLayout(false); 192 237 … … 205 250 private System.Windows.Forms.GroupBox variableGroupBox; 206 251 private System.Windows.Forms.Panel scrollPanel; 252 private System.Windows.Forms.GroupBox layoutGroupBox; 253 private System.Windows.Forms.TextBox columnsTextBox; 254 private System.Windows.Forms.Label columnsLabel; 255 private System.Windows.Forms.ErrorProvider errorProvider; 207 256 } 208 257 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs
r13948 r13995 39 39 40 40 private const int Points = 200; 41 private constint MaxColumns = 4;41 private int MaxColumns = 4; 42 42 43 43 private IEnumerable<string> VisibleVariables { … … 66 66 densityComboBox.SelectedIndex = 0; // select None 67 67 68 columnsTextBox.Text = "4"; 69 68 70 // Avoid additional horizontal scrollbar 69 71 var vertScrollWidth = SystemInformation.VerticalScrollBarWidth; … … 82 84 limitView.Content.ValueChanged += limit_ValueChanged; 83 85 automaticYAxisCheckBox.CheckedChanged += automaticYAxisCheckBox_CheckedChanged; 86 Content.ModelChanged += solution_ModelChanged; 84 87 } 85 88 … … 88 91 limitView.Content.ValueChanged -= limit_ValueChanged; 89 92 automaticYAxisCheckBox.CheckedChanged -= automaticYAxisCheckBox_CheckedChanged; 93 Content.ModelChanged -= solution_ModelChanged; 90 94 base.DeregisterContentEvents(); 91 95 } … … 171 175 }; 172 176 gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableName, Points); 173 177 gradientChart.SolutionAdded += gradientChart_SolutionAdded; 178 gradientChart.SolutionRemoved += gradientChart_SolutionRemoved; 174 179 return gradientChart; 175 180 } … … 214 219 } 215 220 221 private void SetStyles() { 222 var tl = gradientChartTableLayout; 223 tl.RowStyles.Clear(); 224 tl.ColumnStyles.Clear(); 225 int numVariables = VisibleVariables.Count(); 226 if (numVariables == 0) 227 return; 228 229 // set column styles 230 tl.ColumnCount = Math.Min(numVariables, MaxColumns); 231 for (int c = 0; c < tl.ColumnCount; c++) 232 tl.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100.0f / tl.ColumnCount)); 233 234 // set row styles 235 tl.RowCount = (int)Math.Ceiling((double)numVariables / tl.ColumnCount); 236 var columnWidth = tl.Width / tl.ColumnCount; // assume all columns have the same width 237 var rowHeight = (int)(0.8 * columnWidth); 238 for (int r = 0; r < tl.RowCount; r++) 239 tl.RowStyles.Add(new RowStyle(SizeType.Absolute, rowHeight)); 240 } 241 242 private async void gradientChart_SolutionAdded(object sender, EventArgs<IRegressionSolution> e) { 243 var solution = e.Value; 244 foreach (var chart in gradientCharts.Values) { 245 if (sender == chart) continue; 246 await chart.AddSolutionAsync(solution); 247 } 248 } 249 250 private async void gradientChart_SolutionRemoved(object sender, EventArgs<IRegressionSolution> e) { 251 var solution = e.Value; 252 foreach (var chart in gradientCharts.Values) { 253 if (sender == chart) continue; 254 await chart.RemoveSolutionAsync(solution); 255 } 256 } 257 216 258 private async void variableListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 217 259 var item = e.Item; … … 223 265 224 266 tl.SuspendLayout(); 225 226 267 if (item.Checked) { 227 268 tl.Controls.Add(chartsPanel); … … 234 275 if (tl.Controls.Count > 0) { 235 276 SetupYAxis(); 236 237 277 ReOrderControls(); 238 239 // set column styles 240 int numVariables = VisibleVariables.Count(); 241 tl.ColumnCount = Math.Min(numVariables, MaxColumns); 242 tl.ColumnStyles.Clear(); 243 for (int c = 0; c < tl.ColumnCount; c++) 244 tl.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100.0f / tl.ColumnCount)); 245 246 // set column styles 247 tl.RowCount = (int)Math.Ceiling((double)numVariables / tl.ColumnCount); 248 var columnWidth = tl.Width / tl.ColumnCount; // assume all columns have the same width 249 var rowHeight = (int)(0.8 * columnWidth); 250 tl.RowStyles.Clear(); 251 for (int r = 0; r < tl.RowCount; r++) 252 tl.RowStyles.Add(new RowStyle(SizeType.Absolute, rowHeight)); 253 } 254 278 SetStyles(); 279 } 255 280 tl.ResumeLayout(); 256 281 } … … 314 339 } 315 340 } 341 342 private void columnsTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) { 343 int columns; 344 if (!int.TryParse(columnsTextBox.Text, out columns)) { 345 e.Cancel = true; 346 columnsTextBox.Select(); 347 errorProvider.SetError(columnsTextBox, "Columns number must be a positive integer."); 348 } 349 } 350 351 private void columnsTextBox_Validated(object sender, EventArgs e) { 352 errorProvider.SetError(columnsTextBox, ""); 353 MaxColumns = int.Parse(columnsTextBox.Text); 354 int columns = Math.Min(VisibleVariables.Count(), MaxColumns); 355 if (columns > 0) { 356 var tl = gradientChartTableLayout; 357 MaxColumns = columns; 358 tl.SuspendLayout(); 359 ReOrderControls(); 360 SetStyles(); 361 tl.ResumeLayout(); 362 } 363 } 364 365 private void solution_ModelChanged(object sender, EventArgs e) { 366 OnContentChanged(); 367 } 316 368 } 317 369 } 318 370 371
Note: See TracChangeset
for help on using the changeset viewer.