-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Bar charts and Axis Type column in Plot Dock #1302
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
Conversation
String type columns are now selectable as X axis. In that case a bar chart is plotted where the column values are used as bar labels. A new Axis Type column is added to the axis selection table, so the user knows before-hand how the plot will be drawn. Line type and point shape combo-boxes are not enabled for bar charts, since they don't make sense. Columns that make no sense for the Y axis as strings and date/times are not selectable for that axis.
…s This Now that we have a proper type column in the plot selection widget, the internal type storing can be simplified. If the plot has more than one Y selections for one X of label type (bar charts) the first bar is opaque, but the additional are translucent in order to be seen, since they will overlap. What's This information added to explain all the possible selections for plotting.
Definitely. Co-incidentally, I've been looking at doing some chart building stuff recently too (mainly box plots though), as a way to get myself back into the dbhub.io coding. Not using Qt for it, as the Go libraries for Qt just aren't complete enough yet for my purposes. |
Just created 32 and 64 bit windows builds of this, for anyone wanting to test it: |
Hello everyone, Just tested this new feature on Windows 10 (64 bit): after having installed the 64.exe version. A little glitch also present in the previous versions for the plot feature is that the top window, the one with all the settings for the colums (X, Y, Axis type), is usually hidden when you select the Plot the first time. To make it appear you must drag down the other window with your plot. If needed I can open a new issue since: E.g: EDIT BTW, since we are in the Pull requests topics, it would be extremely cool to have also the "math extension" [1] available into the next upcoming release :-) [1] #1224 |
Two new options added to the context menu of the plot: - Stacked bars: switches between stacked bars or grouped bars. The former overlapped layout is avoided since it doesn't make much sense. - Show legend: toggles the display of a plot legend with a translucent background. Possible future improvement is dragging the legend with the mouse.
@justinclift Thanks for the builds. I bring now more "material". I've committed the option for the stacked bars. When they are not stacked they are grouped together, that makes much more sense as overlapped (but that was surprisingly the default layout for QCustomPlot). The option is in the context menu of the plot. Maybe it should replace the Line type and Point shape combo-boxes for bar charts but it was easier this way. Maybe some day. I've also added an option for displaying a plot legend for any kind of plot. Maybe some day it would be draggable with the mouse 😄 "Stacked bars" checked and "Show legend" checked: "Stacked bars" unchecked (grouped) and "Show legend" unchecked (defaults): @SilvioGrosso I'm glad that my enhancement to DB4S can contribute a bit to the advance of Science 😃 Those problems that you mention may deserve each one a new issue. The one about the plot isn't happening in my environment. Maybe a screenshot can help discover the cause. The one about completion happens for all the functions that display a "calltip". The workaround is to click on that calltip to remove it and then the completion works again. This is how QScintilla works, I don't know if we could work around it. |
Wow @mgrojo, you're getting SO much stuff done. Our next release is really going to be well named. 😄 New builds for Windows with this new commit are ready:
@SilvioGrosso Good point. I really need to get around to making that happen. 😄 |
Sent a tweet about this to our Twitter account too. Might be useful for getting feedback. 😄 |
It's currently my pastime 😄 |
Hello everyone, Just tested today's new build.
Yep. It only occours once in a while when you install a new version on Windows.
Yep. It would be really useful for Windows users 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than these two minor issues I couldn't find any problem with this either 😄 Nice work 😄
src/PlotDock.cpp
Outdated
|
||
switch (columntype) { | ||
case QVariant::DateTime: | ||
columnitem->setText(PlotColumnType, "Date/Time"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should have a tr()
around them as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/PlotDock.cpp
Outdated
break; | ||
case QVariant::String: | ||
columnitem->setText(PlotColumnType, "Label"); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a default
branch? Without one it's producing tons of warnings for me 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. I don't get any warnings, either compiler version difference or difference in flags.
This addresses review comments by @MKleusberg in PR #1302.
Fantastic! 😄 @chrisjlocke Feel like creating some animated gif things showing how to use the new bar charts? They'd make for awesome instructions on the wiki. 😄 |
My apologies for coming too late to the party. |
This PR adds support for bar charts in the Plot Dock. A string column is used as bar labels. This is specially thought for GROUP BY queries.
A new column for displaying the axis type is added, so the plot results are predictable for the user. This column stores now the internal type enumeration.
Only columns that are correctly plotted as Y axis are selectable for that.
There are caveats, like plotting more than one Y axis, since the bars overlap. To alleviate this the additional bars are translucent, but this kind of graph is maybe not very interesting. Should the user have the option to stack the bars when that makes sense?
I'm confident of the changes, but since we plan to make soon a release, I prefer to commit this as a pull request, so it can be reviewed. I'd like opinions also about the new Axis Type column, since it is not actually needed for the implementation (maybe there should be two PR, but this is already done).