Bug 86505 - Improvements to Plot dialog/Limits tab
Summary: Improvements to Plot dialog/Limits tab
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Solaris
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-03 17:32 UTC by Nicolas Brisset
Modified: 2004-09-09 00:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Brisset 2004-08-03 17:32:30 UTC
Version:           0.99-devel (using KDE 3.2.1, compiled sources)
Compiler:          gcc version 3.3.2
OS:                SunOS (sun4u) release 5.8

Here are a few suggestions regarding the Limits tab in the Plot dialog:
1) rename it to "Axes" !
2) add an option to specify ticks dranw on the axes (with one value for major tick spacing: e.g. one major tick every 100, and one for the number of minor ticks between 2 major ticks). Currently, this is automatic (and works quite well), but I can imagine it being useful
3) options to show major/minor grid lines, which are the continuation of major/minor ticks. To not make the plots overcrowded and hard to read, it is _necessary_ to be able to choose line width/style for grid lines or at least to make them less visible than curve lines
Comment 1 George Staikos 2004-08-05 19:03:28 UTC
Implemented #1.  Please file one bug report per item.  It makes it very difficult to track these otherwise.
Comment 2 Andrew Walker 2004-08-19 18:27:44 UTC
The suggestion for 2) would make zooming in and out almost useless. If we use fixed intervals for major ticks zooming in would make them too closely spaced to be legible, and zooming in would make them too sparse to be useful. At best I would suggest the user could specify how many major ticks they would on the x-axis. Even this would be of limited benefit; as Nicolas observers the current automatic behaviour "works quite well".
I think the idea for the number if minor ticks per major ticks is worth implementing though.
Comment 3 Rick Chern 2004-08-20 02:46:51 UTC
CVS commit by rchern: 

Grid lines for plots are now an option.  The lines are drawn using 1 pixel width, and dotted style.  The colours for major and minor grid lines can be specified separately (i.e. gray for major lines, and light gray for minor lines).

CCMAIL: 86505@bugs.kde.org


  M +102 -0    kst2dplot.cpp   1.236
  M +19 -0     kst2dplot.h   1.95
  M +48 -1     kstplotdialog_i.cpp   1.87
  M +5 -0      kstplotdialog_i.h   1.33
  M +14 -0     plotdialog.ui   1.49



Comment 4 Rick Chern 2004-08-21 22:08:22 UTC
CVS commit by rchern: 

Use custom minor ticks in log mode as well.  Replaces original automatic behaviour.

CCMAIL: 86505-done@bugs.kde.org


  M +40 -47    kst2dplot.cpp   1.240


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.239:1.240
@@ -4503,7 +4503,6 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
       }
       // draw minor ticks
-      if (XTick == 1.0) {
-        for (j = 0; j < _xMinorTicks; j++) {
-          X2 = log10((double)j / ((double)_xMinorTicks) * 9.0 + 1.0) * (double)xtick_px + X1;
+      for (j = 1; j < _xMinorTicks; j++) {
+        X2 = log10((double)j/((double)_xMinorTicks)*(pow(10,XTick)-1.0)+1.0)/XTick * (double)xtick_px + X1;
           if (X2 > xleft_bdr_px && X2 < x_px - xright_bdr_px) {
             p.drawLine(d2i(X2),
@@ -4519,5 +4518,4 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
         }
       }
-    }
   } else {
     /* Draw X Ticks */
@@ -4564,7 +4562,6 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
                    d2i(Y1));
       }
