Summary: | Local Y-zoom uses only one curve | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Nicolas Brisset <nicolas.brisset> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Nicolas Brisset
2006-01-17 17:31:32 UTC
SVN commit 499791 by arwalker: BUG:120332 Check all curves when determining local maximum. Consolidate autoBorder code so it is consistent. M +35 -51 kst2dplot.cpp M +1 -0 kst2dplot.h --- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #499790:499791 @@ -837,6 +837,23 @@ } +void Kst2DPlot::autoBorder(bool log, double& min, double& max) { + if (log) { + min = log10(min); + max = (max > 0.0) ? log10(max): 0.0; + double dx = (max-min)/40.0; + max += dx; + min -= dx; + max = pow(10.0, max); + min = pow(10.0, min); + } else { + double dx = (max-min)/40.0; + max += dx; + min -= dx; + } +} + + void Kst2DPlot::updateScale() { double mid, delta; bool first; @@ -879,19 +896,7 @@ XMin = pow(10.0, -350.0); } if (_xScaleMode == AUTOBORDER) { - if (_xLog) { - XMin = log10(XMin); - XMax = (XMax > 0.0) ? log10(XMax): 0.0; - double dx = (XMax-XMin)/40.0; - XMax += dx; - XMin -= dx; - XMax = pow(10.0, XMax); - XMin = pow(10.0, XMin); - } else { - double dx = (XMax-XMin)/40.0; - XMax += dx; - XMin -= dx; - } + autoBorder(_xLog, XMin, XMax); } break; @@ -1088,19 +1093,7 @@ YMin = pow(10.0, -350.0); } if (_yScaleMode == AUTOBORDER) { - if (_yLog) { - YMin = log10(YMin); - YMax = (YMax > 0) ? log10(YMax): 0; - double dy = (YMax-YMin)/40.0; - YMax += dy; - YMin -= dy; - YMax = pow(10.0, YMax); - YMin = pow(10.0, YMin); - } else { - double dy = (YMax-YMin)/40.0; - YMax += dy; - YMin -= dy; - } + autoBorder(_yLog, YMin, YMax); } break; @@ -4548,11 +4541,11 @@ void Kst2DPlot::zoomSelfYLocalMax(bool unused) { Q_UNUSED(unused); - double newYMin, newYMax; + double YMinCurve, YMaxCurve; // find local minimum and maximum - newYMin = 0.0; - newYMax = 1.0; + YMin = 0.0; + YMax = 1.0; bool first = true; // first check all the curves @@ -4560,38 +4553,29 @@ KstBaseCurvePtr c = Curves[i]; c->readLock(); if (!c->ignoreAutoScale()) { - c->yRange(XMin, XMax, &newYMin, &newYMax); + c->yRange(XMin, XMax, &YMinCurve, &YMaxCurve); + if (first || YMinCurve < YMin ) { + YMin = YMinCurve; + } + if (first || YMaxCurve > YMax ) { + YMax = YMaxCurve; + } first = false; } c->readUnlock(); } // if curves/images had no variation in them - if (newYMax <= newYMin) { - newYMin -= 0.1; - newYMax = newYMin + 0.2; + if (YMax <= YMin) { + YMin -= 0.1; + YMax = YMin + 0.2; } - if (_yLog && newYMin < 0.0) { - newYMin = pow(10.0, -350.0); + if (_yLog && YMin < 0.0) { + YMin = pow(10.0, -350.0); } - // just like AUTOBORDER, add a little bit to top and bottom - if (_yLog) { - newYMin = log10(newYMin); - newYMax = (newYMax > 0) ? log10(newYMax): 0; - double dy = (newYMax-newYMin)/40.0; - newYMax += dy; - newYMin -= dy; - newYMax = pow(10.0, newYMax); - newYMin = pow(10.0, newYMin); - } else { - double dy = (newYMax-newYMin)/40.0; - newYMax += dy; - newYMin -= dy; - } + autoBorder(_yLog, YMin, YMax); - YMin = newYMin; - YMax = newYMax; setYScaleMode(FIXED); } --- trunk/extragear/graphics/kst/kst/kst2dplot.h #499790:499791 @@ -426,6 +426,7 @@ double ymax, bool x_log = false, bool y_log = false); + void autoBorder(bool log, double& min, double& max); void setBorders(double& xleft_bdr_px, double& xright_bdr_px, double& ytop_bdr_px, double& ybot_bdr_px, TickParameters &tpx, TickParameters &tpy, |