Bug 117821 - datamode is borked (sideways?)
Summary: datamode is borked (sideways?)
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-06 21:09 UTC by Matthew Truch
Modified: 2005-12-07 00:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2005-12-06 21:09:52 UTC
Version:           1.2.0_svn_485855 (using KDE KDE 3.4.2)
Installed from:    Fedora RPMs
OS:                Linux

Datamode is borked.  

It seems to search for the nearest datapoint to the cursor horozontally, rather than vertically.  This is very confusing.  

How to reproduce:
Plot a curve.
Turn on datamode.
Move mouse around.
Comment 1 George Staikos 2005-12-06 21:34:21 UTC
1.2.0 item.
Comment 2 Andrew Walker 2005-12-07 00:32:43 UTC
SVN commit 486173 by arwalker:

BUG:117821 Fix typo

 M  +3 -4      kst2dplot.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #486172:486173
@@ -3505,7 +3505,6 @@
     ypos = (double)(pos.y() - pr.top())/(double)pr.height();
   }
   ypos = ypos * (ymin - ymax) + ymax;
-
   if (isYLog()) {
     ypos = pow(10.0, ypos);
   }
@@ -3515,7 +3514,7 @@
 bool Kst2DPlot::getNearestDataPoint(const QPoint& pos, QString& name, double &newxpos, double &newypos, double xpos, double ypos, double xmin, double xmax) {
   QRect pr = GetPlotRegion();
   bool rc = false;
-    
+
   // only makes sense to get nearest data point for vcurves
   KstVCurveList vcurves = kstObjectSubList<KstBaseCurve,KstVCurve>(Curves);
   if (vcurves.count() > 0) {
@@ -3530,12 +3529,12 @@
     if (_xReversed) {
       dx_per_pix = (double)(pr.right() + 2 - pos.x() + 2) / (double)pr.width() * (xmax - xmin) + xmin;
     } else {
-      dx_per_pix = (double)(pos.x()+2 - pr.left() + 2) / (double)pr.width() * (xmax - xmin) + xmin;
+      dx_per_pix = (double)(pos.x() + 2 - pr.left() + 2) / (double)pr.width() * (xmax - xmin) + xmin;
     }
     if (isXLog()) {
       dx_per_pix = pow(10.0, dx_per_pix);
     }
-    dx_per_pix -= newxpos;  
+    dx_per_pix -= xpos;  
     
     for (KstVCurveList::Iterator i = vcurves.begin(); i != vcurves.end(); ++i) {
       i_near_x = (*i)->getIndexNearXY(xpos, dx_per_pix, ypos);