[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Mar 3 18:20:12 CET 2005


CVS commit by arwalker: 

More efficient when axis in date interpreted mode.


  M +34 -24    kst2dplot.cpp   1.363


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.362:1.363
@@ -1376,5 +1376,7 @@ void Kst2DPlot::convertJDToDateString(Ks
   }
 
+  //
   // check how many decimal places for the seconds we actually need to show
+  //
   if (accuracy > 0) {
     QString strSecond;
@@ -1450,5 +1452,7 @@ void Kst2DPlot::convertTimeValueToString
   value = convertTimeValueToJD(axisInterpretation, value);
 
+  //
   // print value in appropriate format
+  //
   switch (axisDisplay) {
     case AXIS_DISPLAY_YEAR:
@@ -1494,5 +1498,7 @@ void Kst2DPlot::convertDiffTimevalueToSt
   zdiff = convertTimeDiffValueToDays(axisInterpretation, zdiff);
 
+  //
   // convert difference to desired format
+  //
   switch (axisDisplay) {
     case AXIS_DISPLAY_YEAR:
@@ -3012,7 +3018,5 @@ void Kst2DPlot::updateMousePos(QPoint po
   QRect pr = GetPlotRegion();
   double xmin, ymin, xmax, ymax, xpos, ypos;
-  double xdelta, ydelta;
   uint length;
-  int iXPrecision, iYPrecision;
 
   getLScale(xmin, ymin, xmax, ymax);
@@ -3020,4 +3024,17 @@ void Kst2DPlot::updateMousePos(QPoint po
   xpos = (double)(pos.x() - pr.left())/(double)pr.width();
   xpos = xpos * (xmax - xmin) + xmin;
+
+  ypos = (double)(pos.y() - pr.top())/(double)pr.height();
+  ypos = ypos * (ymin - ymax) + ymax;
+
+  _copy_x = xpos;
+  _copy_y = ypos;
+
+  if (_isXAxisInterpreted) {
+    genAxisTickLabelFullPrecision(_xAxisInterpretation, _xAxisDisplay, xlabel, length, xpos, isXLog(), true);
+  } else {
+    double xdelta;
+    int iXPrecision;
+    
   xdelta = (xmax-xmin)/(double)pr.width();
   if (isXLog()) {
@@ -3030,7 +3047,13 @@ void Kst2DPlot::updateMousePos(QPoint po
     iXPrecision = 1;
   }
+    xlabel = QString("%1").arg(xpos,0,'G',iXPrecision);    
+  }
+
+  if (_isYAxisInterpreted) {
+    genAxisTickLabelFullPrecision(_yAxisInterpretation, _yAxisDisplay, ylabel, length, ypos, isYLog(), true);
+  } else {
+    double ydelta;
+    int iYPrecision;
 
-  ypos = (double)(pos.y() - pr.top())/(double)pr.height();
-  ypos = ypos * (ymin - ymax) + ymax;
   ydelta = (ymax-ymin)/(double)pr.height();
   if (isYLog()) {
@@ -3043,17 +3066,4 @@ void Kst2DPlot::updateMousePos(QPoint po
     iYPrecision = 1;
   }
-
-  _copy_x = xpos;
-  _copy_y = ypos;
-
-  if (_isXAxisInterpreted) {
-    genAxisTickLabelFullPrecision(_xAxisInterpretation, _xAxisDisplay, xlabel, length, xpos, isXLog(), true);
-  } else {
-    xlabel = QString("%1").arg(xpos,0,'G',iXPrecision);    
-  }
-  
-  if (_isYAxisInterpreted) {
-    genAxisTickLabelFullPrecision(_yAxisInterpretation, _yAxisDisplay, ylabel, length, ypos, isYLog(), true);
-  } else {
     ylabel = QString("%1").arg(ypos,0,'G',iYPrecision);
   }
@@ -3167,5 +3177,5 @@ void Kst2DPlot::highlightNearestDataPoin
         
         if (_isYAxisInterpreted) {
-          genAxisTickLabelFullPrecision(_yAxisInterpretation, _yAxisDisplay, ylabel, length, xpos, isXLog(), true);
+          genAxisTickLabelFullPrecision(_yAxisInterpretation, _yAxisDisplay, ylabel, length, ypos, isYLog(), true);
         } else {
           ylabel = QString("%1").arg(ypos,0,'G');




More information about the Kst mailing list