mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Fix Torque/Speed binning in Histogram Window
This commit is contained in:
@@ -244,6 +244,7 @@ void
|
||||
HistogramWindow::setBinWidthFromSlider()
|
||||
{
|
||||
if (powerHist->binWidth() != binWidthSlider->value()) {
|
||||
//RideFile::SeriesType series = static_cast<RideFile::SeriesType>(seriesCombo->itemData(seriesCombo->currentIndex()).toInt());
|
||||
powerHist->setBinWidth(binWidthSlider->value());
|
||||
setHistBinWidthText();
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ PowerHist::recalc(bool force)
|
||||
|
||||
// we add a bin on the end since the last "incomplete" bin
|
||||
// will be dropped otherwise
|
||||
int count = int(ceil((arrayLength - 1) / binw))+1;
|
||||
int count = int(ceil((arrayLength - 1) / (binw)))+1;
|
||||
|
||||
// allocate space for data, plus beginning and ending point
|
||||
QVector<double> parameterValue(count+2, 0.0);
|
||||
@@ -382,10 +382,10 @@ PowerHist::recalc(bool force)
|
||||
QVector<double> totalTimeSelected(count+2, 0.0);
|
||||
int i;
|
||||
for (i = 1; i <= count; ++i) {
|
||||
int high = i * binw;
|
||||
int low = high - binw;
|
||||
double high = i * (binw/delta);
|
||||
double low = high - (binw/delta);
|
||||
if (low==0 && !withz) low++;
|
||||
parameterValue[i] = high * delta;
|
||||
parameterValue[i] = high*delta;
|
||||
totalTime[i] = 1e-9; // nonzero to accomodate log plot
|
||||
totalTimeSelected[i] = 1e-9; // nonzero to accomodate log plot
|
||||
while (low < high && low<arrayLength) {
|
||||
@@ -782,11 +782,10 @@ PowerHist::setData(RideItem *_rideItem, bool force)
|
||||
}
|
||||
|
||||
void
|
||||
PowerHist::setBinWidth(int value)
|
||||
PowerHist::setBinWidth(double value)
|
||||
{
|
||||
if (!value) value = 1; // binwidth must be nonzero
|
||||
binw = value;
|
||||
appsettings->setValue(GC_HIST_BIN_WIDTH, value);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -111,7 +111,7 @@ class PowerHist : public QwtPlot
|
||||
void configChanged();
|
||||
void setAxisTitle(int axis, QString label);
|
||||
void setYMax();
|
||||
void setBinWidth(int value);
|
||||
void setBinWidth(double value);
|
||||
int setBinWidthRealUnits(double value);
|
||||
|
||||
// public getters
|
||||
@@ -120,7 +120,7 @@ class PowerHist : public QwtPlot
|
||||
int getDigits();
|
||||
inline bool islnY() const { return lny; }
|
||||
inline bool withZeros() const { return withz; }
|
||||
inline int binWidth() const { return binw; }
|
||||
inline double binWidth() const { return binw; }
|
||||
|
||||
// react to plot signals
|
||||
void pointHover(QwtPlotCurve *curve, int index);
|
||||
@@ -148,7 +148,7 @@ class PowerHist : public QwtPlot
|
||||
bool lny;
|
||||
bool shade;
|
||||
bool zoned; // show in zones
|
||||
int binw;
|
||||
double binw;
|
||||
bool withz; // whether zeros are included in histogram
|
||||
double dt; // length of sample
|
||||
bool absolutetime; // do we sum absolute or percentage?
|
||||
@@ -203,7 +203,7 @@ class PowerHist : public QwtPlot
|
||||
bool LASTuseMetricUnits; // whether metric units are used (or imperial)
|
||||
bool LASTlny;
|
||||
bool LASTzoned; // show in zones
|
||||
int LASTbinw;
|
||||
double LASTbinw;
|
||||
bool LASTwithz; // whether zeros are included in histogram
|
||||
double LASTdt; // length of sample
|
||||
bool LASTabsolutetime; // do we sum absolute or percentage?
|
||||
|
||||
Reference in New Issue
Block a user