Bug 129109 - Minor ticks for log-mode reversed axis are drawn incorrectly
Summary: Minor ticks for log-mode reversed axis are drawn incorrectly
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-13 23:17 UTC by Andrew Walker
Modified: 2006-06-13 23:20 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 Andrew Walker 2006-06-13 23:17:01 UTC
Version:           1.2.1 (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:
When an axis is in log-mode and reversed if it displays any minor ticks they will be drawn in the wrong position.

STEPS TO REPRDOUCE:
Start kst
Create a plot
Switch to log mode for the x-axis
Reverse the x-axis
Ensure that minor ticks are displayed by zooming out as much as necessary

RESULTS:
The minor ticks are not aligned correctly with the major ticks

EXPECTED RESULTS:
The minor ticks are aligned correctly with the major ticks
Comment 1 Andrew Walker 2006-06-13 23:20:43 UTC
SVN commit 551183 by arwalker:

BUG:129109 Correctly handle minor tick marks for log-mode and reversed axis (both x and y)

 M  +20 -12    kst2dplot.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #551182:551183
@@ -5590,22 +5590,26 @@
 
   // draw x-ticks
   if (_xLog) {
+    double XPos;
+    
     i = (int)floor((double)_xMajorTicks*(xleft_bdr_px - 1.0 - x_orig_px)/xtick_px);
     for (;xtick_px * i + x_orig_px < x_px - xright_bdr_px + 1; i++) {
       // draw major ticks
       X1 = (x_orig_px + double(i) * xtick_px);
       if (_xReversed) {
-        X1 = x_px - xright_bdr_px - (X1 - xleft_bdr_px);
+        XPos = x_px - xright_bdr_px - (X1 - xleft_bdr_px);
+      } else {
+        XPos = X1;
       }
-      if (X1 > xleft_bdr_px && X1 < x_px - xright_bdr_px) {
-        p.drawLine(d2i(X1),
+      if (XPos > xleft_bdr_px && XPos < x_px - xright_bdr_px) {
+        p.drawLine(d2i(XPos),
                    xMajorTopTickTop,
-                   d2i(X1),
+                   d2i(XPos),
                    xMajorTopTickBottom);
 
-        p.drawLine(d2i(X1),
+        p.drawLine(d2i(XPos),
                    xMajorBottomTickBottom,
-                   d2i(X1),
+                   d2i(XPos),
                    xMajorBottomTickTop);
       }
 
@@ -5659,22 +5663,26 @@
 
   // draw y ticks
   if (_yLog) {
+    double YPos;
+    
     i = (int)floor( (double)_yMajorTicks * ( ytop_bdr_px - 1.0 - y_orig_px ) / ytick_px );
     for (; ytick_px * i + y_orig_px < y_px - ybot_bdr_px + 1; i++) {
       // draw major ticks
       Y1 = y_orig_px + (double)i * ytick_px;
       if (_yReversed) {
-        Y1 = y_px - ybot_bdr_px - (Y1 - ytop_bdr_px);
+        YPos = y_px - ybot_bdr_px - (Y1 - ytop_bdr_px);
+      } else {
+        YPos = Y1;
       }
-      if (Y1 > ytop_bdr_px) {
+      if (YPos > ytop_bdr_px && YPos < y_px - ybot_bdr_px) {
         p.drawLine(yMajorLeftTickLeft,
-                   d2i(Y1),
+                   d2i(YPos),
                    yMajorLeftTickRight,
-                   d2i(Y1));
+                   d2i(YPos));
         p.drawLine(yMajorRightTickRight,
-                   d2i(Y1),
+                   d2i(YPos),
                    yMajorRightTickLeft,
-                   d2i(Y1));
+                   d2i(YPos));
       }
 
       // draw minor ticks