Bug 117817 - Only the first parameter is shown in fit labels
Summary: Only the first parameter is shown in fit labels
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: HI normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-06 20:37 UTC by Netterfield
Modified: 2006-03-02 01:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (7.79 KB, patch)
2006-02-28 19:36 UTC, Andrew Walker
Details
Proposed patch (9.02 KB, patch)
2006-03-01 20:07 UTC, Andrew Walker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2005-12-06 20:37:31 UTC
Version:           1.2.0_devel (using KDE 3.4.1, Gentoo)
Compiler:          gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
OS:                Linux (i686) release 2.6.9-gentoo-r6

Create a plot of something.
rmb-fit-><curve>.  Select, eg polynomial fit, set to , eg, 4th order, apply.

The fit is drawn, but only the first parameter value appears in the fit label.

This is not isolated to polynomial fits.

All of the parameters should be shown.
Comment 1 Nicolas Brisset 2005-12-07 07:49:34 UTC
I think there is another problem: the dots ('.') seem to be escaped, so that if you fit 1.23*x + 4.5 you will get a fit label saying "123*x + 45". I actually think I have seen this problem in other labels too, but I can't remember where right now.
Comment 2 Andrew Walker 2005-12-07 19:52:10 UTC
For the comment from Nicolas:
This is because the dots ('.') get dropped from the curve name created from the equation, not because they get dropped from the fit label. If you think this is a problem then please enter a new bug report.

For the original bug report:
When the label is created the output vector containing the fit parameters has not yet been updated, and has its default size of 1. As a result only the first parameter is displayed - which gets updated on the display as soon as the fit has been updated for the first time. The solution would be to update the entire label at this time, but the label is an independent object at that point.

Comment 3 Netterfield 2006-01-25 20:56:02 UTC
Any ideas on how to fix this?
Comment 4 Andrew Walker 2006-02-22 02:28:12 UTC
The proposed solution here would be to introduce some new syntax such that a label could indicate it would contain the results of a particular fit. At the simplest this would be [<fit name>], using the same syntax as for scalars. If no scalar of such a name existed then the existing fits would be searched.
Comment 5 Netterfield 2006-02-22 08:00:26 UTC
I like the suggested solution, but I worry about namespace collision.
We are essentially introducing the syntax which will eventually be used for all 'string' references...  
options: 
1) strings and scalars share a name space, so if there is a string called [abc], the scalars named [abc] are forbidden.
2) strings and scalars don't share, and so need to be reference strings in a different way than we reference scalars.  so [abc] vs , eg, [$abc]

I prefer (1), but it will be very hard to enforce, I fear.  (2) will be a lot easier implement.

Thoughts?
Comment 6 Nicolas Brisset 2006-02-22 14:23:30 UTC
I think 1) or 2) are acceptable. It will mostly be a matter of documenting it properly and getting used to it... I'd say we can go for the cleanest and/or easiest implementation.
However, I have a concern regarding the sequence of events. From what I have understood, text labels from fits need to be updated when the fit plugin returns, which happens *after* they are created. But I thought that labels don't update automatically at the moment (even though that'd be very cool, as discussed in a few occasions, e.g. plot titles with datasource names or plot contents changing and axis labels not being updated). What's the actual status wrt automatic label update ?
Comment 7 George Staikos 2006-02-23 15:09:32 UTC
On Wednesday 22 February 2006 02:00, netterfield@astro.utoronto.ca wrote:

> 08:00 ------- I like the suggested solution, but I worry about namespace
> collision. We are essentially introducing the syntax which will eventually
> be used for all 'string' references... options:
> 1) strings and scalars share a name space, so if there is a string called
> [abc], the scalars named [abc] are forbidden. 2) strings and scalars don't
> share, and so need to be reference strings in a different way than we
> reference scalars.  so [abc] vs , eg, [$abc]
>
> I prefer (1), but it will be very hard to enforce, I fear.  (2) will be a
> lot easier implement.


   Strings and scalars presently share a namespace.  Strings are considered 
scalars of letters instead of numbers.  I'm really afraid of allowing too 
much namespace overlap though.  We're much safer using only a couple of 
namespaces so that we avoid ambiguities, especially in equation and label 
parsing.
Comment 8 Netterfield 2006-02-23 15:15:18 UTC
So, we should use [abc] to refer to strings.

In that case, the auto label string produced by a plugin "abc" will be [abc], 
as suggested by Andrew.  Or is there another suggestion?

On February 23, 2006 06:09 am, George Staikos wrote:
>    Strings and scalars presently share a namespace.  Strings are considered
> scalars of letters instead of numbers.  I'm really afraid of allowing too
> much namespace overlap though.  We're much safer using only a couple of
> namespaces so that we avoid ambiguities, especially in equation and label
> parsing.

Comment 9 George Staikos 2006-02-23 15:26:50 UTC
On Thursday 23 February 2006 09:15, netterfield@astro.utoronto.ca wrote:
> 15:15 ------- So, we should use [abc] to refer to strings.
>
> In that case, the auto label string produced by a plugin "abc" will be
> [abc], as suggested by Andrew.  Or is there another suggestion?


  I think that makes sense.  What happens if there is already a string with 
that name?  It's up to the plugin to generate the name anyway...
Comment 10 Nicolas Brisset 2006-02-23 15:56:02 UTC
... and the plugin can't know what strings are already "taken" !
Comment 11 George Staikos 2006-02-23 17:02:45 UTC
On Thursday 23 February 2006 09:56, Nicolas Brisset wrote:
> 15:56 ------- ... and the plugin can't know what strings are already
> "taken" !


  No, it would be done on the Kst side of the plugin, so it can do a lookup 
