Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15489


Ignore:
Timestamp:
11/30/17 10:31:27 (7 years ago)
Author:
pfleck
Message:

#2809:

  • Fixed wrong number of remaining/toral rows after filter changed
  • Improved performance for filtering as suggested by bburlacu. Thanks for the patch.
  • Start all charts with index zero.
Location:
branches/DataPreprocessing Cleanup
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs

    r15466 r15489  
    7171      applyFilterButton.Enabled = activeFilters;
    7272
     73      Content.PreprocessingData.ResetFilter();
     74
    7375      int numTotal = Content.PreprocessingData.Rows;
    7476      int numRemaining = numTotal;
    7577
    76       Content.PreprocessingData.ResetFilter();
    7778      if (activeFilters) {
    7879        var remainingRows = Content.GetRemainingRows();
    79         Content.PreprocessingData.SetFilter(remainingRows);
    8080        numRemaining = remainingRows.Count(x => x);
     81
     82        if (numRemaining < numTotal) {
     83          Content.PreprocessingData.SetFilter(remainingRows);
     84        }
    8185      }
    8286
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs

    r15431 r15489  
    8282
    8383    public static DataRow CreateDataRow(IFilteredPreprocessingData preprocessingData, string variableName, DataRowVisualProperties.DataRowChartType chartType) {
    84       IList<double> values = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName));
    85       DataRow row = new DataRow(variableName, "", values);
    86       row.VisualProperties.ChartType = chartType;
     84      var values = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName));
     85      var row = new DataRow(variableName, "", values) {
     86        VisualProperties = {
     87          ChartType = chartType,
     88          StartIndexZero = true
     89        }
     90      };
    8791      return row;
    8892    }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/FilteredPreprocessingData.cs

    r15466 r15489  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    320321      filteredData = (IPreprocessingData)originalData.Clone();
    321322      filteredData.InTransaction(() => {
    322         for (int row = (remainingRows.Length - 1); row >= 0; --row) {
    323           if (!remainingRows[row]) {
    324             filteredData.DeleteRow(row);
     323        var remainingIndices = Enumerable.Range(0, remainingRows.Length).Where(x => remainingRows[x]);
     324
     325        foreach (var v in filteredData.VariableNames) {
     326          var ci = filteredData.GetColumnIndex(v);
     327          if (filteredData.VariableHasType<double>(ci)) {
     328            var values = filteredData.GetValues<double>(ci);
     329            var filteredValues = remainingIndices.Select(x => values[x]).ToList();
     330            filteredData.SetValues(ci, filteredValues);
     331          } else if (filteredData.VariableHasType<DateTime>(ci)) {
     332            var values = filteredData.GetValues<DateTime>(ci);
     333            var filteredValues = remainingIndices.Select(x => values[x]).ToList();
     334            filteredData.SetValues(ci, filteredValues);
     335          } else if (filteredData.VariableHasType<string>(ci)) {
     336            var values = filteredData.GetValues<string>(ci);
     337            var filteredValues = remainingIndices.Select(x => values[x]).ToList();
     338            filteredData.SetValues(ci, filteredValues);
    325339          }
    326340        }
Note: See TracChangeset for help on using the changeset viewer.