Bug 118737 - Equation names generation could be improved
Summary: Equation names generation could be improved
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Solaris
: HI wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-20 18:51 UTC by Nicolas Brisset
Modified: 2006-06-17 00:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Brisset 2005-12-20 18:51:58 UTC
Version:           1.2.0_devel (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

This was first suggested in bug #117817 (fit labels update problem) but Andrew said it belonged in a separate report...
There are now actually two ideas, but I suppose they are strongly linked together so that one report should be OK.

If you create an equation with the expression "[Vec1] +  1.5]", in the corresponding legend it will say "Vec1 + 15". This can be misleading... If there is no compelling reason to drop dots in the equation names, I'd suggest keeping them.

Similarly, if the name is too long it will be truncated with an ellipsis. While this may be required to fit in a legend box for instance, I think it would be better to keep the complete name e.g. to find it in the data manager. If at some point we need to make it shorter, wecan probably used a KSqueezedText or similar class that will care for that "downstream".
Comment 1 Andrew Walker 2005-12-20 19:07:00 UTC
The problem is not with the name in the legend (which correctly gives the curve name) but is with the name of the curve created from the expression.
Comment 2 Nicolas Brisset 2005-12-21 09:29:00 UTC
I agree that the problem is "upstream", i.e. when the curve name gets created. That's why I suggested to create the most logical curve name (not abbreviated, and with all the dots in it) and only squeeze it where it makes sense.
Comment 3 Andrew Walker 2006-01-26 19:49:42 UTC
Should be fixed for 1.2.1 release
Comment 4 Andrew Walker 2006-05-16 00:13:07 UTC
The problem is in KstEqDialogI::newObject()

which both removes "." in the equation name:

  QString etext = _w->_equation->text();
  etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_]"));

and also truncates the equation name to 12 characters:

  if (etext.length() > 12) {
    etext.truncate(12);
    etext += "...";
  }

Can anyone explaing the reason for the former? The latter is for more obvious reasons, but why not follow Nicolas' idea and truncate the name when it is displayed?
Comment 5 George Staikos 2006-05-16 00:59:22 UTC
r368837 | staikos | 2004-12-06 00:48:41 -0500 (Mon, 06 Dec 2004) | 4 lines

Sanify generated equation names.  Thoughts on this?  Could be better maybe?

BUG: 93021
Comment 6 Andrew Walker 2006-05-17 23:36:37 UTC
So, is there any reason to remove "." from the equation name?

Comment 7 Netterfield 2006-05-21 00:15:26 UTC
There doesn't seem to be any reason to remove it, so lets un-remove it.
Comment 8 Andrew Walker 2006-05-23 18:41:50 UTC
SVN commit 544119 by arwalker:

CCBUG:118737 Do not remove '.' from equation name as there is no good reason to do so.

 M  +1 -1      ksteqdialog_i.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/ksteqdialog_i.cpp #544118:544119
@@ -144,7 +144,7 @@
 bool KstEqDialogI::newObject() {
   QString tag_name = _tagName->text();
   QString etext = _w->_equation->text();
-  etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_]"));
+  etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_.]"));
   if (etext.length() > 12) {
     etext.truncate(12);
     etext += "...";
Comment 9 Andrew Walker 2006-05-24 22:52:22 UTC
Do we still want to truncate the name to 12 characters or leave the name untruncated and handle the display issues where necessary?
Comment 10 George Staikos 2006-05-25 14:41:54 UTC
Making very long names affects usage in KstScript too.  I don't want anymore 
playing around with the tag name generation unless we have a clear definition 
of what a tagname is first.  In terms of length, a long tagname is a bit 
annoying to deal with.  I prefer truncation and then finding a unique name in 
a collision case.
Comment 11 Netterfield 2006-06-17 00:43:38 UTC
The dot issue has been fixed. We will keep truncating to 12 characters.

Barring someone coming up with a better tag name for equations, the best suggestion is to encourage users to name their equations themselves.