Bug 96334 - Add ability to easily perform math operations on scalars in labels etc.
Summary: Add ability to easily perform math operations on scalars in labels etc.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Slackware Linux
: NOR wishlist
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-05 03:50 UTC by Matthew Truch
Modified: 2005-08-08 21:02 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 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.