Bug 102386 - Unable to create new histogram
Summary: Unable to create new histogram
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-24 19:27 UTC by Andrew Walker
Modified: 2005-03-25 18:57 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2005-03-24 19:27:51 UTC
Version:           HEAD (using KDE KDE 3.3.0)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:
Any newly created histograms have all zero values in the corresponding vector,
and so no histogram data is displayed in the plot.

STEPS TO REPRODUCE:
Create a new histogram using any variation of binning and data source

EXPECTED RESULTS:
Histogram is calculated and displayed

RESULTS:
The histogram is calculated as being zero for all bins, and no histogram is displayed.
Comment 1 Andrew Walker 2005-03-24 22:53:12 UTC
There seems to be a similar problem with creation of matrices.
Haven't tested similar objects: equations, events, etc.
Comment 2 George Staikos 2005-03-25 18:57:22 UTC
CVS commit by staikos: 

Finish the code here
BUG: 102382
BUG: 102386


  M +8 -8      ksthistogram.cpp   1.56


--- kdeextragear-2/kst/kst/ksthistogram.cpp  #1.55:1.56
@@ -138,4 +138,6 @@ void KstHistogram::commonConstructor(con
   v->setProvider(this);
   _hVector = _outputVectors.insert(HIST, v);
+
+  setDirty();
 }
 
@@ -187,7 +189,5 @@ KstObject::UpdateType KstHistogram::upda
   _W = (_MaxX - _MinX)/double(_NBins);
 
-  for (i_bin = 0; i_bin < _NBins; i_bin++) {
-    Bins[i_bin] = 0;
-  }
+  memset(Bins, 0, _NBins*sizeof(*Bins));
 
   ns = _inputVectors[RAWVECTOR]->length();
@@ -292,5 +293,6 @@ void KstHistogram::internalSetNBins(int 
   }
   Bins = new unsigned long[_NBins];
-  _W = (_MaxX - _MinX)/(double)_NBins;
+  memset(Bins, 0, _NBins*sizeof(*Bins));
+  _W = (_MaxX - _MinX)/double(_NBins);
   _NS = 3 * _NBins + 1;
 
@@ -304,6 +306,4 @@ void KstHistogram::setNBins(int in_n_bin
   internalSetNBins(in_n_bins);
   setDirty();
-  abort(); // FIXME
-  update(); // Have to update here otherwise Bins[] is invalid!
 }