Bug 87915 - Y FIXED RANGE IS BROKEN
Summary: Y FIXED RANGE IS BROKEN
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Other
: VHI normal
Target Milestone: ---
Assignee: Andrew Walker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-24 10:36 UTC by Marc-Antoine Miville-Deschenes
Modified: 2004-08-25 19:35 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 Marc-Antoine Miville-Deschenes 2004-08-24 10:36:38 UTC
Version:           1.0.0_devel (using KDE 3.1.4)
Installed from:    compiled sources
Compiler:          gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
OS:                Darwin (Power Macintosh) release 7.5.0

In log mode the Y fixed range does not work.
When you set a Ymin and Ymax and hit Apply Edits
KST recomputed the "Auto Scale" value and does not
take into account the range given.

THIS BUG SHOULD HAVE A VERY HIGH PRIORITY !
Comment 1 Andrew Walker 2004-08-24 18:00:51 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.
Comment 2 Matthew Truch 2004-08-25 05:07:09 UTC
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.  
Comment 3 Rick Chern 2004-08-25 18:58:01 UTC
This seems to happen with the X range as well, if MAX is greater than 300 or so.
Comment 4 Andrew Walker 2004-08-25 19:35:42 UTC
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()) {