Class: QgsColorRampLegendNodeSettings

class qgis.core.QgsColorRampLegendNodeSettings

Bases: sip.wrapper

Settings for a color ramp legend node.

New in version 3.18.

QgsColorRampLegendNodeSettings()

QgsColorRampLegendNodeSettings(other: QgsColorRampLegendNodeSettings) Copy constructor

Methods

direction

Returns the direction of the ramp.

maximumLabel

Returns the label for the maximum value on the ramp.

minimumLabel

Returns the label for the minimum value on the ramp.

numericFormat

Returns the numeric format used for numbers in the scalebar.

orientation

Returns the ramp orientation (i.e.

prefix

Returns the prefix to show before legend text.

readXml

Reads settings from an XML element.

setDirection

Sets the direction of the ramp.

setMaximumLabel

Sets the label for the maximum value on the ramp.

setMinimumLabel

Sets the label for the minimum value on the ramp.

setNumericFormat

Sets the numeric format used for numbers in the scalebar.

setOrientation

Sets the ramp orientation (i.e.

setPrefix

Sets the prefix to show before legend text.

setSuffix

Sets the suffix to show after legend text.

setTextFormat

Sets the text format used to render text in the legend item.

setUseContinuousLegend

Sets the flag to use a continuos gradient legend to useContinuousLegend.

suffix

Returns the suffix to show after legend text.

textFormat

Returns the text format used to render text in the legend item.

useContinuousLegend

Returns True if a continuous gradient legend will be used.

writeXml

Writes settings to an XML element.

Attributes

MaximumToMinimum

MinimumToMaximum

class Direction

Bases: int

MaximumToMinimum = 1
MinimumToMaximum = 0
direction(self) QgsColorRampLegendNodeSettings.Direction

Returns the direction of the ramp.

See also

setDirection()

See also

orientation()

Return type:

QgsColorRampLegendNodeSettings.Direction

maximumLabel(self) str

Returns the label for the maximum value on the ramp.

If the returned string is empty than a default value will be generated based on the associated maximum value.

See also

minimumLabel()

Return type:

str

minimumLabel(self) str

Returns the label for the minimum value on the ramp.

If the returned string is empty than a default value will be generated based on the associated minimum value.

See also

maximumLabel()

Return type:

str

numericFormat(self) QgsNumericFormat

Returns the numeric format used for numbers in the scalebar.

New in version 3.12.

Return type:

QgsNumericFormat

orientation(self) Qt.Orientation

Returns the ramp orientation (i.e. horizontal or vertical).

See also

setOrientation()

See also

direction()

Return type:

Qt.Orientation

prefix(self) str

Returns the prefix to show before legend text.

See also

setPrefix()

See also

suffix()

Return type:

str

readXml(self, element: QDomElement, context: QgsReadWriteContext)

Reads settings from an XML element.

Parameters:
setDirection(self, direction: QgsColorRampLegendNodeSettings.Direction)

Sets the direction of the ramp.

See also

direction()

See also

setOrientation()

Parameters:

direction (QgsColorRampLegendNodeSettings.Direction) –

setMaximumLabel(self, label: str)

Sets the label for the maximum value on the ramp.

If the label is empty than a default value will be generated based on the associated maximum value.

See also

maximumLabel()

Parameters:

label (str) –

setMinimumLabel(self, label: str)

Sets the label for the minimum value on the ramp.

If the label is empty than a default value will be generated based on the associated minimum value.

See also

minimumLabel()

Parameters:

label (str) –

setNumericFormat(self, format: QgsNumericFormat)

Sets the numeric format used for numbers in the scalebar.

Ownership of format is transferred to the scalebar.

See also

numericFormat()

New in version 3.12.

Parameters:

format (QgsNumericFormat) –

setOrientation(self, orientation: Qt.Orientation)

Sets the ramp orientation (i.e. horizontal or vertical).

See also

orientation()

See also

setDirection()

Parameters:

orientation (Qt.Orientation) –

setPrefix(self, prefix: str)

Sets the prefix to show before legend text.

See also

prefix()

See also

setSuffix()

Parameters:

prefix (str) –

setSuffix(self, suffix: str)

Sets the suffix to show after legend text.

See also

suffix()

See also

setPrefix()

Parameters:

suffix (str) –

setTextFormat(self, format: QgsTextFormat)

Sets the text format used to render text in the legend item.

See also

textFormat()

Parameters:

format (QgsTextFormat) –

setUseContinuousLegend(self, useContinuousLegend: bool)

Sets the flag to use a continuos gradient legend to useContinuousLegend.

When this flag is set the legend will be rendered using a continuous color ramp with min and max values, when it is not set the legend will be rendered using separate items for each entry.

See also

setOrientation()

See also

direction()

Parameters:

useContinuousLegend (bool) –

suffix(self) str

Returns the suffix to show after legend text.

See also

setSuffix()

See also

prefix()

Return type:

str

textFormat(self) QgsTextFormat

Returns the text format used to render text in the legend item.

See also

setTextFormat()

Return type:

QgsTextFormat

useContinuousLegend(self) bool

Returns True if a continuous gradient legend will be used.

Return type:

bool

writeXml(self, doc: QDomDocument, element: QDomElement, context: QgsReadWriteContext)

Writes settings to an XML element.

Parameters: