Skip to content

Colors in the graphing area #816

Open

Description

@struck89

Details for the issue

First of all, I want to apologize if I am doing anything wrong. This is my FIRST ever ticket on Github.

When I select one column for x axis, and start selecting columns for the y axis, the automatic chosen colors seem to appear at total randomness:
order of colors

I selected them in order, one after the other with no other actions in between. This is constantly happening. I think a predefined set of colors should be used, and colors with easy differentiation. Like excel does, it starts with blue, goes to red, and so on. Always.

Next thing about the colors. Please, remove the yellow from the automatically selected colors:
yellow
here it is "easy" to see because there's a lot of fluctuation, but take a look at the beginning of the graph, there's no contrast with yellow on white.

Thanks for your attention. I would gladly collaborate into fixing this, but I lack the knowledge on how to do it.

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: 7 Enterprise)
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.9.1
  • 3.9.0
  • Other: ___

I have also:

Activity

  1. chrisjlocke commented on Oct 10, 2016

    @chrisjlocke
    Member

    If you double click on the coloured bar in the Y column, a colour picker should appear allowing you to pick an alternative colour.

    Oh, and no, if you save the database as a project, the plot colours aren't saved, so if you do spend an hour picking lovely colours, they'll be lost when you close the database. So don't ever close the database. Ever.

    Oh, and welcome to GitHub / DB Browser for SQLite, etc. Your first ticket was a great one! Welcome to the group!

  2. struck89 commented on Oct 10, 2016

    @struck89
    Author

    Thanks for the warm welcome Chris :)

    I am aware that I can change the colors (is the first thing I do when the program chooses yellow!).
    For the kind of purpose I am using it, I don't save projects. But for your comment it looks like it would help me not to lose my SQL queries, since until now what I do is save a couple of "key" queries, and load and modify them every time. I had no idea that feature existed. Thanks for the info!

    I would love to participate in improving the graphing capabilities, since I already have several things in mind that would ease out a lot my workflow. But I don't want to stress the team with tickets.

  3. justinclift commented on Oct 10, 2016

    @justinclift
    Member

    Interesting. Trying out the plot stuff now (it's not something I've used much personally) looks useful. The filters in the Browse Data table affect it too, which is good for displaying specific things.

    At the very least, we should save the plot colours into project files, and restore them when loaded.

    Trying to think how best to solve the "default colours" problem though. Maybe we need to add yet another set of Preferences 😉, this time holding the default colours to be used for the y column. Something like:

    • Row 1 = blue
    • Row 2 = red
    • Row 3 = magenta
    • ... (for say, 16 rows)

    I think this would achieve the general goal, and if combined with saving colours in project files, would let people override things for specific databases too.

    Thoughts? 😄

  4. revolter commented on Oct 10, 2016

    @revolter
    Member

    Hmmm, I fear having colors preferences is a bit of an overkill. We could create a constant common sense palette of colors and use those, and save the user's overwrites in the project file.

    We can also generate them using HSL instead of RGB, by changing only the hue while maintaining a constant saturation and lightness like this answer.

  5. justinclift commented on Oct 10, 2016

    @justinclift
    Member

    @revolter Sounds workable to me. Want to get it done? 😄

  6. revolter commented on Oct 10, 2016

    @revolter
    Member

    I could try, sure 😄

  7. self-assigned this
    on Oct 10, 2016
  8. justinclift commented on Oct 10, 2016

    @justinclift
    Member

    Should this be a #hacktoberfest thing?

  9. struck89 commented on Oct 10, 2016

    @struck89
    Author

    I think I found the "line":
    https://github.com/sqlitebrowser/sqlitebrowser/blob/master/src/MainWindow.cpp#L1984

    
                // get a default color
                QColor curbkcolor = changeitem->backgroundColor(column);
                QColor color = !curbkcolor.isValid() ? (Qt::GlobalColor)(qrand() % 13 + 5) : curbkcolor;
    
    

    Wow, you are all going fast!

  10. justinclift commented on Oct 10, 2016

    @justinclift
    Member

    @struck89 The speed stuff gets done at can be fairly arbitrary. If something looks interesting to muck around with, the chances of it getting done sooner are much higher than stuff that seems super boring. 😉

  11. MKleusberg commented on Oct 12, 2016

    @MKleusberg
    Member

    @struck89 First of all a warm welcome to Github from my side as well 😃 Thanks for opening this issue!

    I've just opened a pull request (#819) with which the plot information will be stored internally. This will have two effects:

    1. When configuring a plot, changing the current table, and then coming back to the first table you'll see your plot again with all the colours you have defined.
    2. And (hopefully) all the plot information will be stored in the project files. You will still get yellow plots from time to time but at least your personal colour settings can be stored this way. And as far as I understand, Iulian is working on a better colour selection algorithm, too.

    Also, feel free to open as many issues as you like, no matter whether plotting related or not. Maybe not every issue will get as much attention as this one - we're all having our private lifes - but it's good to know what we can do to improve DB4S even further 😃

  12. justinclift commented on Oct 12, 2016

    @justinclift
    Member

    @MKleusberg Any idea how easy/difficult it would be to have some kind of image export for the plot area? eg "Save to PNG" (or maybe something scalable like SVG?)

  13. MKleusberg commented on Oct 12, 2016

    @MKleusberg
    Member

    There already is 😉
    spectacle ra7843

  14. 3 remaining items

  15. revolter commented on Oct 13, 2016

    @revolter
    Member

    @struck89 and others, what do you say about this:

    screen shot 2016-10-13 at 03 05 40

    ?

  16. struck89 commented on Oct 13, 2016

    @struck89
    Author

    Hi @revolter,
    well, I don't want to sound rude or ungrateful, but I am sure we can come up with a sequence of colors that is better distinguishable from one another. One question is, in which order did you pick pick columns? The first three are very similar, and going to the center, the difference between alternate colors is still very similar.

    Let's face one thing, usually you will just need to plot two, three, four lines, so for me, apart from allowing that functionality, which from your message I understand that you have already done so 👍 , what is left is choosing these easily distinguishable colors. I am going to throw this out there, as a suggestion of a palette that gets the work done:
    suggerence

    I would personally increase the saturation of excel's (except for yellow, damn YELLOW!)

    What do you think?

  17. revolter commented on Oct 13, 2016

    @revolter
    Member

    Well, it was 3AM when I did that. I was hoping of achieving these colors programmatically, but sadly, I didn't get it right, as you noticed. I'll try to fiddle with it and see if I get it right. The advantage of this method is that the colors are the same every time for a given table (actually, for a number of rows).

  18. justinclift commented on Oct 13, 2016

    @justinclift
    Member

    @revolter Maybe look for an algorithm which determines "colour distance"? eg how much difference there is between two given colours

    Then use your first piece of code from above to generate an initial colour list, + use a "colour distance" algorithm to make sure similar values aren't grouped near each other?

  19. revolter commented on Oct 13, 2016

    @revolter
    Member

    I tried using the algorithm from this article too but there are some 2 similar colors pairs.

  20. justinclift commented on Oct 13, 2016

    @justinclift
    Member

    No worries. If all else fails we can just pick a suitable (say) 20 values and hard code them. 😉

  21. struck89 commented on Oct 13, 2016

    @struck89
    Author

    @revolter The last approach (golden ratio one) from the article you linked, really seems to work! right? Is that the code you used? If so maybe you where very unlucky with the randomness?

  22. MKleusberg commented on Oct 14, 2016

    @MKleusberg
    Member

    @struck89 Just merged that PR. So if you're using the project files or plan to do so, with tomorrow's nightly build the plot settings (including the colours!) will be saved in the project file.

  23. revolter commented on Oct 25, 2016

    @revolter
    Member

    Well, I couldn't get it well by generating the colors programmatically :( I wanted for them to be generated based on the number of columns. So, for a table with say 10 columns, they would get the same color every time, not completely random.

  24. justinclift commented on Oct 25, 2016

    @justinclift
    Member

    If you set the same seed value every time, wouldn't the randomness disappear?

  25. revolter commented on Oct 25, 2016

    @revolter
    Member

    Didn't thought about that :-?

  26. justinclift commented on Oct 25, 2016

    @justinclift
    Member

    😉

  27. MKleusberg commented on Jan 3, 2017

    @MKleusberg
    Member

    I've just pushed a commit which adds a static colour table of 12 colours (taken from the LibreOffice chart colours). Until we come up with a working algorithm this hopefully improves the situation a bit :)

  28. justinclift commented on Jan 3, 2017

    @justinclift
    Member

    As a data point for choosing colours, this site might be useful:

        http://colorbrewer2.org

    Their GitHub repo:

        https://github.com/axismaps/colorbrewer/

    The "downloads" link there has a list with 165 palettes. If desired, we could get pretty fancy with things. 😀

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions