Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/04/17 16:33:37 (7 years ago)
Author:
gkronber
Message:

#2650: merged r14504:14533 from trunk to branch

Location:
branches/symbreg-factors-2650
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650

  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views

  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.cs

    r14498 r14542  
    2929using HeuristicLab.Collections;
    3030using HeuristicLab.Common;
     31using HeuristicLab.MainForm.WindowsForms;
    3132
    3233namespace HeuristicLab.Analysis.Views {
    33   public partial class ScatterPlotControl : UserControl {
     34  public partial class ScatterPlotControl : AsynchronousContentView {
    3435    protected List<Series> invisibleSeries;
    3536    protected Dictionary<IObservableList<Point2D<double>>, ScatterPlotDataRow> pointsRowsTable;
     
    3738    private double xMin, xMax, yMin, yMax;
    3839
    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; }
    5043    }
    5144
     
    6154
    6255    #region Event Handler Registration
    63     protected virtual void DeregisterContentEvents() {
     56    protected override void DeregisterContentEvents() {
    6457      foreach (ScatterPlotDataRow row in Content.Rows)
    6558        DeregisterScatterPlotDataRowEvents(row);
     
    7063      Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset);
    7164    }
    72     protected virtual void RegisterContentEvents() {
     65    protected override void RegisterContentEvents() {
    7366      Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged);
    7467      Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded);
     
    9891    #endregion
    9992
    100     protected virtual void OnContentChanged() {
     93    protected override void OnContentChanged() {
    10194      invisibleSeries.Clear();
    10295      chart.Titles[0].Text = string.Empty;
     
    114107    }
    115108
    116     protected virtual void SetEnabledStateOfControls() {
     109    protected override void SetEnabledStateOfControls() {
    117110      chart.Enabled = Content != null;
    118111    }
     
    508501
    509502    private void FillSeriesWithRowValues(Series series, ScatterPlotDataRow row) {
     503      bool zerosOnly = true;
    510504      for (int i = 0; i < row.Points.Count; i++) {
    511505        var value = row.Points[i];
     
    518512        }
    519513        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 });
    521519      double correlation = Correlation(row.Points);
    522520      series.LegendToolTip = string.Format("Correlation (R²) = {0:G4}", correlation * correlation);
Note: See TracChangeset for help on using the changeset viewer.