Bug 403561 - plot from mathematical equation does not update when doing a 'Recalculate'
Summary: plot from mathematical equation does not update when doing a 'Recalculate'
Status: RESOLVED FIXED
Alias: None
Product: LabPlot2
Classification: Applications
Component: frontend (show other bugs)
Version: latest
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Semke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-24 16:10 UTC by Michi
Modified: 2019-02-15 13:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.6


Attachments
video capture (1.50 MB, application/x-7z-compressed)
2019-02-05 11:20 UTC, Michi
Details
test file (38.36 KB, application/gzip)
2019-02-11 08:23 UTC, Michi
Details
this is not working on my linux box (1.88 KB, application/x-labplot2)
2019-02-12 19:41 UTC, Michi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michi 2019-01-24 16:10:29 UTC
the first time you create a plot from a mathematical equation everything works fine. But as soon as you change something in the equation and press recalculate nothing happens.
Comment 1 Alexander Semke 2019-01-25 07:32:57 UTC
I cannot reproduce this on the current master. Which equation and which ranges are you using?
Comment 2 Michi 2019-02-02 07:47:06 UTC
I tried on 2 machines with a couple of sine functions from 0..2pi. same problem on both systems.
Comment 3 Alexander Semke 2019-02-03 09:14:42 UTC
(In reply to Michi from comment #2)
> I tried on 2 machines with a couple of sine functions from 0..2pi. same
> problem on both systems.
Which version of LabPlot are you using? Can you please upload a small video reproducing the problem?
Comment 4 Michi 2019-02-05 11:20:27 UTC
Created attachment 117839 [details]
video capture
Comment 5 Alexander Semke 2019-02-05 13:46:51 UTC
(In reply to Michi from comment #4)
> Created attachment 117839 [details]
> video capture
Ok. This is on windows... There were some problems which were fixed couple of months ago. Can you please try the last available release candidate for 2.6 under https://theorie.physik.uni-konstanz.de/gerlach/labplot/labplot-2.6.0rc13-64bit-setup.exe ? Do you still have this issue with this build?
Comment 6 Michi 2019-02-07 17:18:00 UTC
Hi Alex,

this build crashes when creating an xy plot:

1   XYCurvePrivate::recalcLogicalPoints()                                                 0x4f7722   
2   XYCurveSetXColumnCmd::finalize()                                                      0xa7b97a   
3   AbstractAspect::exec(QUndoCommand *)                                                  0x426e19   
4   XYCurve::setXColumn(AbstractColumn const *)                                           0x4f5d80   
5   XYEquationCurve::init()                                                               0x5019d5   
6   XYEquationCurve::XYEquationCurve(QString const&)                                      0x502672   
7   CartesianPlot::load(XmlStreamReader *, bool)                                          0x4c2652   
8   Worksheet::load(XmlStreamReader *, bool)                                              0x494aa9   
9   Folder::readChildAspectElement(XmlStreamReader *, bool)                               0x425464   
10  Project::load(XmlStreamReader *, bool)                                                0x436e9f   
11  Project::load(QString const&, bool)                                                   0x43362d   
12  MainWin::openProject(QString const&)                                                  0x40a858   
13  MainWin::openRecentProject(QUrl const&)                                               0x40aa3e   
14  MainWin::qt_static_metacall(QObject *, QMetaObject::Call, int, void * *)              0x5d7729   
15  QMetaObject::activate(QObject *, int, int, void * *)                                  0x68a62174 
16  KRecentFilesAction::qt_static_metacall(QObject *, QMetaObject::Call, int, void * *)   0x6a91f875 
17  QMetaObject::activate(QObject *, int, int, void * *)                                  0x68a62174 
18  KSelectAction::actionTriggered(QAction *)                                             0x701bd1a9 
19  QMetaObject::activate(QObject *, int, int, void * *)                                  0x68a622fb 
20  QActionGroup::hovered(QAction *)                                                      0x1804ce2  
... <More>
Comment 7 Michi 2019-02-07 20:02:35 UTC
just verified that it also happens on my linux computer where I follow the git master.
Comment 8 Alexander Semke 2019-02-09 09:46:57 UTC
(In reply to Michi from comment #7)
> just verified that it also happens on my linux computer where I follow the
> git master.
the crash happens if you load a saved project. This is another problem. I cannot reproduce this, neither. Can you please send me your project you're testing with?

As to the original problem, do you still have that problem with the curve being not recalculated on that windows build or on the current master on linux? So, if you create a new project and produce such an equation curve, do you still have this problem with the current code?
Comment 9 Michi 2019-02-11 08:23:20 UTC
Created attachment 117978 [details]
test file
Comment 10 Michi 2019-02-11 08:25:30 UTC
(In reply to Alexander Semke from comment #8)
> (In reply to Michi from comment #7)
> > just verified that it also happens on my linux computer where I follow the
> > git master.
> the crash happens if you load a saved project. This is another problem. I
> cannot reproduce this, neither. Can you please send me your project you're
> testing with?
it also crashes as soon as you try to create an xy-plot
> 
> As to the original problem, do you still have that problem with the curve
> being not recalculated on that windows build or on the current master on
> linux? So, if you create a new project and produce such an equation curve,
> do you still have this problem with the current code?

I do.
Comment 11 Alexander Semke 2019-02-11 21:32:59 UTC
There are three different problems here:
1. the curve is not updated after "recalculate"
2. crash in XYCurvePrivate::recalcLogicalPoints() when loading the saved project you attached
3. crash when creating a new xy-plot

Thank you for reporting these problems. On windows I can only reproduce the third problem. On linux none of them. In case you also have these issues on linux, can you please compile the debug build (simply execute ./compile_debug) and paste here the crash call-stack.
Comment 12 Michi 2019-02-12 19:39:50 UTC
Comment on attachment 117978 [details]
test file

this was the wrong file
Comment 13 Michi 2019-02-12 19:41:33 UTC
Created attachment 118014 [details]
this is not working on my linux box

after some time of changing settings of the xy-plots the recalculate button stopped working (on linux)
Comment 14 Michi 2019-02-12 19:42:58 UTC
(In reply to Alexander Semke from comment #11)
> There are three different problems here:
> 1. the curve is not updated after "recalculate"
> 2. crash in XYCurvePrivate::recalcLogicalPoints() when loading the saved
> project you attached
> 3. crash when creating a new xy-plot
> 
> Thank you for reporting these problems. On windows I can only reproduce the
> third problem. On linux none of them. In case you also have these issues on
> linux, can you please compile the debug build (simply execute
> ./compile_debug) and paste here the crash call-stack.

on linux there is no crash. as for 1. & 2. it was simply the wrong file :(
Comment 15 Michi 2019-02-12 19:48:06 UTC
(In reply to Michi from comment #13)
> Created attachment 118014 [details]
> this is not working on my linux box
> 
> after some time of changing settings of the xy-plots the recalculate button
> stopped working (on linux)

e.g. changing x,max of the 3rd plot
Comment 16 Stefan Gerlach 2019-02-12 22:42:42 UTC
I can comment on the recalculate problem. Your formula contains "4/3" or "1/3" which is one or zero, respectively. Can you try it again with "1./3" and "4./3"?
Comment 17 Alexander Semke 2019-02-13 10:39:02 UTC
(In reply to Stefan Gerlach from comment #16)
> I can comment on the recalculate problem. Your formula contains "4/3" or
> "1/3" which is one or zero, respectively. Can you try it again with "1./3"
> and "4./3"?
The problem is here because of the logic in our CartesianPlot::scale*() function were we only retransform/repaint the curves if the plot ranges have changed. In Michi's example project, when changing x_max from 4 to e.g. 6, we recalculate the points but we don't repaint the curve because the the plot ranges didn't change. If you change x_max for example from 4 to 11, the curve is correctly repainted. We don't have this problem if we only have one single curve - here we basically always have range changes and the current logic in the code works perfectly.

We also have this problem for data coming from spreadsheets - we don't properly update the curve, if the ranges are not changed on cell changes in the spreadsheet... I'll fix this.
Comment 18 Stefan Gerlach 2019-02-13 20:43:52 UTC
I have to correct myself. "1/3" and "4/3" is correctly parsed as expected.
I can also reproduced the update problem with a single when the plot range does not change.
Comment 19 Alexander Semke 2019-02-13 20:59:15 UTC
Git commit df20dd593412f08db72a6e44c3212973af56f346 by Alexander Semke.
Committed on 13/02/2019 at 20:58.
Pushed by asemke into branch 'master'.

Update curves on data changes even if those changes doesn't change the plot ranges.
FIXED-IN: 2.6

M  +45   -13   src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
M  +3    -3    src/backend/worksheet/plots/cartesian/CartesianPlot.h

https://commits.kde.org/labplot/df20dd593412f08db72a6e44c3212973af56f346
Comment 20 Alexander Semke 2019-02-13 21:02:28 UTC
(In reply to Michi from comment #14)
> (In reply to Alexander Semke from comment #11)
> > There are three different problems here:
> > 1. the curve is not updated after "recalculate"
> > 2. crash in XYCurvePrivate::recalcLogicalPoints() when loading the saved
> > project you attached
> > 3. crash when creating a new xy-plot
> > 
> > Thank you for reporting these problems. On windows I can only reproduce the
> > third problem. On linux none of them. In case you also have these issues on
> > linux, can you please compile the debug build (simply execute
> > ./compile_debug) and paste here the crash call-stack.
> 
> on linux there is no crash. as for 1. & 2. it was simply the wrong file :(

I just did a fix for the problem with the curve updates. Can you please pull the current code and try again?

As for other issues, the crash on windows when creating a new xy-plot is reproducible. Something is broken in the build. We'll check this. For the crash in XYCurvePrivate::recalcLogicalPoint(), can you please send me that project file leading to the crash? Independent on how wrong that file is, we shouldn't crash...
Comment 21 Michi 2019-02-13 21:07:54 UTC
(In reply to Alexander Semke from comment #20)
> (In reply to Michi from comment #14)
> > (In reply to Alexander Semke from comment #11)
> > > There are three different problems here:
> > > 1. the curve is not updated after "recalculate"
> > > 2. crash in XYCurvePrivate::recalcLogicalPoints() when loading the saved
> > > project you attached
> > > 3. crash when creating a new xy-plot
> > > 
> > > Thank you for reporting these problems. On windows I can only reproduce the
> > > third problem. On linux none of them. In case you also have these issues on
> > > linux, can you please compile the debug build (simply execute
> > > ./compile_debug) and paste here the crash call-stack.
> > 
> > on linux there is no crash. as for 1. & 2. it was simply the wrong file :(
> 
> I just did a fix for the problem with the curve updates. Can you please pull
> the current code and try again?

OBS is currently doing a build.

> 
> As for other issues, the crash on windows when creating a new xy-plot is
> reproducible. Something is broken in the build. We'll check this. For the
> crash in XYCurvePrivate::recalcLogicalPoint(), can you please send me that
> project file leading to the crash? Independent on how wrong that file is, we
> shouldn't crash...

you don't actually need a file. just try to create a fresh new plot and that's it.

and thanks so far for the quick resolution
Comment 22 Alexander Semke 2019-02-13 21:29:49 UTC
(In reply to Michi from comment #21)
> > 
> > As for other issues, the crash on windows when creating a new xy-plot is
> > reproducible. Something is broken in the build. We'll check this. For the
> > crash in XYCurvePrivate::recalcLogicalPoint(), can you please send me that
> > project file leading to the crash? Independent on how wrong that file is, we
> > shouldn't crash...
> 
> you don't actually need a file. just try to create a fresh new plot and
> that's it.
The problem with the creation of a new plot on windows is reproducible. The other problem with the call stack you pasted in comment #6 here was caused by loading a saved project. This is not the call stack we have if we create a new plot. I'd like to reproduce and to fix that second problem - load the project file and crash in XYCurvePrivate::recalcLogicalPoints(). Do you have this problem still reproducible?


> and thanks so far for the quick resolution
thanks a lot for reporting this problem and for helping out with testing and validation!
Comment 23 Stefan Gerlach 2019-02-13 22:14:18 UTC
I can not reproduce the crash with the latest code on Windows. Here is an up to date package:
https://theorie.physik.uni-konstanz.de/gerlach/labplot/labplot-2.6.0rc14-64bit-setup.exe

Can you try this new package?
Comment 24 Michi 2019-02-14 15:28:12 UTC
(In reply to Stefan Gerlach from comment #23)
> I can not reproduce the crash with the latest code on Windows. Here is an up
> to date package:
> https://theorie.physik.uni-konstanz.de/gerlach/labplot/labplot-2.6.0rc14-
> 64bit-setup.exe
> 
> Can you try this new package?

this one doesn't crash, but it seems it doesn't have the fix yet.
Comment 25 Michi 2019-02-14 19:13:33 UTC
I can confirm that it's working on my linux box
Comment 26 Stefan Gerlach 2019-02-14 21:23:13 UTC
here is the latest package including the current code:
https://theorie.physik.uni-konstanz.de/gerlach/labplot/labplot-2.6.0rc15-64bit-setup.exe
Comment 27 Michi 2019-02-15 13:15:06 UTC
(In reply to Stefan Gerlach from comment #26)
> here is the latest package including the current code:
> https://theorie.physik.uni-konstanz.de/gerlach/labplot/labplot-2.6.0rc15-
> 64bit-setup.exe

and this one works as well now.