Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17056


Ignore:
Timestamp:
07/04/19 13:05:02 (5 years ago)
Author:
mkommend
Message:

#2879: Merged r15619 into stable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r16838 r17056  
    390390        DataRow row = (DataRow)sender;
    391391        Series series = chart.Series[row.Name];
    392         series.Points.Clear();
     392        ClearPoints(series.Points);
    393393        ConfigureSeries(series, row);
    394394        if (!invisibleSeries.Contains(series)) {
     
    418418          Series rowSeries = chart.Series[row.Name];
    419419          if (!invisibleSeries.Contains(rowSeries)) {
    420             rowSeries.Points.Clear();
     420            ClearPoints(rowSeries.Points);
    421421            FillSeriesWithRowValues(rowSeries, row);
    422422            RecalculateAxesScale(chart.ChartAreas[0]);
     
    435435          Series rowSeries = chart.Series[row.Name];
    436436          if (!invisibleSeries.Contains(rowSeries)) {
    437             rowSeries.Points.Clear();
     437            ClearPoints(rowSeries.Points);
    438438            FillSeriesWithRowValues(rowSeries, row);
    439439            RecalculateAxesScale(chart.ChartAreas[0]);
     
    453453          if (!invisibleSeries.Contains(rowSeries)) {
    454454            if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) {
    455               rowSeries.Points.Clear();
     455              ClearPoints(rowSeries.Points);
    456456              FillSeriesWithRowValues(rowSeries, row);
    457457            } else {
     
    480480          Series rowSeries = chart.Series[row.Name];
    481481          if (!invisibleSeries.Contains(rowSeries)) {
    482             rowSeries.Points.Clear();
     482            ClearPoints(rowSeries.Points);
    483483            FillSeriesWithRowValues(rowSeries, row);
    484484            RecalculateAxesScale(chart.ChartAreas[0]);
     
    498498          Series rowSeries = chart.Series[row.Name];
    499499          if (!invisibleSeries.Contains(rowSeries)) {
    500             rowSeries.Points.Clear();
     500            ClearPoints(rowSeries.Points);
    501501            FillSeriesWithRowValues(rowSeries, row);
    502502            RecalculateAxesScale(chart.ChartAreas[0]);
     
    541541    private void ToggleSeriesVisible(Series series) {
    542542      if (!invisibleSeries.Contains(series)) {
    543         series.Points.Clear();
     543        ClearPoints(series.Points);
    544544        invisibleSeries.Add(series);
    545545      } else {
     
    572572                            where !invisibleSeries.Contains(s)
    573573                            select new { row = r, series = s }) {
    574             h.series.Points.Clear();
     574            ClearPoints(h.series.Points);
    575575            CalculateHistogram(h.series, h.row, histograms);
    576576          }
     
    599599
    600600    protected virtual void CalculateHistogram(Series series, DataRow row, IEnumerable<DataRow> histogramRows) {
    601       series.Points.Clear();
     601      ClearPoints(series.Points);
    602602      if (!row.Values.Any()) return;
    603603
     
    732732      return double.IsNaN(x) || x < (double)decimal.MinValue || x > (double)decimal.MaxValue;
    733733    }
     734
     735    // workaround for performance problem as described in https://stackoverflow.com/questions/5744930/datapointcollection-clear-performance
     736    public static void ClearPoints(DataPointCollection points) {
     737      points.SuspendUpdates();
     738      while (points.Count > 0)
     739        points.RemoveAt(points.Count - 1);
     740      points.ResumeUpdates();
     741    }
    734742    #endregion
    735743  }
Note: See TracChangeset for help on using the changeset viewer.