Skip to content

Plot: Add as an available vector, the row # of the query #820

Closed

Description

@struck89

Details for the issue

I usualy plot x vs y, but what happens when you only want to plot y? Let me put my example:

In this image, I want to see, visually, how the variable "Total Volume" is distributed, Using only what is available:
series
But it would be very useful to also have this:
series2

Which would be solved if this was added:
result

Useful extra information

Most probably there is a SQL command that generates such a column, I idon't know. I still think it would be a neat feature.

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:

Activity

  1. justinclift commented on Oct 13, 2016

    @justinclift
    Member

    Hmmm, this seems like it might be do-able using straight SQL. Probably something like using a temporary table along with an auto-increment key.

    I don't have the time/inclination to try it out personally just yet, but in theory (!) it should work. 😄

  2. MKleusberg commented on Oct 13, 2016

    @MKleusberg
    Member

    There are at least two ways to realise this in SQL:

    1. Create a temporary table like with the results of your select statement. Then plot the data from that table instead of directly plotting the select results.
    CREATE TEMPORARY TABLE tmp AS SELECT total_vol, jname FROM jhem, jdata WHERE jhem.jid=jdata.jid ORDER BY total_vol;
    SELECT rowid,* FROM tmp; -- <- Plot this!
    1. Modify the query to include a row counter. But this makes the query a lot more complicated.
    SELECT (SELECT COUNT(*) FROM jhem x, jdata y WHERE x.jid>a.jid AND x.jid=y.jid ORDER BY y.total_vol) AS rownum, b.total_vol, a.jname FROM jhem a, jdata b WHERE a.jid=b.jid ORDER BY b.total_vol;  -- <- Haven't tested this but you might get the idea.

    Still, I think @struck89's suggestion to have it in the UI makes some sense. None of these approaches is very userfriendly and I am almost certain that I made a mistake or two in the SQL for the second approach.

  3. struck89 commented on Oct 13, 2016

    @struck89
    Author

    @MKleusberg the first one works like charm (still, not user friendly, on excel you can select just a column of data and ask for plotting series).

    The second one adds a row which is probably the original order of the data. The order by clause has to be somewhere else, I guess inside the parenthesis.
    not the same numbers
    Since the row number and the rownum column are not the same, the result is not exactly what I was looking for.

  4. struck89 commented on Oct 19, 2016

    @struck89
    Author

    Holly cow,
    That is already KIND of implemented:
    image
    Ok, this is strange. I read what that thing does and it is doing something unrelated. (bug)
    The interesting thing is that it retrieved a set of columns (that DO NOT appear on the results tab) from what looks like a previous query.
    The query I was working on has nothing to do with that set of rows and columns, but clicking on that it added the rowid
    If I go back to sql, ask for anything else, and click that gear sign again, it happens again, retrieves that magical data from IDontKnowWhere, with my beloved rowid column

  5. MKleusberg commented on Nov 4, 2016

    @MKleusberg
    Member

    @struck89 Sorry for the delay but I believe this is fixed now 😃

    The gear button you discovered was actually buggy. It is supposed to load all data (for large datasets only a part is loaded, so there would be data missing in the plot) but it did this only for the Browse Data tab. When there was a plot based on a manual SQL query like you had it would load the data from the Browse Data tab and show that. This data included the rowid but was not connected to your query in any way. This is fixed now: the gear button should always load the correct data now.

    I've also added a 'Row #' column to the column selection view. In simple cases this is the same as the rowid but is way more reliable for what you want 😃

    Do you have the time to give tomorrow's nightly build a quick test and report back if it's working for you? 😃

  6. struck89 commented on Nov 5, 2016

    @struck89
    Author

    @MKleusberg Hey! no need to ask for pardon!! ;)

    So, if you tell me the nightly you mention is here:
    https://nightlies.sqlitebrowser.org/win64/
    Yes, I'll give it a try.

    Sadly though, I am using the DB Browser since I started around August to focus more on organizing the data I was generating for a project and analyzing it. This has been a temporary position and I will be unemployed at the end of November. I am sure I will be around sqlite db browser (I have read so many names, that I don't really know which is the last acronym you use 😆 ) in the near future...

    I am sure this will be a great addition for more people to come!!

  7. struck89 commented on Nov 14, 2016

    @struck89
    Author

    @MKleusberg
    Since you didn't confirm that, I completely forgot to check again. Today I needed it, and tried on the nightlies how it works.
    It is just what I asked, I think this thread can be closed!

    I hope other people find it useful as well!!
    Thanks, thanks!!

  8. MKleusberg commented on Dec 19, 2016

    @MKleusberg
    Member

    @struck89 Sorry to hear that you're unemployed now 😿 But thank you so much for opening all those issues concerning the plot feature 👍 We'll try our best to implement those features one by one in the near-ish future.

    Also thank you for testing the nightly build and confirming that it's working now 😃 I'll close this issue then.

  9. MKleusberg commented on Dec 19, 2016

    @MKleusberg
    Member

    By the way, out of curiosity: what sort of data were you working on there? I was wondering, especially when seeing the loop in the 'order by' issue 😃

  10. struck89 commented on Dec 20, 2016

    @struck89
    Author

    Hey @MKleusberg !
    I have to say that I found other issues with that nighlty build. For example that between queries that had as an output the same columns, it did not remember the ones that were being plotted.
    Before I had column1 as X and column2 as Y and after running a new query the graph got updated. With the nightly I had to select the columns to be plotted again.
    Also I remember (it's been a month without playing with it), a significant decrease in performance when selecting the columns to plot. I don't know if that was a consequence of the feature I wished it had, or by some other addition..

    And those where PV loops. Pressure-Volume loops of the left ventricle of a simulation of a human heart!
    90% of what I was plotting were Pressure vs Time or Pressure vs Volume of all different heart chambers; the most iconic being the left ventricle.

    Best regards and merry xmas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions