Class: QgsDiagramLayerSettings¶
Stores the settings for rendering of all diagrams for a layer.
QgsDiagramSettings stores the settings related to rendering
the individual diagrams themselves, while
QgsDiagramLayerSettings stores settings which control how
ALL diagrams within a layer are rendered.
Enums
Data definable properties.  | 
Methods
Returns the coordinate transform associated with the layer, or an invalid transform if no transformation is required.  | 
|
Returns a reference to the diagram's property collection, used for data defined overrides.  | 
|
Returns the distance between the diagram and the feature (in mm).  | 
|
Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.  | 
|
Returns the diagram placement flags.  | 
|
Returns the diagram placement.  | 
|
Prepares the diagrams for a specified expression context.  | 
|
Returns the diagram priority.  | 
|
Returns the diagram property definitions.  | 
|
Reads the diagram settings from a DOM element.  | 
|
Returns the set of any fields referenced by the layer's diagrams.  | 
|
Returns the diagram renderer associated with the layer.  | 
|
Sets the coordinate transform associated with the layer.  | 
|
Sets the diagram's property collection, used for data defined overrides.  | 
|
Sets the distance between the diagram and the feature.  | 
|
Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.  | 
|
Sets the the diagram placement flags.  | 
|
Sets the diagram placement.  | 
|
Sets the diagram priority.  | 
|
Sets the diagram renderer associated with the layer.  | 
|
Sets whether the layer should show all diagrams, including overlapping diagrams  | 
|
Sets the diagram z-index.  | 
|
Returns whether the layer should show all diagrams, including overlapping diagrams  | 
|
Writes the diagram settings to a DOM element.  | 
|
Returns the diagram z-index.  | 
Attributes
- class qgis.core.QgsDiagramLayerSettings[source]¶
 Bases:
object- AboveLine = 2¶
 
- AroundPoint = 0¶
 
- BelowLine = 4¶
 
- Curved = 3¶
 
- class DiagramType¶
 Bases:
int
- Free = 5¶
 
- Horizontal = 4¶
 
- Line = 2¶
 
- class LinePlacementFlag¶
 Bases:
int
- class LinePlacementFlags¶
 - class LinePlacementFlags(f: QgsDiagramLayerSettings.LinePlacementFlags | QgsDiagramLayerSettings.LinePlacementFlag)
 - class LinePlacementFlags(a0: QgsDiagramLayerSettings.LinePlacementFlags)
 Bases:
object
- MapOrientation = 16¶
 
- OnLine = 1¶
 
- OverPoint = 1¶
 
- class Placement¶
 Bases:
int
- class Property(*values)¶
 Bases:
IntEnumData definable properties.
BackgroundColor: Diagram background colorStrokeColor: Stroke colorStrokeWidth: Stroke widthPositionX: X-coordinate data defined diagram positionPositionY: Y-coordinate data defined diagram positionDistance: Distance to diagram from featurePriority: Diagram priority (between 0 and 10)ZIndex: Z-index for diagram orderingIsObstacle: Whether diagram features act as obstacles for other diagrams/labelsShow: Whether to show the diagramAlwaysShow: Whether the diagram should always be shown, even if it overlaps other diagrams/labelsStartAngle: Angle offset for pie diagram
- Single = 0¶
 
- Stacked = 1¶
 
- coordinateTransform(self) QgsCoordinateTransform[source]¶
 Returns the coordinate transform associated with the layer, or an invalid transform if no transformation is required.
See also
- Return type:
 
- dataDefinedProperties(self) QgsPropertyCollection¶
 Returns a reference to the diagram’s property collection, used for data defined overrides.
See also
- Return type:
 
- distance(self) float[source]¶
 Returns the distance between the diagram and the feature (in mm).
See also
- Return type:
 float
- isObstacle(self) bool[source]¶
 Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
See also
- Return type:
 bool
- linePlacementFlags(self) QgsDiagramLayerSettings.LinePlacementFlags[source]¶
 Returns the diagram placement flags. These are only used if the diagram placement is set to a line type.
See also
- Return type:
 
- placement(self) QgsDiagramLayerSettings.Placement[source]¶
 Returns the diagram placement.
See also
- Return type:
 
