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

[feature] Introduce stacked diagrams #58568

Merged
merged 30 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7548370
Introduce QgsStackedDiagram to create compound diagrams like populati…
gacarrillor Jul 3, 2024
06daff8
[tests] Add first test for stacked diagrams (population pyramid)
gacarrillor Jul 3, 2024
3a264b4
Replace outdated unused in docs; remove outdated unused in code
gacarrillor Jul 3, 2024
4432797
Const method; improve new QgsStackedDiagram's docs
gacarrillor Jul 3, 2024
2d7b81c
Adjust documentation links
gacarrillor Jul 3, 2024
184ac73
[tests] Add test for stacked diagrams with spacing
gacarrillor Jul 4, 2024
1e1c39a
[tests] Add test for vertical stacked (pie) diagrams with fixed size
gacarrillor Jul 5, 2024
bfd4367
[tests] Fix vertical position for horizontally stacked diagrams and v…
gacarrillor Aug 8, 2024
5b35dba
[tests] Subdiagram position in vertically stacked diagrams (iterating…
gacarrillor Aug 21, 2024
6c60810
[tests] Vertically stacked diagrams with spacing
gacarrillor Aug 21, 2024
614ce76
[gui] Introduce StackedDiagramProperties and use it as dialog and as …
gacarrillor Aug 23, 2024
a49175b
[gui] Add methods to add and remove subdiagrams in QgsStackedDiagramP…
gacarrillor Aug 24, 2024
fd7d8ed
[gui] Implement apply() for QgsStackedDiagramProperties, delegating p…
gacarrillor Aug 27, 2024
4a3dfd7
[gui] In QgsStackedDiagramProperties, make tabs movable to redefine s…
gacarrillor Aug 27, 2024
d5837a7
[fix] Fix issue on histogram bar orientation in a first set up (fix #…
gacarrillor Aug 27, 2024
b9d2781
[gui] Move 'No diagram' option from QgsDiagramProperties to QgsStacke…
gacarrillor Aug 27, 2024
43d5094
[gui] QgsStackedDiagramProperties: Move EngineSettingsButton from Qgs…
gacarrillor Aug 27, 2024
7e886a5
[gui] Implement syncToLayer for QgsStackedDiagramproperties, delegati…
gacarrillor Aug 28, 2024
d12d661
[gui] Write/read stacked diagram state to/from XML (QGIS project)
gacarrillor Aug 29, 2024
e855941
[core] Introduce QgsStackedDiagramRenderer for rendering stacked diag…
gacarrillor Sep 4, 2024
f81df28
[gui] Move Diagrams properties to a panel widget, showing tabs instea…
gacarrillor Sep 18, 2024
647437b
[core] Stacked diagrams: make sure scale dependent visibility works o…
gacarrillor Sep 23, 2024
e2d5a77
[gui] Diagrams: Promote 'increase small diagrams' check box to group …
gacarrillor Sep 24, 2024
5fef1f6
[gui] Diagrams panel: make sure color and effects buttons can open a …
gacarrillor Sep 24, 2024
0916ed1
[core] Stacked diagrams: use one-liner to reverse renderers (std::rev…
gacarrillor Sep 24, 2024
01055d7
[gui] Diagram panel: connect effects and font widgets to live updates…
gacarrillor Sep 26, 2024
eb201c5
[gui] Switch from string-based connections to functor-based ones
gacarrillor Sep 26, 2024
463bf24
[core] Address review: switch from define to static const
gacarrillor Sep 25, 2024
37de287
[core] Addres review: skip SIP for some static const diagram names
gacarrillor Sep 26, 2024
b8f9760
[core] Address review, stacked diagrams: include maxScale for renderi…
gacarrillor Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/PyQt6/core/auto_additions/qgsdiagramrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@

"""
# --
QgsDiagramLayerSettings.Single = QgsDiagramLayerSettings.DiagramType.Single
QgsDiagramLayerSettings.Stacked = QgsDiagramLayerSettings.DiagramType.Stacked
QgsDiagramSettings.Height = QgsDiagramSettings.LabelPlacementMethod.Height
QgsDiagramSettings.XHeight = QgsDiagramSettings.LabelPlacementMethod.XHeight
QgsDiagramSettings.Up = QgsDiagramSettings.DiagramOrientation.Up
Expand All @@ -72,6 +74,8 @@
QgsDiagramSettings.Right = QgsDiagramSettings.DiagramOrientation.Right
QgsDiagramSettings.Clockwise = QgsDiagramSettings.Direction.Clockwise
QgsDiagramSettings.Counterclockwise = QgsDiagramSettings.Direction.Counterclockwise
QgsDiagramSettings.Horizontal = QgsDiagramSettings.StackedDiagramMode.Horizontal
QgsDiagramSettings.Vertical = QgsDiagramSettings.StackedDiagramMode.Vertical
try:
QgsDiagramSettings.__attribute_docs__ = {'sizeType': 'Diagram size unit', 'sizeScale': 'Diagram size unit scale', 'lineSizeUnit': 'Line unit index', 'lineSizeScale': 'Line unit scale', 'opacity': 'Opacity, from 0 (transparent) to 1.0 (opaque)', 'rotationOffset': 'Rotation offset, in degrees clockwise from horizontal.', 'maximumScale': 'The maximum map scale (i.e. most "zoomed in" scale) at which the diagrams will be visible.\nThe scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.\nA scale of 0 indicates no maximum scale visibility.\n\n.. seealso:: :py:func:`minimumScale`', 'minimumScale': 'The minimum map scale (i.e. most "zoomed out" scale) at which the diagrams will be visible.\nThe scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.\nA scale of 0 indicates no minimum scale visibility.\n\n.. seealso:: :py:func:`maximumScale`', 'minimumSize': 'Scale diagrams smaller than mMinimumSize to mMinimumSize'}
except NameError:
Expand Down
5 changes: 5 additions & 0 deletions python/PyQt6/core/auto_additions/qgsstackeddiagram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The following has been generated automatically from src/core/diagram/qgsstackeddiagram.h
try:
QgsStackedDiagram.__group__ = ['diagram']
except NameError:
pass
6 changes: 4 additions & 2 deletions python/PyQt6/core/auto_generated/diagram/qgsdiagram.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ Base class for all diagram types.
sipType = sipType_QgsHistogramDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Text" ) )
sipType = sipType_QgsTextDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) )
else if ( sipCpp->diagramName() == QLatin1String( "StackedBar" ) )
sipType = sipType_QgsStackedBarDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) )
sipType = sipType_QgsStackedDiagram;
else
sipType = NULL;
%End
Expand Down Expand Up @@ -107,7 +109,7 @@ Calculates a size to match the current settings and rendering context
Calculates a length to match the current settings and rendering context

:param l: The length to convert
:param s: Unused
:param s: The settings that specify the size type
:param c: The rendering specifying the proper scale units for pixel conversion

:return: The converted length for rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@




class QgsHistogramDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -21,6 +20,7 @@ A histogram style diagram.
#include "qgshistogramdiagram.h"
%End
public:

QgsHistogramDiagram();

virtual QgsHistogramDiagram *clone() const /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@




class QgsPieDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -19,6 +18,7 @@ A pie chart diagram.
#include "qgspiediagram.h"
%End
public:

QgsPieDiagram();

virtual QgsPieDiagram *clone() const /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@




class QgsStackedBarDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -24,6 +23,7 @@ A stacked bar chart diagram.
#include "qgsstackedbardiagram.h"
%End
public:

QgsStackedBarDiagram();

virtual QgsStackedBarDiagram *clone() const /Factory/;
Expand Down
60 changes: 60 additions & 0 deletions python/PyQt6/core/auto_generated/diagram/qgsstackeddiagram.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/diagram/qgsstackeddiagram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/





class QgsStackedDiagram : QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
A diagram composed of several subdiagrams, located side by side.

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsstackeddiagram.h"
%End
public:

QgsStackedDiagram();

virtual QgsStackedDiagram *clone() const /Factory/;


void subDiagramPosition( QPointF &newPos, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramSettings &subSettings );
%Docstring
Calculates the position for the next subdiagram, updating the ``newPos`` object.

:param newPos: out: position of the previous diagram
:param c: renderer context
:param s: stacked diagram settings
:param subSettings: previous subdiagram settings
%End

virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );


virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );

virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );

virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;

virtual QString diagramName() const;

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/diagram/qgsstackeddiagram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@




class QgsTextDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -19,6 +18,7 @@ A text based diagram.
#include "qgstextdiagram.h"
%End
public:

enum Shape /BaseType=IntEnum/
{
Circle,
Expand Down
Loading
Loading