-      if (YTick == 1.0) {
         for (j = 1; j < _yMinorTicks; j++) {
-          Y2 = (-log10((double)j / ((double)_yMinorTicks) * 9.0 + 1.0) + 1.0) * (double)ytick_px + Y1;
+        Y2 = (YTick -(log10((double)j/((double)_yMinorTicks)*(pow(10,YTick)-1.0)+1.0)/YTick)) * (double)ytick_px + Y1;
           if (Y2 > ytop_bdr_px && Y2 < y_px - ybot_bdr_px) {
             p.drawLine(d2i(xleft_bdr_px),
@@ -4579,5 +4576,4 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
         }
       }
-    }
   } else {
     i = (int)ceil( (double)_yMinorTicks * ( ytop_bdr_px - 1.0 - y_orig_px ) / ytick_px );
@@ -4696,7 +4692,6 @@ void Kst2DPlot::plotGridLines(QPainter& 
       }
       // draw minor lines
-      if (XTick == 1.0) {
         for (j = 1; j < _xMinorTicks; j++) {
-          X2 = log10((double)j / ((double)_xMinorTicks) * 9.0 + 1.0) * (double)xtick_px + X1;
+        X2 = log10((double)j/((double)_xMinorTicks)*(pow(10,XTick)-1.0)+1.0)/XTick * (double)xtick_px + X1;
           if (_xMinorGrid && X2 > xleft_bdr_px && X2 < x_px - xright_bdr_px) {
             p.setPen(QPen(_minorGridColor, 0, Qt::DotLine));
@@ -4708,5 +4703,4 @@ void Kst2DPlot::plotGridLines(QPainter& 
         }
       }
-    }
   } else {
     /* Draw X grid lines */
@@ -4743,7 +4737,7 @@ void Kst2DPlot::plotGridLines(QPainter& 
                   d2i(Y1));
       }
-      if (YTick == 1.0) {
+      //draw minor lines
         for (j = 1; j < _yMinorTicks; j++) {
-          Y2 = (-log10((double)j / ((double)_yMinorTicks) * 9.0 + 1.0) + 1.0) * (double)ytick_px + Y1;
+        Y2 = YTick - (log10((double)j/((double)_yMinorTicks)*(pow(10,YTick)-1.0)+1.0)/YTick) * (double)ytick_px + Y1;
           if (_yMinorGrid && Y2 > ytop_bdr_px && Y2 < y_px - ybot_bdr_px) {
             p.setPen(QPen(_minorGridColor, 0, Qt::DotLine));
@@ -4755,5 +4749,4 @@ void Kst2DPlot::plotGridLines(QPainter& 
         }
       }
-    }
   } else {
     i = (int)ceil( (double)_yMinorTicks * ( ytop_bdr_px - 1.0 - y_orig_px ) / ytick_px );


Comment 5 Nicolas Brisset 2004-08-31 11:03:04 UTC
Wow ! I'm impressed to see all the nice things you guys implemented while I was on vacation :-)
I understand now why it is not good to file one report for many items, I apologize and I will not do it again in the future...(but this time I think it is still better to make all comments within the original report).

There are some very minor problems that it would be nice to fix regarding the current implementations of my wishes... Sorry I'm being a pain again, reopening a "fixed" bug !

- with part 2) of the report regarding major/minor ticks: minor ticks work as expected, but I'm having a hard time figuring out how to use major tick "density". I agree that xmgrace's way of doing this (you specify intervals, i.e. "10" would mean one major tick every time the X value increases by 10) messes up zooming, but here when I change the default "density" value of 5 (which apparently gives 6 major ticks in my case) to 6, 7, or 8 nothing changes. When I set it to 9 I get 13 or 15 ticks. Hmm, no so intuitive ! I'd suggest making the spinbox value the number of ticks drawn (probably not trivial to implement as the values would have to be rounded somehow to look good) or alternatively making this value the interval and adding as default a "Auto major" checkbox which corresponds to the default behavior working quite well. I personally favor the second which would certainly be easier to implement and allow to specify tick positions more accurately. If someone unchecks the "Auto major" button and zooming messes up X tick labels, he'll know how's to blame (the only thing to worry about would probably be to limit the number of ticks drawn with a warning in case the user setting results in far too many labels).

- with part 3) regarding grid lines: very cool :-). There is however one small bug which is that colors are not taken into account until they are changed (when grid lines are activated, they are drawn in black).
Comment 6 Andrew Walker 2004-08-31 23:17:12 UTC
part 3) should now be fixed.

I would agree that we need to rethink the major tick setting as what you ask for is not what you get.
Comment 7 Nicolas Brisset 2004-09-06 17:06:54 UTC
The bug with grid line colors not being taken into account is still there :-( (snapshot from 2004-09-03). They are drawn in black until the color is changed. Unchecking the "Default" checkbox also resets the color to black instead of leaving it at the current value.
Comment 8 Andrew Walker 2004-09-06 20:31:01 UTC
Nicloas,

Could you provide more details on your last comment. The default colour for the grid lines is chosen to be the foreground color of the plot (which is typically black, but can be changed).
If I uncheck the default box, select a new color (the original is going to be the default color), recheck the default, and then uncheck default again the colors I had last set are remembered. This is what I would expect to happen.
Comment 9 Nicolas Brisset 2004-09-07 00:10:58 UTC
I think grid lines should default to be less visible than curves, and a light grey color as shown in the color selector before one changes anything would be a perfect default (better than plot foreground to me). I was just surprised (and annoyed !) to have them appear in black when the color shown next to the "Default" checkbox was a nice light grey !
One thing that I have not tried is whether the manually chosen colors are kept and used as default the next time (next session). If the factory default is plot foreground but the colors are remembered once changed, that would not be so bad either.
Comment 10 Andrew Walker 2004-09-07 18:10:14 UTC
The nice light grey is the color that a color selector turns when it is disabled!
If the default checkbox is checked then the color selector is disabled.

Comment 11 Netterfield 2004-09-07 23:55:13 UTC
regarding the 'tick density':

kst's tick algorithm is:
	find the tick spacing from the set {1EX, 2EX, 5EX} which produces closest to 'tick density' ticks.  Normally, tick density is 5, so we get ~5 ticks. 
	Imagine we have 5 ticks, with a tick interval of 200.  The only nearby options are 10 ticks with an interval of 100, or 2 ticks, with an interval of 500.  So the adjustment will naturally be coarse.  So changing 'tick interval' may not do anything until you have changed it by ~a factor of 2.
	Perhaps a better UI for what we are doing might be something like
Major Tick Spacing: [ ] Coarse  [x] Default [ ] Fine  [ ] Finest
Coarse will give ~2 major ticks.  Default will be what we have now (~5).  Fine will be ~10, and finest will be ~15.
Comment 12 Andrew Walker 2004-09-09 00:39:42 UTC
CVS commit by arwalker: 

Implement the major tick spacing as proposed by Barth.

I think we should now close 86505, as it is addressing so many issues that is largely useless. If there are any remaining problems that someone feels were previously covered by this and are not yet addressed then please report a new (specific) bug.

CCMAIL: 86505-done@bugs.kde.org


  M +33 -5     kstplotdialog_i.cpp   1.96
  M +2 -1      kstplotdialog_i.h   1.37
  M +485 -503  plotdialog.ui   1.60