Changeset 6007


Ignore:
Timestamp:
04/12/11 20:19:50 (8 years ago)
Author:
abeham
Message:

#1465

  • Fixed column width in histogram by introducing 0 columns
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/histogram/HeuristicLab.Visualization.ChartControlsExtensions/3.3/HistogramControl.cs

    r5994 r6007  
    114114      }
    115115
    116       double current = minValue;
     116      double current = minValue, intervalCenter = intervalWidth / 2.0;
    117117      int count = 0;
    118118      foreach (double v in points.OrderBy(x => x)) {
    119         if (v < current + intervalWidth) {
    120           count++;
    121         } else {
    122           histogramSeries.Points.AddXY(current + intervalWidth / 2.0, count);
    123           count = 1;
    124           while (v >= current + intervalWidth) current += intervalWidth;
     119        while (v > current + intervalWidth) {
     120          histogramSeries.Points.AddXY(current + intervalCenter, count);
     121          current += intervalWidth;
     122          count = 0;
    125123        }
     124        count++;
    126125      }
    127       histogramSeries.Points.AddXY(current + intervalWidth / 2.0, count);
     126      histogramSeries.Points.AddXY(current + intervalCenter, count);
    128127
    129128      histogramSeries["PointWidth"] = "1";
Note: See TracChangeset for help on using the changeset viewer.