[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Fri Jul 10 16:57:09 CEST 2009


SVN commit 994394 by fenton:

Revert enforceMin change allow corner case label overlap to ensure minimum ticks are enforced.


 M  +3 -7      plotaxis.cpp  
 M  +1 -1      plotaxis.h  


--- branches/work/kst/portto4/kst/src/libkstapp/plotaxis.cpp #994393:994394
@@ -802,10 +802,6 @@
     qreal max = _orientation == Qt::Horizontal ? plotItem()->projectionRect().right() : plotItem()->projectionRect().bottom();
     qreal majorTickSpacing = computedMajorTickSpacing(majorTickCount, _orientation);
 
-    //if (useOverrideTicks && (((max - min) / majorTickSpacing) > majorTickCount)) {
-      //majorTickSpacing = computedMajorTickSpacing(majorTickCount, _orientation, false);
-    //}
-
     qreal firstTick = ceil(min / majorTickSpacing) * majorTickSpacing;
 
 #if MAJOR_TICK_DEBUG 
@@ -936,7 +932,7 @@
  * on the axis (but at least 2). The value of M is set by the requested
  * MajorTickMode.
  */
-qreal PlotAxis::computedMajorTickSpacing(MajorTickMode majorTickCount, Qt::Orientation orientation, bool enforceMin) {
+qreal PlotAxis::computedMajorTickSpacing(MajorTickMode majorTickCount, Qt::Orientation orientation) {
   qreal R = orientation == Qt::Horizontal ? plotItem()->projectionRect().width() : plotItem()->projectionRect().height();
   qreal M = majorTickCount;
   qreal B = floor(log10(R/M));
@@ -965,7 +961,7 @@
   if (s1 <= s2 && s1 <= s5) {
     return d1;
   } else if (s2 <= s5) {
-    if (enforceMin && (M == 2) && (r2 > R)) {
+    if ((M == 2) && (r2 > R)) {
 #if MAJOR_TICK_DEBUG 
       qDebug() << "Minimum ticks not met using d2 using d1 instead";
 #endif
@@ -975,7 +971,7 @@
       return d2;
     }
   } else {
-    if (enforceMin && (M == 2) && (r5 > R)) {
+    if ((M == 2) && (r5 > R)) {
 #if MAJOR_TICK_DEBUG 
       qDebug() << "Minimum ticks not met using d5 using d2 instead";
 #endif
--- branches/work/kst/portto4/kst/src/libkstapp/plotaxis.h #994393:994394
@@ -134,7 +134,7 @@
     double convertTimeDiffValueToDays(AxisInterpretationType axisInterpretation, double offsetIn);
     double interpretOffset(AxisInterpretationType axisInterpretation, AxisDisplayType axisDisplay, double base, double value);
 
-    qreal computedMajorTickSpacing(MajorTickMode majorTickCount, Qt::Orientation orientation, bool enforceMin = true);
+    qreal computedMajorTickSpacing(MajorTickMode majorTickCount, Qt::Orientation orientation);
     void computeLogTicks(QList<qreal> *MajorTicks, QList<qreal> *MinorTicks, QMap<qreal, QString> *Labels, qreal min, qreal max, MajorTickMode tickMode);
 
     MajorTickMode convertToMajorTickMode(int tickCount);


More information about the Kst mailing list