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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Feb 3 00:17:27 CET 2011


SVN commit 1218574 by netterfield:

If in interpret axis as time mode, remove the units from the auto label, since
they are already shown in the offset (and they may be different...).



 M  +16 -2     plotitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1218573:1218574
@@ -1893,9 +1893,16 @@
 QString PlotItem::autoLeftLabel() const {
   foreach (PlotRenderItem *renderer, renderItems()) {
     QString label = renderer->leftLabel();
-    if (!label.isEmpty())
+    if (!label.isEmpty()) {
+      if (_yAxis->axisInterpret()) { // remove units
+        QRegExp rx(" \\[*\\]");
+        rx.setPatternSyntax(QRegExp::Wildcard);
+        return label.remove(rx);
+      } else {
       return label;
   }
+    }
+  }
   return QString();
 }
 
@@ -1912,9 +1919,16 @@
 QString PlotItem::autoBottomLabel() const {
   foreach (PlotRenderItem *renderer, renderItems()) {
     QString label = renderer->bottomLabel();
-    if (!label.isEmpty())
+    if (!label.isEmpty()) {
+      if (_xAxis->axisInterpret()) { // remove units
+        QRegExp rx(" \\[*\\]");
+        rx.setPatternSyntax(QRegExp::Wildcard);
+        return label.remove(rx);
+      } else {
       return label;
   }
+    }
+  }
   return QString();
 }
 


More information about the Kst mailing list