Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change axis limits #838

Closed
4 of 13 tasks
struck89 opened this issue Oct 18, 2016 · 20 comments
Closed
4 of 13 tasks

Change axis limits #838

struck89 opened this issue Oct 18, 2016 · 20 comments
Assignees
Labels
enhancement Feature requests.

Comments

@struck89
Copy link

struck89 commented Oct 18, 2016

Details for the issue

Axis? Axes?

Well, my point is, it would be awesome to be able to change the limits of the axis window.
Right now it uses the current max/min for X and Ys, which is a little bit inconvenient. (Remember I can´t plot lines? So dots get cut in half)

Also, by adding that we would have a "zooming" tool. (I think this feature seems very easy to implement, whereas a true zooming thing seems much more complicated)

e.g. When I plot this:
axis limits

I would rather be able to chose to have something like this:
image

Or in this occasion:
axis limits 2
Where do all the corners (upper left side) that follow a straight line go down to? If I was able to chose "show me X from 0 to 200", I wouldn't be forced to go to EXCEL

Useful extra information

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.9.1
  • 3.9.0
  • Other: ___

I have also:

@justinclift justinclift added the enhancement Feature requests. label Oct 18, 2016
@justinclift
Copy link
Member

Yep, sounds useful. 😄

@mgrojo mgrojo self-assigned this Dec 2, 2017
mgrojo added a commit that referenced this issue Dec 2, 2017
The rectangle selection is no longer possible. Control+click can be used
for selecting a range of items.

This allows more freedom for performing customisations as requested in
issue "Change axis limits #838".

The "Load all data" button tool-tip and icon have been readjusted so they
hint the additional use pattern of resetting the plot to the original
zoom and range limits.

New and more appropriate icon for the "Save Plot" button. Icon from the
Silk set from famfamfam.com.
@mgrojo
Copy link
Member

mgrojo commented Dec 2, 2017

@struck89 I've enabled some user interactions in the plot that might allow you to adjust the plot to your needs. Letting the user set explicitly the axis limits would also make sense, but this was actually easy to implement and, in my opinion, improves the situation a lot. If you are still using the application, could you try it in the next nightly build and give some feedback?

@justinclift
Copy link
Member

@struck89 ping? 😄

@struck89
Copy link
Author

struck89 commented Dec 6, 2017

Hi!
I have been waiting to find a moment to test it (I am currently on vacation)
And as I said some months ago, I stopped being part of the project where I was using sqlitebrowser. Still I will give it a try. In a week!
(I had the message starred in my inbox btw)
Regards!

@justinclift
Copy link
Member

Thanks @struck89. 😄

@struck89
Copy link
Author

struck89 commented Dec 11, 2017

Hey, the drag and drop, and the zooming are great. Is there any way to change the aspect ratio?

Sadly I have to say I managed to break the thing at my first attempt.

Problem? When executing an statement like:
"select foo from table1", plotting, and then "select foo,bar from table1" breaks the thing.

I uploaded a video. The link will expire soon:
s.amsu.ng/pgWoJxEEuPYN

Another observation, the number of elements plotted are limited to 50.000. If the number of results coming from the query is greater, and not everything is plotted (for performance reasons I assume), I think you should say it. "WARNING, too many rows, only plotting first 50K" or something. This is very important!! otherwise there is missing data in the plot!

Best regards,

EDIT: I can answer my "aspect ratio" question. I saw the answer in:
#1258

EDIT2: Another problem, sometimes I don't get the results to be plotted. I can't see a trend of what is causing it. Sometimes it depended on increasing or not the limit of results, sometimes on using or not the keyword sort by.
I am not sure what is happening.
I just recorded two more videos, which will expire soon:
s.amsu.ng/VKftr1sfYrqN
s.amsu.ng/ryDyR4Q4wSDN
Good luck!

@mgrojo
Copy link
Member

mgrojo commented Dec 11, 2017

I think you're seeing the same crash as described in #1262.

The limit of 50K rows that you are seeing is the prefetch block size that you can set in the Preferences. There is also a button in the Plot Dock for loading all the data. I agree that some kind of feedback should be given, or assume that the prefecht works well for browsing, but not for plotting, and consequently try to plot everything... I don't know. Maybe @MKleusberg can help with that.

