Changeset 14514 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
- Timestamp:
- 12/21/16 11:26:54 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
r14511 r14514 10 10 using HeuristicLab.MainForm; 11 11 using HeuristicLab.MainForm.WindowsForms; 12 using RegressionType = HeuristicLab.Analysis.ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType; 12 13 13 14 namespace HeuristicLab.DataPreprocessing.Views { … … 16 17 public partial class ScatterPlotMultiView : PreprocessingCheckedVariablesView { 17 18 private readonly IDictionary<string, Label> columnHeaderCache; 18 private readonly IDictionary<string, Label> rowHeaderCache;19 private readonly IDictionary<string, VerticalLabel> rowHeaderCache; 19 20 private readonly IDictionary<Tuple<string/*col*/, string/*row*/>, Control> bodyCache; 20 21 21 22 public ScatterPlotMultiView() { 22 23 InitializeComponent(); 24 25 regressionTypeComboBox.DataSource = Enum.GetValues(typeof(RegressionType)); 26 regressionTypeComboBox.SelectedItem = RegressionType.None; 23 27 24 28 #region Initialize Scrollbars … … 41 45 42 46 columnHeaderCache = new Dictionary<string, Label>(); 43 rowHeaderCache = new Dictionary<string, Label>();47 rowHeaderCache = new Dictionary<string, VerticalLabel>(); 44 48 bodyCache = new Dictionary<Tuple<string, string>, Control>(); 45 49 … … 57 61 GenerateCharts(); 58 62 } 63 } 64 65 protected override void SetEnabledStateOfControls() { 66 base.SetEnabledStateOfControls(); 67 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 68 polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial; 59 69 } 60 70 … … 239 249 private Label GetRowHeader(string variable) { 240 250 if (!rowHeaderCache.ContainsKey(variable)) { 241 rowHeaderCache.Add(variable, new Label() {251 rowHeaderCache.Add(variable, new VerticalLabel() { 242 252 Text = variable, 243 253 TextAlign = ContentAlignment.MiddleCenter, 244 254 Name = variable, 245 255 Width = rowHeaderTableLayoutPanel.Width, 256 Height = columnHeaderScrollPanel.Width, 246 257 Dock = DockStyle.Fill, 247 258 Margin = new Padding(3) … … 269 280 } else { //scatter plot 270 281 var scatterPlot = Content.CreateScatterPlot(colVariable, rowVariable); 271 foreach (var row in scatterPlot.Rows) 282 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 283 int order = (int)polynomialRegressionOrderNumericUpDown.Value; 284 foreach (var row in scatterPlot.Rows) { 272 285 row.VisualProperties.PointSize = 3; 286 row.VisualProperties.IsRegressionVisibleInLegend = false; 287 row.VisualProperties.RegressionType = regressionType; 288 row.VisualProperties.PolynomialRegressionOrder = order; 289 } 273 290 scatterPlot.VisualProperties.Title = string.Empty; 274 var scatterPlotControl = new /*Preprocessing*/ScatterPlotControl {291 var scatterPlotControl = new ScatterPlotControl { 275 292 Name = key.ToString(), 276 293 Content = scatterPlot, … … 279 296 //XAxisFormat = "G3" 280 297 }; 281 scatterPlotControl.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart298 //scatterPlotControl.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart 282 299 bodyCache.Add(key, scatterPlotControl); 283 300 } … … 348 365 c++; 349 366 } 367 UpdateRegressionLine(); 350 368 } 351 369 … … 444 462 } 445 463 #endregion 464 465 #region Regression Line 466 private void regressionTypeComboBox_SelectedValueChanged(object sender, EventArgs e) { 467 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 468 polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial; 469 UpdateRegressionLine(); 470 } 471 472 private void polynomialRegressionOrderNumericUpDown_ValueChanged(object sender, EventArgs e) { 473 UpdateRegressionLine(); 474 } 475 476 private void UpdateRegressionLine() { 477 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 478 int order = (int)polynomialRegressionOrderNumericUpDown.Value; 479 480 foreach (var control in bodyCache.Values) { 481 var scatterPlotControl = control as ScatterPlotControl; 482 if (scatterPlotControl != null) { 483 foreach (var row in scatterPlotControl.Content.Rows) { 484 row.VisualProperties.IsRegressionVisibleInLegend = false; 485 row.VisualProperties.RegressionType = regressionType; 486 row.VisualProperties.PolynomialRegressionOrder = order; 487 } 488 } 489 } 490 } 491 #endregion 446 492 } 447 493 } 494
Note: See TracChangeset
for help on using the changeset viewer.