Bug 96334

Summary: Add ability to easily perform math operations on scalars in labels etc.
Product: [Applications] kst Reporter: Matthew Truch <matt>
Component: generalAssignee: George Staikos <staikos>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:

Description Matthew Truch 2005-01-05 03:50:37 UTC
Version:           1.1.0_devel (using KDE KDE 3.3.2)
Installed from:    Slackware Packages
OS:                Linux

Sometimes you want to perform simple math on scalars when you display them, but you don't want to create a whole equation just to do this.  Instead it would be nice to be able to do this within the label text.  There would need to be a way to designate one is in this kind of math mode; I suggest the square brackets as is used for scalars themselves.  

Example:  I want to display twice the range of my curve.  I would use the text:
[2*([V1-myCurve-Max]-[V1-myCurve-Min])] in my label and the requested operation would be performed on the scalars.
Comment 1 George Staikos 2005-01-05 21:33:57 UTC
The grammar for this is a bit ad-hoc.  How about something like this:
"My label [eqn:1+[foo]/2] [anotherscalar] [astring]"

This is easy enough to do and doesn't require guess work.
Comment 2 Matthew Truch 2005-01-05 21:52:29 UTC
> The grammar for this is a bit ad-hoc.  How about something like this:
> "My label [eqn:1+[foo]/2] [anotherscalar] [astring]"
> 
> This is easy enough to do and doesn't require guess work.

eqn isn't bad, but how about the = sign (as is used in spread sheets)?

[=1+[foo]/2]

Comment 3 George Staikos 2005-01-05 21:58:43 UTC
On Wednesday 05 January 2005 15:52, Matthew Truch wrote:
> > The grammar for this is a bit ad-hoc.  How about something like this:
> > "My label [eqn:1+[foo]/2] [anotherscalar] [astring]"
> >
> > This is easy enough to do and doesn't require guess work.
>
> eqn isn't bad, but how about the = sign (as is used in spread sheets)?
>
> [=1+[foo]/2]

   That's perfectly fine with me, and a better idea.  Now the next question is 
how well does the parser handle nested brackets. :-)

Comment 4 George Staikos 2005-06-16 18:26:28 UTC
KstViewLabel now supports this and when KstLabel is reworked, it will also support it.  I'll close when it's fully integrated.
Comment 5 George Staikos 2005-08-08 21:02:53 UTC
This can be done in view labels and once the new renderer is integrated into 2dplot, it can be done there too.  As much as needed is done on this now.