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
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