@struck89
Copy link
Author

There is also a button in the Plot Dock for loading all the data.

Great, thanks!
(then, a warning when plotting if not all data is there would be nice, because you might miss something important (instead of checking the number of returned rows in the query results table) (and even more if most of the times results are sorted..))

@justinclift
Copy link
Member

justinclift commented Dec 12, 2017

Yeah, some kind of visual warning thing - but not like a popup the user needs to interact with - to remind or alert the user that not all of the data available in the table is being plotted. I get a feeling though this could be tricky. On the other hand, it would only be needed for the situation where the data-loading-chunk-limit thing is being used yeah?

The other plot situations, such as plotting the results from a query or similar wouldn't have that limit.

Anyone have ideas? 😄

@mgrojo
Copy link
Member

mgrojo commented Dec 12, 2017

What if we enable the "Load all data and redraw plot" button only when there is data not loaded yet due to the prefetch mechanism, or when the user has zoomed or dragged the plot? In the first case we could also set a red background to the button and set a warning in the button tooltip, so it is more visible and self-explanatory.

@justinclift
Copy link
Member

That sounds like a decent idea. 😄 What do you reckon @struck89?

mgrojo added a commit that referenced this issue Dec 13, 2017
Warn user if not all data has been fetched and hint about the button for
loading all the data. The attention to this button is attracted changing
its background to a reddish colour and showing a warning in its tool-tip,
which is automatically shown for its default duration.

Default message is simplified and the button is only enabled when it is
useful (users of non-big databases would never be distracted about the
fetching mechanism).

Since this button is also useful for resetting the zoom and axis range,
it is also enabled if the user performs one of these interactions over the
plot.

See discussion at issue #838.
@mgrojo
Copy link
Member

mgrojo commented Dec 13, 2017

@struck89 I've implemented the visual warning so you can see it in action and give some feedback.

@struck89
Copy link
Author

struck89 commented Dec 14, 2017

Hi @mgrojo,
You make me feel important, like my opinion counts 😄
Sadly I have to say it is not working for me. It just breaks when selecting the column. At the beginning I thought it might be because of the language, so I switched to English US (default).
s.amsu.ng/rl97voXwsorN
Most simple query ever.
Now I need a previous version to work 😆 (yes, I came back to use sqlitebrowser in my new job)
(edit: Yep, a previous version works fine)

Thanks for your efforts!

EDIT, about the zooming:
I am plotting currently like 2M points. I understand that the graphing area does not plot EVERYTHING, but on a relatively low dense region some dots appear and disappear:
https://we.tl/PzuPYw55Co

Also, is there any way to get the row/rowid of a selected dot?
Thanks again

mgrojo added a commit that referenced this issue Dec 14, 2017
This crash was introduced in 6d3228a. It
happened when no previous settings were saved for the plot.

Additionally the plot interaction are set once for the plot widget.

This was reported at issue #838.
@mgrojo
Copy link
Member

mgrojo commented Dec 14, 2017

Hi @struck89,
Everyone is important 😃

Thanks for reporting the crash, I had tested only with a project with settings saved for the table. With
a query I reproduced it immediately. Thanks for reporting. It should be fixed now.

That issue with the zoom is very strange. Does it happen also when one of the axis is selected? It is probably a precision calculation error in qcustomplot.

For getting the rowid of a selected dot, right-click first on the table header and click on "Show rowid column".

@struck89
Copy link
Author

Good morning to everybody and happy friday!
@mgrojo That red warning is great. There is a very very small error though, the tooltip square ends like this:
image

