Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/17 09:51:10 (7 years ago)
Author:
abeham
Message:

#2457: merged trunk into branch

Location:
branches/PerformanceComparison/HeuristicLab.Analysis
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Analysis

  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs

    r14600 r15282  
    5252    }
    5353    #endregion
    54     #region Histogram Aggregation
    55     public enum DataRowHistogramAggregation {
    56       Overlapping,
    57       SideBySide,
    58       Stacked
    59     }
    60     #endregion
    6154
    6255    private DataRowChartType chartType;
     
    130123      }
    131124    }
    132     private int bins;
    133     public int Bins {
    134       get { return bins; }
    135       set {
    136         if (bins != value) {
    137           bins = value;
    138           OnPropertyChanged("Bins");
    139         }
    140       }
    141     }
    142     private bool exactBins;
    143     public bool ExactBins {
    144       get { return exactBins; }
    145       set {
    146         if (exactBins != value) {
    147           exactBins = value;
    148           OnPropertyChanged("ExactBins");
    149         }
    150       }
    151     }
    152     private DataRowHistogramAggregation aggregation;
    153     public DataRowHistogramAggregation Aggregation {
    154       get { return aggregation; }
    155       set {
    156         if (aggregation != value) {
    157           aggregation = value;
    158           OnPropertyChanged("Aggregation");
    159         }
    160       }
    161     }
     125
    162126    private double scaleFactor;
    163127    public double ScaleFactor {
     
    232196      set { lineWidth = value; }
    233197    }
    234     [Storable(Name = "Bins")]
    235     private int StorableBins {
    236       get { return bins; }
    237       set { bins = value; }
    238     }
    239     [Storable(Name = "ExactBins")]
    240     private bool StorableExactBins {
    241       get { return exactBins; }
    242       set { exactBins = value; }
    243     }
    244     [Storable(Name = "Aggregation", DefaultValue = DataRowHistogramAggregation.Overlapping)]
    245     private DataRowHistogramAggregation StorableAggregation {
    246       get { return aggregation; }
    247       set { aggregation = value; }
    248     }
    249198    [Storable(Name = "ScaleFactor")]
    250199    private double StorableScaleFactor {
     
    262211      set { displayName = value; }
    263212    }
     213    #endregion
     214
     215    #region Histogram Properties - Backwards Compatability
     216    internal enum DataRowHistogramAggregation {
     217      Overlapping,
     218      SideBySide,
     219      Stacked
     220    }
     221
     222    internal int? Bins { get; private set; }
     223    internal bool? ExactBins { get; private set; }
     224    internal DataRowHistogramAggregation? Aggregation { get; private set; }
     225
     226    [Storable(Name = "Bins", AllowOneWay = true)]
     227    private int StorableBins { set { Bins = value; } }
     228    [Storable(Name = "ExactBins", AllowOneWay = true)]
     229    private bool StorableExactBins { set { ExactBins = value; } }
     230    [Storable(Name = "Aggregation", AllowOneWay = true)]
     231    private DataRowHistogramAggregation StorableAggregation { set { Aggregation = value; } }
    264232    #endregion
    265233
     
    275243      this.startIndexZero = original.startIndexZero;
    276244      this.lineWidth = original.lineWidth;
    277       this.bins = original.bins;
    278       this.exactBins = original.exactBins;
    279       this.aggregation = original.aggregation;
    280245      this.scaleFactor = original.scaleFactor;
    281246      this.displayName = original.displayName;
     
    290255      startIndexZero = false;
    291256      lineWidth = 1;
    292       bins = 10;
    293       exactBins = false;
    294       aggregation = DataRowHistogramAggregation.Overlapping;
    295257      scaleFactor = 1.0;
    296258      displayName = String.Empty;
     
    318280      if (secondXAxis == default(bool)
    319281        && lineStyle == default(DataRowLineStyle)
    320         && lineWidth == default(int) && bins == default(int) && exactBins == default(bool)
    321282        && displayName == default(string)) {
    322283        secondXAxis = false;
    323284        lineStyle = DataRowLineStyle.Solid;
    324285        lineWidth = 1;
    325         bins = 10;
    326         exactBins = false;
    327286        displayName = String.Empty;
    328287      }
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/DataTable.cs

    r14600 r15282  
    112112      if (VisualProperties == null) VisualProperties = new DataTableVisualProperties(name);
    113113      if (VisualProperties.Title == null) VisualProperties.Title = name;
     114
     115      #region Backwards Compatability Histogram Visual Properties
     116      var rowProperties = Rows.Select(r => r.VisualProperties).ToList();
     117      if (rowProperties.Any(r => r.Bins.HasValue))
     118        VisualProperties.HistogramBins = rowProperties.Where(r => r.Bins.HasValue).Max(r => r.Bins.Value);
     119      if (rowProperties.Any(r => r.ExactBins.HasValue))
     120        VisualProperties.HistogramExactBins = rowProperties.Where(r => r.ExactBins.HasValue).Any(r => r.ExactBins.Value);
     121      if (rowProperties.Any(r => r.Aggregation.HasValue)) {
     122        var maxOccurrence = rowProperties
     123          .Where(r => r.Aggregation.HasValue).Select(r => r.Aggregation.Value)
     124          .GroupBy(x => x).OrderByDescending(x => x.Count())
     125          .First().Key;
     126        VisualProperties.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)maxOccurrence;
     127      }
     128      #endregion
    114129    }
    115130    #endregion
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/DataTableVisualProperties.cs

    r14600 r15282  
    2020#endregion
    2121
     22using System;
     23using System.ComponentModel;
     24using System.Drawing;
    2225using HeuristicLab.Common;
    2326using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using System.ComponentModel;
    25 using System.Drawing;
    2627
    2728namespace HeuristicLab.Analysis {
     
    3132  [StorableClass]
    3233  public class DataTableVisualProperties : DeepCloneable, INotifyPropertyChanged {
     34
     35    #region Histogram Aggregation
     36    public enum DataTableHistogramAggregation {
     37      Overlapping,
     38      SideBySide,
     39      Stacked
     40    }
     41    #endregion
     42
    3343    private Font titleFont;
    3444    public Font TitleFont {
     
    352362        secondYAxisLogScale = value;
    353363        OnPropertyChanged("SecondYAxisLogScale");
     364      }
     365    }
     366
     367    private int histogramBins;
     368    public int HistogramBins {
     369      get { return histogramBins; }
     370      set {
     371        if (histogramBins != value) {
     372          histogramBins = value;
     373          OnPropertyChanged("HistogramBins");
     374        }
     375      }
     376    }
     377
     378    private bool histogramExactBins;
     379    public bool HistogramExactBins {
     380      get { return histogramExactBins; }
     381      set {
     382        if (histogramExactBins != value) {
     383          histogramExactBins = value;
     384          OnPropertyChanged("HistogramExactBins");
     385        }
     386      }
     387    }
     388
     389    private DataTableHistogramAggregation histogramAggregation;
     390    public DataTableHistogramAggregation HistogramAggregation {
     391      get { return histogramAggregation; }
     392      set {
     393        if (histogramAggregation != value) {
     394          histogramAggregation = value;
     395          OnPropertyChanged("HistogramAggregation");
     396        }
    354397      }
    355398    }
     
    500543      get { return secondYAxisLogScale; }
    501544      set { secondYAxisLogScale = value; }
     545    }
     546    [Storable(Name = "HistogramBins", DefaultValue = 10)]
     547    private int StorableHistogramBins {
     548      get { return histogramBins; }
     549      set { histogramBins = value; }
     550    }
     551    [Storable(Name = "HistogramExactBins", DefaultValue = false)]
     552    private bool StorableHistogramExactBins {
     553      get { return histogramExactBins; }
     554      set { histogramExactBins = value; }
     555    }
     556    [Storable(Name = "HistogramAggregation", DefaultValue = DataTableHistogramAggregation.Overlapping)]
     557    private DataTableHistogramAggregation StorableHistogramAggregation {
     558      get { return histogramAggregation; }
     559      set { histogramAggregation = value; }
    502560    }
    503561    #endregion
     
    536594      this.yAxisLogScale = original.yAxisLogScale;
    537595      this.secondYAxisLogScale = original.secondYAxisLogScale;
     596      this.histogramBins = original.histogramBins;
     597      this.histogramExactBins = original.histogramExactBins;
     598      this.histogramAggregation = original.histogramAggregation;
    538599    }
    539600    public DataTableVisualProperties() {
     
    565626      this.yAxisLogScale = false;
    566627      this.secondYAxisLogScale = false;
     628      histogramBins = 10;
     629      histogramExactBins = false;
     630      histogramAggregation = DataTableHistogramAggregation.Overlapping;
    567631    }
    568632    public DataTableVisualProperties(string title)
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataRow.cs

    r12766 r15282  
    3030
    3131namespace HeuristicLab.Analysis {
    32   [Item("IndexedDataRow", "A data row that contains time series.")]
     32  [Item("IndexedDataRow", "A data row that contains a series of points.")]
    3333  [StorableClass]
    3434  public class IndexedDataRow<T> : NamedItem {
     
    105105      OnVisualPropertiesChanged();
    106106    }
     107    protected override void OnNameChanged() {
     108      base.OnNameChanged();
     109      VisualProperties.DisplayName = Name;
     110    }
    107111  }
    108112}
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataTable.cs

    r12764 r15282  
    107107    public event EventHandler VisualPropertiesChanged;
    108108    protected virtual void OnVisualPropertiesChanged() {
    109       EventHandler handler = VisualPropertiesChanged;
     109      var handler = VisualPropertiesChanged;
    110110      if (handler != null) handler(this, EventArgs.Empty);
    111111    }
     
    115115    }
    116116
    117     protected virtual void RegisterRowsEvents() {
    118       rows.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsAdded);
    119       rows.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsRemoved);
    120       rows.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsReplaced);
    121       rows.CollectionReset += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_CollectionReset);
    122     }
    123     private void rows_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
     117    private void RegisterRowsEvents() {
     118      rows.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsAdded);
     119      rows.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsRemoved);
     120      rows.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsReplaced);
     121      rows.CollectionReset += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnCollectionReset);
     122      foreach (var row in Rows) RegisterRowEvents(row);
     123    }
     124    protected virtual void RowsOnItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
    124125      foreach (var row in e.Items)
    125126        this.RegisterRowEvents(row);
     
    129130      this.OnReset();
    130131    }
    131     private void rows_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
     132    protected virtual void RowsOnItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
    132133      foreach (var row in e.Items)
    133134        this.DeregisterRowEvents(row);
     
    137138      this.OnReset();
    138139    }
    139     private void rows_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
     140    protected virtual void RowsOnItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
    140141      foreach (var row in e.OldItems)
    141142        this.DeregisterRowEvents(row);
     
    147148      this.OnReset();
    148149    }
    149     private void rows_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
     150    protected virtual void RowsOnCollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {
    150151      foreach (var row in e.OldItems)
    151152        this.DeregisterRowEvents(row);
     
    159160    }
    160161
    161     protected virtual void RegisterRowEvents(IndexedDataRow<T> row) {
    162       row.Values.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsAdded);
    163       row.Values.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsMoved);
    164       row.Values.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsRemoved);
    165       row.Values.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsReplaced);
    166       row.Values.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_CollectionReset);
    167     }
    168     protected virtual void DeregisterRowEvents(IndexedDataRow<T> row) {
    169       row.Values.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsAdded);
    170       row.Values.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsMoved);
    171       row.Values.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsRemoved);
    172       row.Values.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsReplaced);
    173       row.Values.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_CollectionReset);
    174     }
    175 
    176     private void Values_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
    177       this.OnReset();
    178     }
    179     private void Values_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
    180       this.OnReset();
    181     }
    182     private void Values_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
    183       this.OnReset();
    184     }
    185     private void Values_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
    186       this.OnReset();
    187     }
    188     private void Values_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
     162    private void RegisterRowEvents(IndexedDataRow<T> row) {
     163      row.Values.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsAdded);
     164      row.Values.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsMoved);
     165      row.Values.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsRemoved);
     166      row.Values.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsReplaced);
     167      row.Values.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnCollectionReset);
     168    }
     169    private void DeregisterRowEvents(IndexedDataRow<T> row) {
     170      row.Values.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsAdded);
     171      row.Values.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsMoved);
     172      row.Values.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsRemoved);
     173      row.Values.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsReplaced);
     174      row.Values.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnCollectionReset);
     175    }
     176
     177    protected virtual void ValuesOnItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
     178      this.OnReset();
     179    }
     180    protected virtual void ValuesOnItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
     181      this.OnReset();
     182    }
     183    protected virtual void ValuesOnItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
     184      this.OnReset();
     185    }
     186    protected virtual void ValuesOnItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
     187      this.OnReset();
     188    }
     189    protected virtual void ValuesOnCollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {
    189190      this.OnReset();
    190191    }
Note: See TracChangeset for help on using the changeset viewer.