Class: QgsDiagram¶
-
class
qgis.core.
QgsDiagram
¶ Bases:
sip.wrapper
Constructor for QgsDiagram.
QgsDiagram(other:
QgsDiagram
)Base class for all diagram types*
Methods
Returns an instance that is equivalent to this one
Gets a descriptive name for this diagram type.
Returns the size in map units the diagram will use to render.
Returns a prepared expression for the specified context.
Returns the size of the legend item for the diagram corresponding to a specified value.
Draws the diagram at the given position (in pixel coordinates)
Calculates a size to match the current settings and rendering context
Changes the pen width to match the current settings and rendering context
Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.
Calculates a size to match the current settings and rendering context
-
clearCache
(self)¶
-
clone
(self) → QgsDiagram¶ Returns an instance that is equivalent to this one
New in version 2.4.
- Return type
-
diagramName
(self) → str¶ Gets a descriptive name for this diagram type.
- Return type
str
-
diagramSize
(self, attributes: object, c: QgsRenderContext, s: QgsDiagramSettings) → QSizeF¶ Returns the size in map units the diagram will use to render.
diagramSize(self, feature:
QgsFeature
, c:QgsRenderContext
, s:QgsDiagramSettings
, is_:QgsDiagramInterpolationSettings
) -> QSizeF Returns the size in map units the diagram will use to render. Interpolate size- Parameters
attributes (object) –
c (QgsRenderContext) –
s (QgsDiagramSettings) –
- Return type
QSizeF
-
getExpression
(self, expression: str, context: QgsExpressionContext) → QgsExpression¶ Returns a prepared expression for the specified context.
- Parameters
expression (str) – expression string
context (QgsExpressionContext) – expression context
New in version 2.12.
- Return type
-
legendSize
(self, value: float, s: QgsDiagramSettings, is_: QgsDiagramInterpolationSettings) → float¶ Returns the size of the legend item for the diagram corresponding to a specified value.
- Parameters
value (float) – value to return legend item size for
s (QgsDiagramSettings) – diagram settings
is – interpolation settings
New in version 2.16.
- Parameters
- Return type
float
-
renderDiagram
(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings, position: Union[QPointF, QPoint])¶ Draws the diagram at the given position (in pixel coordinates)
- Parameters
feature (QgsFeature) –
c (QgsRenderContext) –
s (QgsDiagramSettings) –
position (Union[QPointF) –
-
scaledFont
(self, s: QgsDiagramSettings, c: QgsRenderContext) → QFont¶ Calculates a size to match the current settings and rendering context
- Parameters
s (QgsDiagramSettings) – The settings that contain the font size and size type
c (QgsRenderContext) – The rendering specifying the proper scale units for pixel conversion
- Return type
QFont
- Returns
The properly scaled font for rendering
-
setPenWidth
(self, pen: Union[QPen, QColor, Qt.GlobalColor, QGradient], s: QgsDiagramSettings, c: QgsRenderContext)¶ Changes the pen width to match the current settings and rendering context
- Parameters
pen (Union[QPen) – The pen to modify
s (QgsDiagramSettings) – The settings that specify the pen width
c (QgsRenderContext) – The rendering specifying the proper scale units for pixel conversion
-
sizeForValue
(self, value: float, s: QgsDiagramSettings, is_: QgsDiagramInterpolationSettings) → QSizeF¶ Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.
- Parameters
value (float) – value to calculate corresponding circular size for
s (QgsDiagramSettings) – diagram settings
is – interpolation settings
New in version 2.16.
- Parameters
- Return type
QSizeF
-
sizePainterUnits
(self, size: QSizeF, s: QgsDiagramSettings, c: QgsRenderContext) → QSizeF¶ Calculates a size to match the current settings and rendering context
- Parameters
size (QSizeF) – The size to convert
s (QgsDiagramSettings) – The settings that specify the size type
c (QgsRenderContext) – The rendering specifying the proper scale units for pixel conversion
- Returns
The converted size for rendering
sizePainterUnits(self, l: float, s:
QgsDiagramSettings
, c:QgsRenderContext
) -> float Calculates a length to match the current settings and rendering context- Parameters
l – The length to convert
s – Unused
c – The rendering specifying the proper scale units for pixel conversion
- Return type
QSizeF
- Returns
The converted length for rendering
-