-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[feature] Introduce stacked diagrams #58568
Conversation
@gacarrillor A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
Nice work @gacarrillor ! I don't think the use of tabs is appropriate here for configuring sub diagrams. I'd rather see the UI modeled off our existing rule based labeling approach, which IMO is a better fit for this kind of configuration. |
I'd also suggest that the "stacked diagram" option should appear in the topmost combo box alongside the actual diagram types (eg alongside Histogram etc). Then there's no added GUI complexity when using the common single diagram type, and selecting "stacked diagrams" would expose the list of subdiagrams in the panel below that combo. |
This comment was marked as outdated.
This comment was marked as outdated.
Looking forward to use this in the future - a really nice extension to the diagram system! |
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
This comment was marked as outdated.
This comment was marked as outdated.
Thank you all for the feedback! |
This comment was marked as outdated.
This comment was marked as outdated.
@gacarrillor is there anything that keeps this in "draft"? Feature freeze is in two days and this would be a fantastic feature to ship with the next LTR, so I wonder if we have any chance to see this there. |
Thanks for pointing this out. I've just removed the draft mark. |
Thank you @nyalldawson for the exemption. |
531a61b
to
744ac33
Compare
…on pyramids. Use Stacked as internal name for stacked diagrams and StackedBar for stacked bar diagrams. Add subDiagram parameter to QgsDiagramRenderer::diagramSize() and QgsDiagramRenderer::diagramSettings() (single and interpolated) to get subdiagrams info.
744ac33
to
f81df28
Compare
Known issues to be addressed in upcoming commits:
Most-likely for a follow-up:
@nyalldawson, there are still some details to be solved, but we've almost finished addressing your suggestions, thanks! |
…n subdiagrams; test included
…box to remove horizontal scroll bar in panel; bring back default values that had been lost in recent changes
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.
I looked at the core part. I will do the gui tomorrow!
Looks good so far!
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.
Not much more comments regarding the GUI, good job!
…; switch from string-based connections to functor-based ones
…ng with scale dependent visibility
@gacarrillor |
Thanks a lot @3nids for your insightful review! |
This PR extends the QGIS diagram module allowing it to create and display stacked diagrams, i.e., diagrams located side by side. We've also taken the opportunity to move the diagram settings from a modal dialog to the Styling dock widget.
Stacked diagrams can be configured and displayed horizontally or vertically. The spacing between the so called subdiagrams can also be configured.
Stacked diagrams allow users to create complex diagrams like population pyramids.
Stacked diagrams can show mixed subdiagram types (e.g., a pie chart alongside a histogram) and users can add as many subdiagrams as they want. Moreover, subdiagrams can use different renderer types: e.g., one subdiagram could use a single category renderer, whereas the other could use a linearly interpolated one.
Subdiagrams can set their own size and their own legend settings (e.g., one subdiagram could show its categories in the legend, whereas another one could hide its own categories).
Subdiagram ordering is given by item ordering in the Stacked Diagram page's list. In the future, users could re-arrange subdiagram ordering by dragging and dropping subdiagrams (left as follow-up).
Note there are some shared settings like placement settings (e.g., over point), that the stacked diagram will take from its first subdiagram. Thus, other subdiagrams won't be able to set or change those specific settings, unless they become the first subdiagram in the stacked diagram. Therefore, when editing a subdiagram that is not located in the first place, we show labels to let users know why they don't see the expected widgets (e.g., placement ones) and where they can find them (i.e., in the first subdiagram).
GUI Stacked Diagrams
vokoscreenNG-2024-09-18_00-30-27.mp4
GUI Single Diagram
Before / After (click to see it in large size)
Other samples
(Note the corresponding point feature's geometry)
Mixed renderer type (pies using single category and histograms using linearly interpolated one):
Nested stacked diagrams (just because we can! Not exposed through GUI, but possible in core and showcased via unit test):
Includes tests.
Additional fixes:
Funded by Landesamt für Vermessung und Geoinformation (LVG) Vorarlberg in collaboration with the QGIS user group Switzerland.