[Kst] kdeextragear-2/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Dec 9 21:15:47 CET 2004
CVS commit by netterfield:
Fix histogram test failure:
-Now the top limit of the top bin is inclusive, which means that if autobin
is used, all data points end up in a bin. The bottoms of all bins are
inclusive (as before) and the tops of all bins other than the top are
non-inclusive.
-Remove ::point() which was left over from when histograms were curves.
M +6 -13 ksthistogram.cpp 1.40
M +0 -1 ksthistogram.h 1.27
--- kdeextragear-2/kst/kst/ksthistogram.h #1.26:1.27
@@ -38,5 +38,4 @@ public:
virtual UpdateType update(int update_counter = -1);
- virtual void point(int i, double &x1, double &y1);
virtual void save(QTextStream &ts, const QString& indent = QString::null);
virtual QString propertyString() const;
--- kdeextragear-2/kst/kst/ksthistogram.cpp #1.39:1.40
@@ -187,4 +187,10 @@ KstObject::UpdateType KstHistogram::upda
if ((i_bin >= 0) && (i_bin < NBins)) {
Bins[i_bin]++;
+ } else {
+ // the top boundry of the top bin is included in the top bin.
+ // for all other bins, the top boundry is included in the next bin
+ if (y==MaxX) {
+ Bins[NBins-1]++;
+ }
}
}
@@ -240,17 +246,4 @@ KstObject::UpdateType KstHistogram::upda
}
-
-void KstHistogram::point(int i, double &x, double &y) {
- x = (i+1)/3 * W + MinX;
- if (i % 3 == 0) {
- y = 0;
- } else if (i >= 0 && i < NS) {
- y = Bins[i/3]*Normalization;
- } else {
- y=0;
- }
-}
-
-
int KstHistogram::nBins() const {
return NBins;
More information about the Kst
mailing list