[Kst] [Bug 114826] Interpret axis as time doesn't display all of the time info

netterfield@astro.utoronto.ca netterfield at astro.utoronto.ca
Sat Oct 29 08:21:29 CEST 2005


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=114826         




------- Additional Comments From netterfield astro utoronto ca  2005-10-29 08:21 -------
SVN commit 475402 by netterfield:

CCBUG: 114826
Make offset tick label mode work again...


 M  +19 -19    kst2dplot.cpp  
 M  +1 -1      kst2dplot.h  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #475401:475402
 @ -1968,10 +1968,10  @
   // calculate offsets if we are using delta values
   if (tpx.delta && tpxLabelCount > 0 && tpy.delta && tpyLabelCount > 0) {
     _fullTickLabel->setRotation(270);
-    yFullTickLabelWidth = _fullTickLabel->size().width();
+//     yFullTickLabelWidth = _fullTickLabel->size().width();
     _fullTickLabel->setRotation(0);
     int xLabelWidth = _xLabel->size().width();
-    int yLabelWidth = _yLabel->size().width();
+    int yLabelHeight = _yLabel->size().height();
 
     if (xFullTickLabelWidth + xleft_bdr_px + _fullTickLabel->lineSpacing() >= (x_px - xLabelWidth)/2.0) {
       ybot_bdr_px += _fullTickLabel->lineSpacing();
 @ -1979,7 +1979,7  @
     } else if (_fullTickLabel->lineSpacing() > _xLabel->lineSpacing()) {
       ybot_bdr_px += _fullTickLabel->lineSpacing() - _xLabel->lineSpacing();
     }
-    if (yFullTickLabelWidth + ybot_bdr_px >= (y_px - yLabelWidth)/2.0) {
+    if (yFullTickLabelWidth + ybot_bdr_px >= (y_px - yLabelHeight)/2.0) {
       xleft_bdr_px += _fullTickLabel->lineSpacing();
       bOffsetY = true;
     } else if (_fullTickLabel->lineSpacing() > _yLabel->lineSpacing()) {
 @ -1994,8 +1994,8  @
       ybot_bdr_px += _fullTickLabel->lineSpacing() - _xLabel->lineSpacing();
     }
   } else if (tpy.delta && tpyLabelCount > 0) {
-    int yLabelWidth = _yLabel->size().width();
-    if (yFullTickLabelWidth + ybot_bdr_px >= (y_px - yLabelWidth)/2.0) {
+    int yLabelHeight = _yLabel->size().height();
+    if (yFullTickLabelWidth + ybot_bdr_px >= (y_px - yLabelHeight)/2.0) {
       xleft_bdr_px += _fullTickLabel->lineSpacing();
       bOffsetY = true;
     } else if (_fullTickLabel->lineSpacing() > _yLabel->lineSpacing()) {
 @ -2464,7 +2464,7  @
     plotAxes(p, RelPlotRegion,
         tpx, xleft_bdr_px, xright_bdr_px, x_orig_px, xtick_px, xtick_len_px, x_px,
         tpy, ytop_bdr_px, ybot_bdr_px, y_orig_px, ytick_px, ytick_len_px, y_px,
-        offsetX, offsetY);
+        offsetY);
 #ifdef BENCHMARK
     bt_label[i_bt] = "Plot Axes";
     bt[i_bt++] = benchTime.elapsed();
 @ -5455,7 +5455,7  @
                          double ytop_bdr_px, double ybot_bdr_px,
                          double y_orig_px, double ytick_px,
                          double ytick_len_px, int y_px,
-                         bool offsetX, bool offsetY) {
+                         bool offsetY) {
   QString TmpStr, TmpStrOld;
   double X1, Y1;
   double X2, Y2;
 @ -5610,29 +5610,27  @
 
   // x axis numbers
   if (!_suppressBottom) {
+    int yTickPos = d2i(y_px - ybot_bdr_px + _xTickLabel->lineSpacing()*0.15);
+    if (xTicksOutPlot()) {
+      yTickPos += d2i(2.0 * xtick_len_px);
+    }
+
     if (tpx.delta && !tpx.labels.isEmpty()) {
       _fullTickLabel->setText(tpx.labels[0]);
       p.save();
-      if (offsetX && !_xLabel->text().isEmpty()) {
-        p.translate(d2i(xleft_bdr_px) - _fullTickLabel->size().width() / 2, d2i(y_px) - _xLabel->lineSpacing());
-      } else {
-        p.translate(d2i(xleft_bdr_px) - _fullTickLabel->size().width() / 2, d2i(y_px));
-      }
+      p.translate(d2i(xleft_bdr_px), yTickPos+_xTickLabel->size().height());
       _fullTickLabel->paint(p);
       p.restore();
       tpx.labels.pop_front();
     }
-    int yTickPos = d2i(y_px - ybot_bdr_px + _xTickLabel->lineSpacing()*0.15);
-    if (xTicksOutPlot()) {
-      yTickPos += d2i(2.0 * xtick_len_px);
-    }
+
     // FIXME: inefficient.  We keep reparsing and re-rendering tpx.labels[.]
     for (i = tpx.iLo; i < tpx.iHi; i++) {
       double xTickPos = x_orig_px + (double)i * xtick_px;
       if (_xReversed) {
         xTickPos = x_px - xright_bdr_px - (xTickPos - xleft_bdr_px);
       }
-      
+
       _xTickLabel->setText(tpx.labels[i - tpx.iLo]);
       if (_xTickLabel->rotation() == 0) {
         p.save();
 @ -5678,11 +5676,13  @
   if (!_suppressLeft) {
     if (tpy.delta && !tpy.labels.isEmpty()) {
       _fullTickLabel->setText(tpy.labels[0]);
+      _fullTickLabel->setRotation(270);
       p.save();
       if (offsetY && !_yLabel->text().isEmpty()) {
-        p.translate(_fullTickLabel->lineSpacing(), d2i(y_px - ybot_bdr_px) + _fullTickLabel->size().height());
+        printf("offsetY\n");
+        p.translate(_yLabel->lineSpacing(), d2i(y_px - ybot_bdr_px) - _fullTickLabel->size().height());
       } else {
-        p.translate(0, d2i(y_px - ybot_bdr_px) + _fullTickLabel->size().height() / 2);
+        p.translate(0, d2i(y_px-ybot_bdr_px)-_fullTickLabel->size().height());
       }
       _fullTickLabel->paint(p);
       p.restore();
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #475401:475402
 @ -583,7 +583,7  @
       double ytop_bdr_px, double ybot_bdr_px,
       double y_orig_px, double ytick_px,
       double ytick_len_px, int y_px,
-      bool offsetX, bool offsetY);
+      bool offsetY);
   void plotGridLines(QPainter& p,
       double XTick, double xleft_bdr_px, double xright_bdr_px,
       double x_orig_px, double xtick_px, double xtick_len_px, int x_px,


More information about the Kst mailing list