Changeset 14495


Ignore:
Timestamp:
12/16/16 14:47:38 (3 years ago)
Author:
pfleck
Message:

#2709

  • Fixed initial point size for scatterplots.
  • Reuse the visual properties of the old data row if a single variable is changed in the ScatterPlotSingleView
Location:
branches/DataPreprocessing Enhancements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r14467 r14495  
    267267        } else { //scatter plot
    268268          var scatterPlot = Content.CreateScatterPlot(colVariable, rowVariable);
     269          foreach (var row in scatterPlot.Rows)
     270            row.VisualProperties.PointSize = 3;
    269271          scatterPlot.VisualProperties.Title = string.Empty;
    270272          var scatterPlotControl = new /*Preprocessing*/ScatterPlotControl {
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs

    r14474 r14495  
    8888        var groupVariable = (string)comboBoxGroup.SelectedItem;
    8989        ScatterPlot scatterPlot = Content.CreateScatterPlot(xVariable, yVariable, groupVariable);
     90        foreach (var row in scatterPlot.Rows)
     91          row.VisualProperties.PointSize = 6;
    9092        var vp = scatterPlot.VisualProperties;
    9193        vp.Title = string.Empty;
     
    115117
    116118      foreach (var x in newPlot.Rows.Zip(oldPlot.Rows, (nr, or) => new { nr, or })) {
    117         x.nr.VisualProperties.PointSize = x.or.VisualProperties.PointSize;
    118         x.nr.VisualProperties.PointStyle = x.or.VisualProperties.PointStyle;
    119         x.nr.VisualProperties.Color = x.or.VisualProperties.Color;
     119        var newVisuapProperties = (ScatterPlotDataRowVisualProperties)x.or.VisualProperties.Clone();
     120        newVisuapProperties.DisplayName = x.nr.VisualProperties.DisplayName;
     121        x.nr.VisualProperties = newVisuapProperties;
    120122      }
    121123    }
     
    133135
    134136      foreach (var x in newPlot.Rows.Zip(oldPlot.Rows, (nr, or) => new { nr, or })) {
    135         x.nr.VisualProperties.PointSize = x.or.VisualProperties.PointSize;
    136         x.nr.VisualProperties.PointStyle = x.or.VisualProperties.PointStyle;
    137         x.nr.VisualProperties.Color = x.or.VisualProperties.Color;
     137        var newVisuapProperties = (ScatterPlotDataRowVisualProperties)x.or.VisualProperties.Clone();
     138        newVisuapProperties.DisplayName = x.nr.VisualProperties.DisplayName;
     139        x.nr.VisualProperties = newVisuapProperties;
    138140      }
    139141    }
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs

    r14474 r14495  
    4242      ScatterPlot scatterPlot = new ScatterPlot();
    4343
    44       IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX));
    45       IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY));
     44      IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX)).Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();
     45      IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY)).Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();
    4646
    47       double axisMin, axisMax, axisInterval;
    48       try {
    49         ChartUtil.CalculateOptimalAxisInterval(xValues.Min(), xValues.Max(), out axisMin, out axisMax, out axisInterval);
    50         scatterPlot.VisualProperties.XAxisMinimumAuto = false;
    51         scatterPlot.VisualProperties.XAxisMaximumAuto = false;
    52         scatterPlot.VisualProperties.XAxisMinimumFixedValue = axisMin;
    53         scatterPlot.VisualProperties.XAxisMaximumFixedValue = axisMax;
    54       } catch (ArgumentOutOfRangeException) { } // missing values lead to NaNs
    55       try {
    56         ChartUtil.CalculateOptimalAxisInterval(yValues.Min(), yValues.Max(), out axisMin, out axisMax, out axisInterval);
    57         scatterPlot.VisualProperties.YAxisMinimumAuto = false;
    58         scatterPlot.VisualProperties.YAxisMaximumAuto = false;
    59         scatterPlot.VisualProperties.YAxisMinimumFixedValue = axisMin;
    60         scatterPlot.VisualProperties.YAxisMaximumFixedValue = axisMax;
    61       } catch (ArgumentOutOfRangeException) { } // missing values lead to NaNs
     47      if (xValues.Any()) {
     48        try {
     49          double axisMin, axisMax, axisInterval;
     50          ChartUtil.CalculateOptimalAxisInterval(xValues.Min(), xValues.Max(), out axisMin, out axisMax, out axisInterval);
     51          scatterPlot.VisualProperties.XAxisMinimumAuto = false;
     52          scatterPlot.VisualProperties.XAxisMaximumAuto = false;
     53          scatterPlot.VisualProperties.XAxisMinimumFixedValue = axisMin;
     54          scatterPlot.VisualProperties.XAxisMaximumFixedValue = axisMax;
     55        } catch (ArgumentOutOfRangeException) { } // error during CalculateOptimalAxisInterval
     56      }
     57      if (yValues.Any()) {
     58        try {
     59          double axisMin, axisMax, axisInterval;
     60          ChartUtil.CalculateOptimalAxisInterval(yValues.Min(), yValues.Max(), out axisMin, out axisMax, out axisInterval);
     61          scatterPlot.VisualProperties.YAxisMinimumAuto = false;
     62          scatterPlot.VisualProperties.YAxisMaximumAuto = false;
     63          scatterPlot.VisualProperties.YAxisMinimumFixedValue = axisMin;
     64          scatterPlot.VisualProperties.YAxisMaximumFixedValue = axisMax;
     65        } catch (ArgumentOutOfRangeException) { } // error during CalculateOptimalAxisInterval
     66      }
    6267
    6368      if (variableNameGroup == null || variableNameGroup == "-") {
     
    6974        }
    7075
    71         ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points) {
    72           VisualProperties = { PointSize = 6 }
    73         };
     76        ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points);
    7477        scdr.VisualProperties.IsVisibleInLegend = false;
    7578        scatterPlot.Rows.Add(scdr);
Note: See TracChangeset for help on using the changeset viewer.