Class: QgsTextDiagram

class qgis.core.QgsTextDiagram

Bases: QgsDiagram

A text based diagram.

Methods

clone

rtype

QgsTextDiagram

diagramName

rtype

str

diagramSize

diagramSize(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings, is_: QgsDiagramInterpolationSettings) -> QSizeF

legendSize

param value

renderDiagram

param feature

scaledFont

Calculates a size to match the current settings and rendering context

setPenWidth

Changes the pen width to match the current settings and rendering context

sizeForValue

Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.

sizePainterUnits

Calculates a size to match the current settings and rendering context

Attributes

Circle

Horizontal

Rectangle

Triangle

Vertical

Circle = 0
Horizontal = 0
class Orientation

Bases: int

Rectangle = 1
class Shape

Bases: int

Triangle = 2
Vertical = 1
clone(self)QgsTextDiagram
Return type

QgsTextDiagram

diagramName(self) → str
Return type

str

diagramSize(self, attributes: object, c: QgsRenderContext, s: QgsDiagramSettings) → QSizeF

diagramSize(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings, is_: QgsDiagramInterpolationSettings) -> QSizeF

Parameters
Return type

QSizeF

legendSize(self, value: float, s: QgsDiagramSettings, is_: QgsDiagramInterpolationSettings) → float
Parameters
Return type

float

renderDiagram(self, feature: QgsFeature, c: QgsRenderContext, s: QgsDiagramSettings, position: Union[QPointF, QPoint])
Parameters
scaledFont(self, s: QgsDiagramSettings, c: QgsRenderContext) → QFont

Calculates a size to match the current settings and rendering context

Parameters
  • s – The settings that contain the font size and size type

  • c – The rendering specifying the proper scale units for pixel conversion

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 – The pen to modify

  • s – The settings that specify the pen width

  • c – 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 – value to calculate corresponding circular size for

  • s – diagram settings

  • is – interpolation settings

New in version 2.16.

sizePainterUnits(self, size: QSizeF, s: QgsDiagramSettings, c: QgsRenderContext) → QSizeF

Calculates a size to match the current settings and rendering context

Parameters
  • size – The size to convert

  • s – The settings that specify the size type

  • c – 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

Returns

The converted length for rendering