- prepare(self, context: QgsExpressionContext = QgsExpressionContext()) bool[source]¶
 Prepares the diagrams for a specified expression context. Calling prepare before rendering multiple diagrams allows precalculation of expensive setup tasks such as parsing expressions. Returns
Trueif preparation was successful.- Parameters:
 context (
QgsExpressionContext= QgsExpressionContext())- Return type:
 bool
- priority(self) int[source]¶
 Returns the diagram priority.
- Return type:
 int
- Returns:
 diagram priority, where 0 = low and 10 = high
Note
placement priority is shared with labeling, so diagrams with a high priority may displace labels and vice-versa
See also
- propertyDefinitions() Dict[int, QgsPropertyDefinition]¶
 Returns the diagram property definitions.
- Return type:
 Dict[int, QgsPropertyDefinition]
- readXml(self, elem: QDomElement)[source]¶
 Reads the diagram settings from a DOM element.
See also
- Parameters:
 elem (QDomElement)
- referencedFields(self, context: QgsExpressionContext = QgsExpressionContext()) Set[str]¶
 Returns the set of any fields referenced by the layer’s diagrams.
- Parameters:
 context (
QgsExpressionContext= QgsExpressionContext()) – expression context the diagrams will be drawn using- Return type:
 Set[str]
- renderer(self) QgsDiagramRenderer | None[source]¶
 Returns the diagram renderer associated with the layer.
See also
- Return type:
 Optional[QgsDiagramRenderer]
- setCoordinateTransform(self, transform: QgsCoordinateTransform)[source]¶
 Sets the coordinate transform associated with the layer.
- Parameters:
 transform (QgsCoordinateTransform) – coordinate transform. Ownership is transferred to the object.
See also
- setDataDefinedProperties(self, collection: QgsPropertyCollection)[source]¶
 Sets the diagram’s property collection, used for data defined overrides.
- Parameters:
 collection (QgsPropertyCollection) – property collection. Existing properties will be replaced.
See also
See also
Property
- setDistance(self, distance: float)[source]¶
 Sets the distance between the diagram and the feature.
- Parameters:
 distance (float) – distance in mm
See also
- setIsObstacle(self, isObstacle: bool)[source]¶
 Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
- Parameters:
 isObstacle (bool) – set to
Truefor feature to act as obstacle
See also
- setLinePlacementFlags(self, flags: QgsDiagramLayerSettings.LinePlacementFlags | QgsDiagramLayerSettings.LinePlacementFlag)[source]¶
 Sets the the diagram placement flags. These are only used if the diagram placement is set to a line type.
- Parameters:
 flags (Union[QgsDiagramLayerSettings.LinePlacementFlags, QgsDiagramLayerSettings.LinePlacementFlag]) – placement value
See also
- setPlacement(self, value: QgsDiagramLayerSettings.Placement)[source]¶
 Sets the diagram placement.
- Parameters:
 value (QgsDiagramLayerSettings.Placement) – placement value
See also
- setPriority(self, value: int)[source]¶
 Sets the diagram priority.
- Parameters:
 value (int) – priority, where 0 = low and 10 = high
See also
- setRenderer(self, diagramRenderer: QgsDiagramRenderer | None)[source]¶
 Sets the diagram renderer associated with the layer.
- Parameters:
 diagramRenderer (Optional[QgsDiagramRenderer]) – diagram renderer. Ownership is transferred to the object.
See also
- setShowAllDiagrams(self, showAllDiagrams: bool)[source]¶
 Sets whether the layer should show all diagrams, including overlapping diagrams
- Parameters:
 showAllDiagrams (bool) – set to
Trueto show all diagrams
See also
- setZIndex(self, index: float)[source]¶
 Sets the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams with a lower z-index.
- Parameters:
 index (float) – diagram z-index
See also
- showAllDiagrams(self) bool[source]¶
 Returns whether the layer should show all diagrams, including overlapping diagrams
See also
- Return type:
 bool
- writeXml(self, layerElem: QDomElement, doc: QDomDocument)[source]¶
 Writes the diagram settings to a DOM element.
See also
- Parameters:
 layerElem (QDomElement)
doc (QDomDocument)
- zIndex(self) float[source]¶
 Returns the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams with a lower z-index.
Note
z-index ordering is shared with labeling, so diagrams with a high z-index may be drawn over labels with a low z-index and vice-versa
See also
- Return type:
 float