Once clicked it gets grayed out and back to normality. (but when we zoom: https://we.tl/ss2taw7Lqs) (maybe this is expected behaviour, to fix axis limits)

About the sparkling dots, it does still happen with one axis selected. (I just discovered, not only the zoom gets restricted to the axis but also the drag and drop. Love it!)

And about the rowid for a dot, I right-clicked everywhere (both table header in the plot or in the results, and everywhere else) and I can't see the "show rowid column". The only menu I get is "Copy" on the graph.

Thanks!

mgrojo added a commit that referenced this issue Dec 15, 2017
Avoid inheriting the style sheet in child widgets by naming the widget
type where it is set.

This had the effect, reported in issue #838, of setting an unwanted style
in child widgets, like the tool-tip of the "Load all data" button, the
tool-tip of the SQL results pane or the context menu of the search-bar
edit line.
mgrojo added a commit that referenced this issue Dec 15, 2017
Let's see if this fixes the problem about disappearing points while
zooming reported at issue #838.
@mgrojo
Copy link
Member

mgrojo commented Dec 15, 2017

Hi @struck89. The issue with the tool-tip should be fixed with the last commit.

I've updated the plot library to version 2.0.0 from 2.0.0-beta. Let's see if this fixes the problem about disappearing points while zooming. Otherwise, I don't though how to solve it, sorry.

The "show rowid column" option is in the context menu of the table in Data Browser tab. If you are trying with query results, it will not work. In that case you should be able to add the rowid to your query. Does this helps?

@mgrojo
Copy link
Member

mgrojo commented Dec 15, 2017

@struck89 I forgot to mention that the behaviour of the button after zooming is intended. It's the way to reset the plot to the initial zoom and axis ranges. Otherwise a different button would be needed. I don't think it is worthy of the space it would need.

@struck89
Copy link
Author

struck89 commented Jan 4, 2018

Hey @mgrojo!
I haven't tested yet enough to see again the disappearing points.

But regarding this:

The "show rowid column" option is in the context menu of the table in Data Browser tab. If you are trying with query results, it will not work. In that case you should be able to add the rowid to your query. Does this helps?

I managed to find what you mentioned, and I found out it automatically selects (theoretically) the row of the dot.
Unfortunately there is a conceptual error, that I pointed out on this issue:
#821

To sum up again, plotting does not respect the order of the results, it rearranges the results, again, by the x value. So if the x value is not ordered, this results in a completely undesired effect, the selected row has nothing to do with the actual selected dot:
https://we.tl/neR2kMOQke

EDIT, following issue #821, at the end, @MKleusberg refers to Qcustomplot documentation, so this means this is not something straightforward.

Graphs are used to display single-valued data. Single-valued means that there should only be one data point per unique key coordinate. In other words, the graph can't have loops. If you do want to plot non-single-valued curves, rather use the QCPCurve plottable.

Source: http://www.qcustomplot.com/documentation/classQCPGraph.html#details

QCPCurve:
http://www.qcustomplot.com/documentation/classQCPCurve.html#details

I did not expect this to be such a major design restriction.

But given the previous quoted text, I don't understand why I can have multiple Ys per X (vertical lines)

And last thought: The missing points might be because of AdaptiveSampling in QCP

@mgrojo
Copy link
Member

mgrojo commented Jan 4, 2018

Oh, that is very unfortunate. Ideally the problem of the reordering should be fixed with QCPCurve and then the selection problem would be easy to solved, but as you have already pointed, that is not straightforward. And we would lose the line style options and don't know if something more.

But the selection problem is more serious and I'd like to solve it without changing the plot implementation, which I don't dare to change. But the only solution that I come to is forcing the order in the table by x when a point is selected, and then selecting the correct row.

mgrojo added a commit that referenced this issue Jan 7, 2018
The tables/queries sorted by X are drawn using QCPGraph as before.

Since QCPGraph does automatically sort by X, we change to QCPCurve that
requires a third data vector to reflect the order. We get that from the
current row order.

In the case of curves, only None and Line is supported as line style.

Since the order is now important for the plot, it is automatically updated
whenever the user sorts by another column in the browsed table.

This addresses issue #821 and indirectly fixes the problem of incorrect
point->row selection link when the table is not sorted by X, reported in
issue #838.
@mgrojo
Copy link
Member

mgrojo commented May 1, 2018

I'll close this issue after the changes implemented in #1258 and #821. The only possible problem still to be addressed is the "disappearing dots". It seems a problem with QCustomPlot, although if it is still happening, you might open a new issue for tracking it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests.
Projects
None yet
Development

No branches or pull requests

3 participants