[Kst] kdeextragear-2/kst/kst

Rick Chern rchern at interchange.ubc.ca
Sat Aug 21 02:06:16 CEST 2004


CVS commit by rchern: 

Use custom minor ticks in log mode, but currently only when major ticks are a power of 10 apart, like before.


  M +30 -22    kst2dplot.cpp   1.239
  M +1 -1      kst2dplot.h   1.98


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.238:1.239
@@ -79,4 +79,12 @@ Kst2DPlot::Kst2DPlot(const QString& in_t
   _height = 0.0;
 
+  //defaults, mainly used by data wizard
+  _xMajorGrid = false;
+  _xMinorGrid = false;
+  _yMajorGrid = false;
+  _yMinorGrid = false;
+  _xMinorTicks = 5;
+  _yMinorTicks = 5;
+
   commonConstructor(in_tag, yscale_in, xscale_in, xmin_in, ymin_in,
                     xmax_in, ymax_in);
@@ -4496,6 +4504,6 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
       // draw minor ticks
       if (XTick == 1.0) {
-        for (j = 2; j < 10; j++) {
-          X2 = log10((double)j) * (double)xtick_px + X1;
+        for (j = 0; j < _xMinorTicks; j++) {
+          X2 = log10((double)j / ((double)_xMinorTicks) * 9.0 + 1.0) * (double)xtick_px + X1;
           if (X2 > xleft_bdr_px && X2 < x_px - xright_bdr_px) {
             p.drawLine(d2i(X2),
@@ -4557,6 +4565,6 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
       }
       if (YTick == 1.0) {
-        for (j = 2; j < 10; j++) {
-          Y2 = (-log10((double)j) + 1.0) * (double)ytick_px + Y1;
+        for (j = 1; j < _yMinorTicks; j++) {
+          Y2 = (-log10((double)j / ((double)_yMinorTicks) * 9.0 + 1.0) + 1.0) * (double)ytick_px + Y1;
           if (Y2 > ytop_bdr_px && Y2 < y_px - ybot_bdr_px) {
             p.drawLine(d2i(xleft_bdr_px),
@@ -4689,6 +4697,6 @@ void Kst2DPlot::plotGridLines(QPainter& 
       // draw minor lines
       if (XTick == 1.0) {
-        for (j = 2; j < 10; j++) {
-          X2 = log10((double)j) * (double)xtick_px + X1;
+        for (j = 1; j < _xMinorTicks; j++) {
+          X2 = log10((double)j / ((double)_xMinorTicks) * 9.0 + 1.0) * (double)xtick_px + X1;
           if (_xMinorGrid && X2 > xleft_bdr_px && X2 < x_px - xright_bdr_px) {
             p.setPen(QPen(_minorGridColor, 0, Qt::DotLine));
@@ -4736,6 +4744,6 @@ void Kst2DPlot::plotGridLines(QPainter& 
       }
       if (YTick == 1.0) {
-        for (j = 2; j < 10; j++) {
-          Y2 = (-log10((double)j) + 1.0) * (double)ytick_px + Y1;
+        for (j = 1; j < _yMinorTicks; j++) {
+          Y2 = (-log10((double)j / ((double)_yMinorTicks) * 9.0 + 1.0) + 1.0) * (double)ytick_px + Y1;
           if (_yMinorGrid && Y2 > ytop_bdr_px && Y2 < y_px - ybot_bdr_px) {
             p.setPen(QPen(_minorGridColor, 0, Qt::DotLine));





More information about the Kst mailing list