Class: QgsStackedDiagramRenderer

Renders diagrams using mixed diagram render types. The size of the rendered diagram is given by a combination of subrenderers.

Added in version 3.40.

Class Hierarchy

Inheritance diagram of qgis.core.QgsStackedDiagramRenderer

Base classes

QgsDiagramRenderer

Evaluates and returns the diagram settings relating to a diagram for a specific feature.

Methods

addRenderer

Adds a renderer to the stacked renderer object.

diagramSettings

Returns list with all diagram settings in the renderer

renderDiagram

Renders the diagram for a specified feature at a specific position in the passed render context, taking all renderers and their own diagrams into account.

renderer

Returns the renderer at the given index.

rendererCount

Returns the number of sub renderers in the stacked diagram renderer

renderers

Returns an ordered list with the renderers of the stacked renderer object.

setDiagramSettings

class qgis.core.QgsStackedDiagramRenderer[source]

Bases: QgsDiagramRenderer

addRenderer(self, renderer: QgsDiagramRenderer | None)[source]

Adds a renderer to the stacked renderer object. Takes ownership.

Renderers added first will render their diagrams first, i.e., more to the left (horizontal mode) or more to the top (vertical mode).

Parameters:

renderer (Optional[QgsDiagramRenderer]) – diagram renderer to be added to the stacked renderer

diagramSettings(self) List[QgsDiagramSettings][source]

Returns list with all diagram settings in the renderer

Return type:

List[QgsDiagramSettings]

diagramSettings(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings) bool[source]
Parameters:
Return type:

bool

renderDiagram(self, feature: QgsFeature, c: QgsRenderContext, pos: QPointF | QPoint, properties: QgsPropertyCollection = QgsPropertyCollection())[source]

Renders the diagram for a specified feature at a specific position in the passed render context, taking all renderers and their own diagrams into account. Diagram rendering is delegated to renderer’s diagram.

Parameters:
renderer(self, index: int) QgsDiagramRenderer | None[source]

Returns the renderer at the given index. Does not transfer ownership.

Parameters:

index (int) – index of the desired renderer in the stacked renderer

Return type:

Optional[QgsDiagramRenderer]

rendererCount(self) int[source]

Returns the number of sub renderers in the stacked diagram renderer

Return type:

int

renderers(self, sortByDiagramMode: bool = False) List[QgsDiagramRenderer]

Returns an ordered list with the renderers of the stacked renderer object. Does not transfer ownership.

Parameters:

sortByDiagramMode (bool = False) – If true, the list is returned backwards for vertical orientation.

Return type:

List[QgsDiagramRenderer]

setDiagramSettings(self, s: QgsDiagramSettings)[source]
Parameters:

s (QgsDiagramSettings)