easily enough.  It may result in some strange string names, that's all.
Comment 12 Andrew Walker 2006-02-28 19:36:21 UTC
Created attachment 14909 [details]
Proposed patch
Comment 13 George Staikos 2006-02-28 23:23:56 UTC
The construction of the label should go into the Fit class.  We don't want to 
lose sync between the two locations where it's constructed, and neither of 
those locations should really need to know about it anyway.  There's another 
issue I see.  What do we do if we have this label?

"Text [myfitlabel] more text"

If I'm not mistaken, it will render "Text" at the top, and "more text" at the 
bottom.  We should define the semantics for inline text blocks that span 
multiple lines first, or we should only accept fitlabels that are exactly 
"[fitlabel]".
Comment 14 George Staikos 2006-02-28 23:54:11 UTC
On Tuesday 28 February 2006 17:45, Barth Netterfield wrote:

> so the fit has a method that returns a QString?  I think that makes sense.
>
> It might even make more sense to have this be a virtual method of
> dataobjects in general, so all data objects (plugins, curves, vectors...)
> can, if they want to, return a label.   The default return string could be
> the tagname, but, eg, eventually (and easily) RVectors could produce
> "FIELD, FILENAME, F0, N" formatted somehow, curves already have the "legend
> label" which this could absorb, etc...


  I was thinking exactly that as well.  RVectors wouldn't get it though, since 
they're primitive objects.  They'll be detected as vectors and their data 
dumped.

> > There's another issue I see.  What do we do if we have this label?
> >
> > "Text [myfitlabel] more text"
>
> Imagine that we are getting the fit label for a n=3 polynomial:
>
> In my optinion, the above example should expand to:
>  "Text x0 = 1.0\nx1 = 2.0\nx3 = 3.0 more text"
> which would render as
>
> Text x0 = 1.0
> x1 = 2.0
> x3 = 3.0 more text
>
> > If I'm not mistaken, it will render "Text" at the top, and "more text" at
> > the bottom.
>
> I think that would cause consistency problems.  I prefer the above
> interpretation.
>
> > We should define the semantics for inline text blocks that
> > span multiple lines first,
>
> I vote for the interpretation I just gave


   That's certainly easiest to render.  Is it really what users will expect?  
I can think of many different looks.  One might be to follow the vertical 
justification parameters.

> > or we should only accept fitlabels that are
> > exactly "[fitlabel]".
>
> ???
>
> I am more concerned about the question of what we do if there is both a
> scalar called [myfitlable] and a fit plugin (or, with the above suggesion,
> a any data object) called [myfitlabel].


  There is that as well.

> -Just give one precedence
> -dataobjects share a namespace with scalars
> -We use a special character for object labels eg [$myfitlabel]
>
> I like #3.


   Right now primitives have precedence.  If we use a special character, we 
have to ban it in tagnames, which could break some kst files.

   #2 could also break existing kst files.
Comment 15 Andrew Walker 2006-03-01 20:07:40 UTC
Created attachment 14919 [details]
Proposed patch

I think this addresses the major concerns, given the conflicting opinions. 

I have not added the virtual label() method as it is not really a necessity for
this bug. If this is something that should be done for other reasons then
another bug report should be entered.
Comment 16 George Staikos 2006-03-01 22:52:48 UTC
On Wednesday 01 March 2006 14:07, Andrew Walker wrote:
> I think this addresses the major concerns, given the conflicting opinions.


   We still need to define what the behavior is for text blocks.  Also there 
is some odd whitespace changing in the parser which should not go in, lots of 
random whitespace addition, unneeded #includes in the renderer, and the 
renderer should use a const QStringList with a const iterator for performance 
reasons.  Also I guess it would be a good idea to make strList and txtAll 
const and initialized directly.  Any slowness in labels has proven to be very 
user-visible.  QMAX should be replaced with kMax for type safety (I fixed the 
other places where it was used).

  Those small things should be very quick and easy to fix, and once we have a 
defined behavior for text blocks, as long as this follows it, it looks good 
to me.
Comment 17 Andrew Walker 2006-03-02 01:13:54 UTC
SVN commit 514942 by arwalker:

BUG:117817 Render text blocks as per Barth's suggestion. Fix indentation in labelparser.cpp

 M  +1 -1      libkstapp/dataref.h  
 M  +9 -26     libkstapp/kstfitdialog_i.cpp  
 M  +19 -0     libkstapp/kstviewlabel.cpp  
 M  +41 -1     libkstapp/labelrenderer.cpp  
 M  +24 -0     libkstmath/kstplugin.cpp  
 M  +2 -1      libkstmath/kstplugin.h  
 M  +4 -4      libkstmath/labelparser.cpp  
Comment 18 George Staikos 2006-03-02 01:22:56 UTC
  So the plan is to just change this again if we decide on rendering blocks 
differently?  I have no plans to make strings render this way until we have a 
solid reasoning and plan behind it.
Comment 19 Andrew Walker 2006-03-02 01:26:08 UTC
Yes. Okay.

-----Original Message-----
From: George Staikos [mailto:staikos@kde.org]
Sent: Wednesday, March 01, 2006 4:23 PM
To: kst@kde.org
Subject: [Kst] [Bug 117817] Only the first parameter is shown in fit
labels


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

http://bugs.kde.org/show_bug.cgi?id=117817




------- Additional Comments From staikos kde org  2006-03-02 01:22 -------
  So the plan is to just change this again if we decide on rendering blocks
differently?  I have no plans to make strings render this way until we have
a
solid reasoning and plan behind it.
_______________________________________________
Kst mailing list
Kst@kde.org
https://mail.kde.org/mailman/listinfo/kst