Class: QgsColorRampLegendNodeSettings

Settings for a color ramp legend node.

Added in version 3.18.

class qgis.core.QgsColorRampLegendNodeSettings[source]

Bases: object

class Direction

Bases: int

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

Returns the direction of the ramp.

See also

setDirection()

See also

orientation()

Return type:

QgsColorRampLegendNodeSettings.Direction

maximumLabel(self) str[source]

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[source]

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 | None[source]

Returns the numeric format used for numbers in the scalebar.

Added in version 3.12.

Return type:

Optional[QgsNumericFormat]

orientation(self) Qt.Orientation[source]

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

See also

setOrientation()

See also

direction()

Return type:

Qt.Orientation

prefix(self) str[source]

Returns the prefix to show before legend text.

See also

setPrefix()

See also

suffix()

Return type:

str

readXml(self, element: QDomElement, context: QgsReadWriteContext)[source]

Reads settings from an XML element.

Parameters:
setDirection(self, direction: QgsColorRampLegendNodeSettings.Direction)[source]

Sets the direction of the ramp.

See also

direction()

See also

setOrientation()

Parameters:

direction (QgsColorRampLegendNodeSettings.Direction)

setMaximumLabel(self, label: str | None)[source]

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 (Optional[str])

setMinimumLabel(self, label: str | None)[source]

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 (Optional[str])

setNumericFormat(self, format: QgsNumericFormat | None)[source]

Sets the numeric format used for numbers in the scalebar.

Ownership of format is transferred to the scalebar.

See also

numericFormat()

Added in version 3.12.

Parameters:

format (Optional[QgsNumericFormat])

setOrientation(self, orientation: Qt.Orientation)[source]

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

See also

orientation()

See also

setDirection()

Parameters:

orientation (Qt.Orientation)

setPrefix(self, prefix: str | None)[source]

Sets the prefix to show before legend text.

See also

prefix()

See also

setSuffix()

Parameters:

prefix (Optional[str])

setSuffix(self, suffix: str | None)[source]

Sets the suffix to show after legend text.

See also

suffix()

See also

setPrefix()

Parameters:

suffix (Optional[str])

setTextFormat(self, format: QgsTextFormat)[source]

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

See also

textFormat()

Parameters:

format (QgsTextFormat)

setUseContinuousLegend(self, useContinuousLegend: bool)[source]

Sets the flag to use a continuous 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[source]

Returns the suffix to show after legend text.

See also

setSuffix()

See also

prefix()

Return type:

str

textFormat(self) QgsTextFormat[source]

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

See also

setTextFormat()

Return type:

QgsTextFormat

useContinuousLegend(self) bool[source]

Returns True if a continuous gradient legend will be used.

Return type:

bool

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

Writes settings to an XML element.

Parameters: