- Timestamp:
- 01/04/17 16:33:37 (8 years ago)
- Location:
- branches/symbreg-factors-2650
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650
- Property svn:mergeinfo changed
/trunk/sources merged: 14504,14506-14509,14516-14517,14519,14522-14523,14527-14529,14531-14533
- Property svn:mergeinfo changed
-
branches/symbreg-factors-2650/HeuristicLab.Analysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Analysis.Views merged: 14508,14516,14519
- Property svn:mergeinfo changed
-
branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataTableControl.cs
r14498 r14542 27 27 using System.Windows.Forms.DataVisualization.Charting; 28 28 using HeuristicLab.Collections; 29 using HeuristicLab.MainForm.WindowsForms; 29 30 30 31 namespace HeuristicLab.Analysis.Views { 31 public partial class DataTableControl : UserControl{32 public partial class DataTableControl : AsynchronousContentView { 32 33 protected List<Series> invisibleSeries; 33 34 protected Dictionary<IObservableList<double>, DataRow> valuesRowsTable; 34 35 35 private DataTable content; 36 public DataTable Content { 37 get { return content; } 38 set { 39 if (value == content) return; 40 if (content != null) DeregisterContentEvents(); 41 content = value; 42 if (content != null) RegisterContentEvents(); 43 OnContentChanged(); 44 SetEnabledStateOfControls(); 45 } 36 public new DataTable Content { 37 get { return (DataTable)base.Content; } 38 set { base.Content = value; } 46 39 } 47 40 … … 56 49 57 50 #region Event Handler Registration 58 protected virtualvoid DeregisterContentEvents() {51 protected override void DeregisterContentEvents() { 59 52 foreach (DataRow row in Content.Rows) 60 53 DeregisterDataRowEvents(row); … … 65 58 Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset); 66 59 } 67 protected virtualvoid RegisterContentEvents() {60 protected override void RegisterContentEvents() { 68 61 Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged); 69 62 Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded); … … 95 88 #endregion 96 89 97 protected virtualvoid OnContentChanged() {90 protected override void OnContentChanged() { 98 91 invisibleSeries.Clear(); 99 92 chart.Titles[0].Text = string.Empty; … … 111 104 } 112 105 113 protected virtualvoid SetEnabledStateOfControls() {106 protected override void SetEnabledStateOfControls() { 114 107 chart.Enabled = Content != null; 115 108 } … … 541 534 if (!row.Values.Any()) return; 542 535 536 var validValues = histogramRows.SelectMany(r => r.Values).Where(x => !IsInvalidValue(x)).ToList(); 537 if (!validValues.Any()) return; 538 543 539 int bins = histogramRows.Max(r => r.VisualProperties.Bins); 544 decimal minValue = (decimal) histogramRows.Min(r => r.Values.Min());545 decimal maxValue = (decimal) histogramRows.Max(r => r.Values.Max());540 decimal minValue = (decimal)validValues.Min(); 541 decimal maxValue = (decimal)validValues.Max(); 546 542 decimal intervalWidth = (maxValue - minValue) / bins; 547 543 if (intervalWidth < 0) return; -
branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.cs
r14498 r14542 29 29 using HeuristicLab.Collections; 30 30 using HeuristicLab.Common; 31 using HeuristicLab.MainForm.WindowsForms; 31 32 32 33 namespace HeuristicLab.Analysis.Views { 33 public partial class ScatterPlotControl : UserControl{34 public partial class ScatterPlotControl : AsynchronousContentView { 34 35 protected List<Series> invisibleSeries; 35 36 protected Dictionary<IObservableList<Point2D<double>>, ScatterPlotDataRow> pointsRowsTable; … … 37 38 private double xMin, xMax, yMin, yMax; 38 39 39 private ScatterPlot content; 40 public ScatterPlot Content { 41 get { return content; } 42 set { 43 if (value == content) return; 44 if (content != null) DeregisterContentEvents(); 45 content = value; 46 if (content != null) RegisterContentEvents(); 47 OnContentChanged(); 48 SetEnabledStateOfControls(); 49 } 40 public new ScatterPlot Content { 41 get { return (ScatterPlot)base.Content; } 42 set { base.Content = value; } 50 43 } 51 44 … … 61 54 62 55 #region Event Handler Registration 63 protected virtualvoid DeregisterContentEvents() {56 protected override void DeregisterContentEvents() { 64 57 foreach (ScatterPlotDataRow row in Content.Rows) 65 58 DeregisterScatterPlotDataRowEvents(row); … … 70 63 Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset); 71 64 } 72 protected virtualvoid RegisterContentEvents() {65 protected override void RegisterContentEvents() { 73 66 Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged); 74 67 Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded); … … 98 91 #endregion 99 92 100 protected virtualvoid OnContentChanged() {93 protected override void OnContentChanged() { 101 94 invisibleSeries.Clear(); 102 95 chart.Titles[0].Text = string.Empty; … … 114 107 } 115 108 116 protected virtualvoid SetEnabledStateOfControls() {109 protected override void SetEnabledStateOfControls() { 117 110 chart.Enabled = Content != null; 118 111 } … … 508 501 509 502 private void FillSeriesWithRowValues(Series series, ScatterPlotDataRow row) { 503 bool zerosOnly = true; 510 504 for (int i = 0; i < row.Points.Count; i++) { 511 505 var value = row.Points[i]; … … 518 512 } 519 513 series.Points.Add(point); 520 } 514 if (value.X != 0.0f) 515 zerosOnly = false; 516 } 517 if (zerosOnly) // if all x-values are zero, the x-values are interpreted as 1, 2, 3, ... 518 series.Points.Add(new DataPoint(1, 1) { IsEmpty = true }); 521 519 double correlation = Correlation(row.Points); 522 520 series.LegendToolTip = string.Format("Correlation (R²) = {0:G4}", correlation * correlation);
Note: See TracChangeset
for help on using the changeset viewer.