Class: QgsDiagramSettings

class qgis.core.QgsDiagramSettings

Bases: sip.wrapper

Stores the settings for rendering a single diagram.

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.

QgsDiagramSettings() Constructor for QgsDiagramSettings

QgsDiagramSettings(other: QgsDiagramSettings) Copy constructor

Methods

axisLineSymbol

Returns the line symbol to use for rendering axis in diagrams.

direction

Returns the chart's angular direction.

legendItems

Returns list of legend nodes for the diagram

paintEffect

Returns the paint effect to use while rendering diagrams.

readXml

Reads diagram settings from XML

setAxisLineSymbol

Sets the line symbol to use for rendering axis in diagrams.

setDirection

Sets the chart's angular direction.

setPaintEffect

Sets the paint effect to use while rendering diagrams.

setShowAxis

Sets whether the diagram axis should be shown.

setSpacing

Sets the spacing between diagram contents.

setSpacingMapUnitScale

Sets the map unit scale for the content spacing.

setSpacingUnit

Sets the unit for the content spacing.

showAxis

Returns True if the diagram axis should be shown.

spacing

Returns the spacing between diagram contents.

spacingMapUnitScale

Returns the map unit scale for the content spacing.

spacingUnit

Returns the units for the content spacing.

writeXml

Writes diagram settings to XML

Attributes

Clockwise

Counterclockwise

Down

Height

Left

Right

Up

XHeight

Clockwise = 0
Counterclockwise = 1
class DiagramOrientation

Bases: int

class Direction

Bases: int

Down = 1
Height = 0
class LabelPlacementMethod

Bases: int

Left = 2
Right = 3
Up = 0
XHeight = 1
axisLineSymbol(self) QgsLineSymbol

Returns the line symbol to use for rendering axis in diagrams.

See also

showAxis()

New in version 3.12.

Return type:

QgsLineSymbol

backgroundColor
barWidth
categoryAttributes
categoryColors
categoryLabels
diagramOrientation
direction(self) QgsDiagramSettings.Direction

Returns the chart’s angular direction.

See also

setDirection()

New in version 3.12.

Return type:

QgsDiagramSettings.Direction

enabled
font
labelPlacementMethod
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.

Parameters:

nodeLayer (QgsLayerTreeLayer) –

Return type:

List[QgsLayerTreeModelLegendNode]

lineSizeScale
lineSizeUnit
maximumScale
minimumScale
minimumSize
opacity
paintEffect(self) QgsPaintEffect

Returns the paint effect to use while rendering diagrams.

See also

setPaintEffect()

New in version 3.12.

Return type:

QgsPaintEffect

penColor
penWidth
readXml(self, elem: QDomElement, context: QgsReadWriteContext = QgsReadWriteContext())

Reads diagram settings from XML

Parameters:
rotationOffset
scaleBasedVisibility
scaleByArea
setAxisLineSymbol(self, symbol: QgsLineSymbol)

Sets the line symbol to use for rendering axis in diagrams.

Ownership of symbol is transferred to the settings.

See also

axisLineSymbol()

See also

setShowAxis()

New in version 3.12.

Parameters:

symbol (QgsLineSymbol) –

setDirection(self, direction: QgsDiagramSettings.Direction)

Sets the chart’s angular direction.

See also

direction()

New in version 3.12.

Parameters:

direction (QgsDiagramSettings.Direction) –

setPaintEffect(self, effect: QgsPaintEffect)

Sets the paint effect to use while rendering diagrams.

Ownership of effect is transferred to the settings.

See also

paintEffect()

New in version 3.12.

Parameters:

effect (QgsPaintEffect) –

setShowAxis(self, showAxis: bool)

Sets whether the diagram axis should be shown.

See also

showAxis()

New in version 3.12.

Parameters:

showAxis (bool) –

setSpacing(self, spacing: float)

Sets the spacing between diagram contents.

Spacing units are set via setSpacingUnit().

See also

spacing()

See also

setSpacingUnit()

New in version 3.12.

Parameters:

spacing (float) –

setSpacingMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the content spacing.

See also

setSpacing()

See also

setSpacingUnit()

New in version 3.12.

Parameters:

scale (QgsMapUnitScale) –

setSpacingUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the content spacing.

See also

spacingUnit()

See also

setSpacing()

New in version 3.12.

Parameters:

unit (QgsUnitTypes.RenderUnit) –

showAxis(self) bool

Returns True if the diagram axis should be shown.

See also

setShowAxis()

See also

axisLineSymbol()

New in version 3.12.

Return type:

bool

size
sizeScale
sizeType
spacing(self) float

Returns the spacing between diagram contents.

Spacing units can be retrieved by calling spacingUnit().

See also

setSpacing()

See also

spacingUnit()

New in version 3.12.

Return type:

float

spacingMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the content spacing.

See also

spacing()

See also

spacingUnit()

New in version 3.12.

Return type:

QgsMapUnitScale

spacingUnit(self) QgsUnitTypes.RenderUnit

Returns the units for the content spacing.

See also

setSpacingUnit()

See also

spacing()

New in version 3.12.

Return type:

QgsUnitTypes.RenderUnit

writeXml(self, rendererElem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext = QgsReadWriteContext())

Writes diagram settings to XML

Parameters:
  • rendererElem (QDomElement) –

  • doc (QDomDocument) –

  • context (QgsReadWriteContext = QgsReadWriteContext()) –