Subgroup: Diagram
Class: QgsDiagramRenderer¶
-
class
qgis.core.
QgsDiagramRenderer
¶ Bases:
sip.wrapper
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Methods
attributeLegend
Returns true if renderer will show legend items for diagram attributes. clone
Returns new instance that is equivalent to this one convertSizeToMapUnits
Converts size from mm to map units diagram
diagramAttributes
Returns attribute indices needed for diagram rendering diagramSettings
Returns list with all diagram settings in the renderer diagramSize
Returns size of the diagram (in painter units) or an invalid size in case of error dpiPaintDevice
Returns the paint device dpi (or -1 in case of error legendItems
Returns list of legend nodes for the diagram readXml
Reads diagram state from a DOM element. referencedFields
Returns the set of any fields required for diagram rendering renderDiagram
Renders the diagram for a specified feature at a specific position in the passed render context. rendererName
setAttributeLegend
Sets whether the renderer will show legend items for diagram attributes. setDiagram
sizeMapUnits
Returns size of the diagram for a feature in map units. writeXml
Writes diagram state to a DOM element. Attributes
-
attributeLegend
(self) → bool¶ Returns true if renderer will show legend items for diagram attributes.
New in version 2.16.
See also
See also
sizeLegend()
-
clone
(self) → QgsDiagramRenderer¶ Returns new instance that is equivalent to this one
New in version 2.4.
-
convertSizeToMapUnits
(self, size: QSizeF, context: QgsRenderContext)¶ Converts size from mm to map units
-
diagram
(self) → QgsDiagram¶
-
diagramAttributes
(self) → List[str]¶ Returns attribute indices needed for diagram rendering
-
diagramSettings
(self) → object¶ Returns list with all diagram settings in the renderer
diagramSettings(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings) -> bool Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram()
Parameters: - feature – the feature
- c – render context
- s – out: diagram settings for the feature
-
diagramSize
(self, features: QgsFeature, c: QgsRenderContext) → QSizeF¶ Returns size of the diagram (in painter units) or an invalid size in case of error
-
dpiPaintDevice
(QPainter) → int¶ Returns the paint device dpi (or -1 in case of error
-
legendItems
(self, nodeLayer: QgsLayerTreeLayer) → List[QgsLayerTreeModelLegendNode]¶ Returns list of legend nodes for the diagram
Note
caller is responsible for deletion of
QgsLayerTreeModelLegendNodes
New in version 2.10.
-
readXml
(self, elem: QDomElement, context: QgsReadWriteContext)¶ Reads diagram state from a DOM element. Subclasses should ensure that _readXml() is called by their readXml implementation to restore the general QgsDiagramRenderer settings.
See also
-
referencedFields
(self, context: QgsExpressionContext = QgsExpressionContext()) → Set[str]¶ Returns the set of any fields required for diagram rendering
Parameters: context – expression context the diagrams will be drawn using New in version 2.16.
-
renderDiagram
(self, feature: QgsFeature, c: QgsRenderContext, pos: Union[QPointF, QPoint], properties: QgsPropertyCollection = QgsPropertyCollection())¶ Renders the diagram for a specified feature at a specific position in the passed render context.
-
rendererName
(self) → str¶
-
setAttributeLegend
(self, enabled: bool)¶ Sets whether the renderer will show legend items for diagram attributes.
Parameters: enabled – set to true to show diagram attribute legend New in version 2.16.
See also
See also
setSizeLegend()
-
setDiagram
(self, d: QgsDiagram)¶
-
sizeMapUnits
(self, feature: QgsFeature, c: QgsRenderContext) → QSizeF¶ Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error
-