Summary: | Y FIXED RANGE IS BROKEN | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Marc-Antoine Miville-Deschenes <mamd> |
Component: | general | Assignee: | Andrew Walker <arwalker> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | VHI | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Marc-Antoine Miville-Deschenes
2004-08-24 10:36:38 UTC
I was unable to reproduce this using column 1 from gyrodata.dat. Putting a plot into log-mode for the y-axis and setting the y-axis limits to 0.01 and 10.0 does exactly what I would expect. Could you please give more details as to the dataset, limits entered, etc. I have reproduced this bug in kst 0.99. I have two vectors plotted as one curve, where 0<x<30 and 0<y<360 for all the data points. X axis set to auto-scale linear, Y axis set to auto-scale, logarithmic. Now open the axes tab of the plot dialog, for y axis: click on fixed: range, and enter 0.01 for the minimum and 600 for the max. Now click Apply Edits. Expected behavior: y axis range is now 0.01 to 600 Actual behavior: y axis range instantly reverts to auto-scale range, although fixed: range radio button remains selected. Note: This only happens if you make the range bigger (specifically in the max value) than the auto-scale range. I'm not sure about all cases though. This seems to happen with the X range as well, if MAX is greater than 300 or so. CVS commit by arwalker: Differentiate between calls to setXRange and setLXRange, and check the arnge accordingly. In the interim a workaround is to set the desired range in non-log mode, and then switch to log mode. CCMAIL: 87915-done@bugs.kde.org M +24 -8 kst2dplot.cpp 1.251 M +2 -1 kst2dplot.h 1.103 M +3 -3 kstplotdialog_i.cpp 1.92 --- kdeextragear-2/kst/kst/kst2dplot.cpp #1.250:1.251 @@ -459,5 +459,22 @@ void Kst2DPlot::setYLabel(const QString& -bool Kst2DPlot::checkRange(double &min_in, double &max_in, bool bIsLog) { +bool Kst2DPlot::checkRange(double &min_in, double &max_in) { + double diff = fabs(1000.0 * min_in) * DBL_EPSILON; + bool rc = true; + + if (isnan(min_in) || isnan(max_in) || + isinf(min_in) || isinf(max_in)) { + rc = false; + } + + if (rc && max_in <= min_in + diff) { + max_in = min_in + diff; + } + + return rc; +} + + +bool Kst2DPlot::checkLRange(double &min_in, double &max_in, bool bIsLog) { double diff = fabs(1000.0 * min_in) * DBL_EPSILON; bool rc = true; @@ -484,5 +501,5 @@ bool Kst2DPlot::setXScale(double xmin_in bool rc = false; - if (checkRange(xmin_in, xmax_in, _xLog)) { + if (checkRange(xmin_in, xmax_in)) { XMax = xmax_in; XMin = xmin_in; @@ -497,5 +514,5 @@ bool Kst2DPlot::setYScale(double ymin_in bool rc = false; - if (checkRange(ymin_in, ymax_in, _yLog)) { + if (checkRange(ymin_in, ymax_in)) { YMax = ymax_in; YMin = ymin_in; @@ -510,5 +527,5 @@ bool Kst2DPlot::setLXScale(double xmin_i bool rc = false; - if (checkRange(xmin_in, xmax_in, _xLog)) { + if (checkLRange(xmin_in, xmax_in, _xLog)) { if (_xLog) { XMax = pow(10.0, xmax_in); @@ -528,5 +545,5 @@ bool Kst2DPlot::setLYScale(double ymin_i bool rc = false; - if (checkRange(ymin_in, ymax_in, _yLog)) { + if (checkLRange(ymin_in, ymax_in, _yLog)) { if (_yLog) { YMax = pow(10.0, ymax_in); @@ -1125,5 +1142,4 @@ void Kst2DPlot::genAxisTickLabels(QPaint for (i = iIndexLo; i < iIndexHi; i++) { genAxisTickLabel(strTmp, (double)i * Tick + Org, bLog); - dMaxWidth = Label->rotation(); Label->setText(strTmp); dWidth = Label->rotatedWidth(p); @@ -1956,6 +1972,6 @@ void Kst2DPlot::matchAxis(int id) { p->getScale(x0, y0, x1, y1); setLog(p->isXLog(), p->isYLog()); - setXScaleMode(FIXED); //p->getXScaleMode()); - setYScaleMode(FIXED); //p->getYScaleMode()); + setXScaleMode(FIXED); + setYScaleMode(FIXED); setXScale(x0, x1); setYScale(y0, y1); --- kdeextragear-2/kst/kst/kst2dplot.h #1.102:1.103 @@ -70,5 +70,6 @@ public: static Kst2DPlotList globalPlotList(); - static bool checkRange(double &min_in, double &max_in, bool bIsLog); + static bool checkRange(double &min_in, double &max_in); + static bool checkLRange(double &min_in, double &max_in, bool bIsLog); static void genAxisTickLabelFullPrecision(QString& label, double z, bool isLog); static void genAxisTickLabelDifference(QString& label, double zbase, double zvalue, bool isLog); --- kdeextragear-2/kst/kst/kstplotdialog_i.cpp #1.91:1.92 @@ -496,4 +496,6 @@ void KstPlotDialogI::applyLegends(Kst2DP void KstPlotDialogI::applyLimits(Kst2DPlotPtr plot) { + plot->setLog(XIsLog->isChecked(), YIsLog->isChecked()); + /* do X Scale */ if (XAC->isChecked()) { @@ -530,6 +532,4 @@ void KstPlotDialogI::applyLimits(Kst2DPl } - plot->setLog(XIsLog->isChecked(), YIsLog->isChecked()); - //minor tick settings if (_xMinorTicksAuto->isChecked()) { |