Changeset 14987 for trunk/sources/HeuristicLab.Analysis.Views/3.3
- Timestamp:
- 05/16/17 12:53:53 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Analysis.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs
r14982 r14987 107 107 this.configureToolStripMenuItem.Name = "configureToolStripMenuItem"; 108 108 this.configureToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 109 this.configureToolStripMenuItem.Text = "Configure Chart ";109 this.configureToolStripMenuItem.Text = "Configure Chart..."; 110 110 this.configureToolStripMenuItem.Click += new System.EventHandler(this.configureToolStripMenuItem_Click); 111 111 // -
trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.Designer.cs
r14982 r14987 69 69 // chart 70 70 // 71 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 72 | System.Windows.Forms.AnchorStyles.Left) 71 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 72 | System.Windows.Forms.AnchorStyles.Left) 73 73 | System.Windows.Forms.AnchorStyles.Right))); 74 74 this.chart.BorderlineColor = System.Drawing.Color.Black; … … 107 107 this.configureToolStripMenuItem.Name = "configureToolStripMenuItem"; 108 108 this.configureToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 109 this.configureToolStripMenuItem.Text = "Configure Chart ";109 this.configureToolStripMenuItem.Text = "Configure Chart..."; 110 110 this.configureToolStripMenuItem.Click += new System.EventHandler(this.configureToolStripMenuItem_Click); 111 111 // -
trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.cs
r14982 r14987 571 571 572 572 double[] coefficients; 573 if (!Fitting(row, out coefficients)) 573 if (!Fitting(row, out coefficients)) { 574 regressionSeries.LegendToolTip = "Could not calculate regression."; 574 575 return; 576 } 575 577 576 578 // Fill regrssion series 577 var validPoints = row.Points.Where(p => !IsInvalidValue(p.X)); 578 double min = validPoints.Min(p => p.X), max = validPoints.Max(p => p.X); 579 double range = max - min, delta = range / row.Points.Count; 580 for (double x = min; x < max; x += delta) { 579 double min = row.Points.Min(p => p.X), max = row.Points.Max(p => p.X); 580 double range = max - min, delta = range / Math.Max(row.Points.Count - 1, 50); 581 for (double x = min; x <= max; x += delta) { 581 582 regressionSeries.Points.AddXY(x, Estimate(x, row, coefficients)); 582 583 } … … 657 658 658 659 protected static bool Fitting(ScatterPlotDataRow row, out double[] coefficients) { 660 if (!IsValidRegressionData(row)) { 661 coefficients = new double[0]; 662 return false; 663 } 664 659 665 var xs = row.Points.Select(p => p.X).ToList(); 660 666 var ys = row.Points.Select(p => p.Y).ToList(); … … 688 694 // Linear fitting 689 695 bool success = LinearFitting(matrix, nRows, out coefficients); 690 if (!success) return success;696 if (!success) return false; 691 697 692 698 // Output transformation … … 698 704 } 699 705 706 return true; 707 } 708 protected static bool IsValidRegressionData(ScatterPlotDataRow row) { 709 // No invalid values allowed 710 for (int i = 0; i < row.Points.Count; i++) { 711 if (IsInvalidValue(row.Points[i].X) || IsInvalidValue(row.Points[i].Y)) 712 return false; 713 } 714 // Exp, Power and Log Regression do not work with negative values 715 switch (row.VisualProperties.RegressionType) { 716 case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType.Exponential: 717 for (int i = 0; i < row.Points.Count; i++) { 718 if (row.Points[i].Y <= 0) 719 return false; 720 } 721 break; 722 case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType.Power: 723 for (int i = 0; i < row.Points.Count; i++) { 724 if (row.Points[i].X <= 0 || row.Points[i].Y <= 0) 725 return false; 726 } 727 break; 728 case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType.Logarithmic: 729 for (int i = 0; i < row.Points.Count; i++) { 730 if (row.Points[i].X <= 0) 731 return false; 732 } 733 break; 734 } 700 735 return true; 701 736 }
Note: See TracChangeset
for help on using the changeset viewer.