Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/14/08 17:36:38 (16 years ago)
Author:
gkronber
Message:

improved distribution of bubble sizes by ignoring outliers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChart.cs

    r569 r570  
    139139        double minSize = 1;
    140140        if(sizeDimension != null) {
    141           var sizes = records.Select(r => r.Get(sizeDimension));
    142           maxSize = sizes.Max();
    143           minSize = sizes.Min();
     141          var sizes = records.Select(r => r.Get(sizeDimension)).Where(x => !double.IsInfinity(x) && x != double.MaxValue && x != double.MinValue).OrderBy(x=>x);
     142          minSize = sizes.ElementAt((int)(sizes.Count() * 0.1));
     143          maxSize = sizes.ElementAt((int)(sizes.Count() * 0.9));
    144144        }
    145145        UpdateEnabled = false;
     
    175175
    176176    private int CalculateSize(double size, double minSize, double maxSize) {
    177       if(double.IsNaN(size)) return minBubbleSize;
     177      if(double.IsNaN(size) || double.IsInfinity(size) || size == double.MaxValue || size == double.MinValue) return minBubbleSize;
     178      if(size > maxSize) size = maxSize;
     179      if(size < minSize) size = minSize;
    178180      double sizeDifference = ((size - minSize) / (maxSize - minSize) * (maxBubbleSize - minBubbleSize));
    179181      if(invertSize) return maxBubbleSize - (int)sizeDifference;
Note: See TracChangeset for help on using the changeset viewer.