QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
QgsDiagramSettings Class Reference

Stores the settings for rendering a single diagram. More...

#include <qgsdiagramrenderer.h>

Public Types

enum  DiagramOrientation { Up , Down , Left , Right }
 Orientation of histogram. More...
 
enum  Direction { Clockwise , Counterclockwise }
 Angular directions. More...
 
enum  LabelPlacementMethod { Height , XHeight }
 
enum  StackedDiagramMode { Horizontal , Vertical }
 Orientation of the stacked diagrams. More...
 

Public Member Functions

 QgsDiagramSettings ()
 
 QgsDiagramSettings (const QgsDiagramSettings &other)
 
 ~QgsDiagramSettings ()
 
QgsLineSymbolaxisLineSymbol () const
 Returns the line symbol to use for rendering axis in diagrams.
 
Direction direction () const
 Returns the chart's angular direction.
 
QList< QgsLayerTreeModelLegendNode * > legendItems (QgsLayerTreeLayer *nodeLayer) const
 Returns list of legend nodes for the diagram.
 
QgsDiagramSettingsoperator= (const QgsDiagramSettings &other)
 
QgsPaintEffectpaintEffect () const
 Returns the paint effect to use while rendering diagrams.
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
 Reads diagram settings from XML.
 
void setAxisLineSymbol (QgsLineSymbol *symbol)
 Sets the line symbol to use for rendering axis in diagrams.
 
void setDirection (Direction direction)
 Sets the chart's angular direction.
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the paint effect to use while rendering diagrams.
 
void setShowAxis (bool showAxis)
 Sets whether the diagram axis should be shown.
 
void setSpacing (double spacing)
 Sets the spacing between diagram contents.
 
void setSpacingMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the content spacing.
 
void setSpacingUnit (Qgis::RenderUnit unit)
 Sets the unit for the content spacing.
 
void setStackedDiagramSpacing (double spacing)
 Sets the spacing between subdiagrams in a stacked diagram.
 
void setStackedDiagramSpacingMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the spacing between subdiagrams in a stacked diagram.
 
void setStackedDiagramSpacingUnit (Qgis::RenderUnit unit)
 Sets the unit for the spacing between subdiagrams in a stacked diagram.
 
bool showAxis () const
 Returns true if the diagram axis should be shown.
 
double spacing () const
 Returns the spacing between diagram contents.
 
const QgsMapUnitScalespacingMapUnitScale () const
 Returns the map unit scale for the content spacing.
 
Qgis::RenderUnit spacingUnit () const
 Returns the units for the content spacing.
 
double stackedDiagramSpacing () const
 Returns the spacing between subdiagrams in a stacked diagram.
 
const QgsMapUnitScalestackedDiagramSpacingMapUnitScale () const
 Returns the map unit scale for the spacing between subdiagrams in a stacked diagram.
 
Qgis::RenderUnit stackedDiagramSpacingUnit () const
 Returns the units for the spacing between subdiagrams in a stacked diagram.
 
void writeXml (QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
 Writes diagram settings to XML.
 

Public Attributes

QColor backgroundColor
 
double barWidth = 5.0
 
QList< QString > categoryAttributes
 
QList< QColor > categoryColors
 
QList< QString > categoryLabels
 
DiagramOrientation diagramOrientation = QgsDiagramSettings::Up
 
bool enabled = true
 
QFont font
 
LabelPlacementMethod labelPlacementMethod = QgsDiagramSettings::Height
 
QgsMapUnitScale lineSizeScale
 Line unit scale.
 
Qgis::RenderUnit lineSizeUnit = Qgis::RenderUnit::Millimeters
 Line unit index.
 
double maximumScale = 0
 The maximum map scale (i.e.
 
double minimumScale = 0
 The minimum map scale (i.e.
 
double minimumSize = 0.0
 Scale diagrams smaller than mMinimumSize to mMinimumSize.
 
double opacity = 1.0
 Opacity, from 0 (transparent) to 1.0 (opaque)
 
QColor penColor
 
double penWidth = 0.0
 
double rotationOffset = 270
 Rotation offset, in degrees clockwise from horizontal.
 
bool scaleBasedVisibility = false
 
bool scaleByArea = true
 
QSizeF size
 
QgsMapUnitScale sizeScale
 Diagram size unit scale.
 
Qgis::RenderUnit sizeType = Qgis::RenderUnit::Millimeters
 Diagram size unit.
 
StackedDiagramMode stackedDiagramMode = QgsDiagramSettings::Horizontal
 

Detailed Description

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.

Definition at line 362 of file qgsdiagramrenderer.h.

Member Enumeration Documentation

◆ DiagramOrientation

Orientation of histogram.

Enumerator
Up 
Down 
Left 
Right 

Definition at line 373 of file qgsdiagramrenderer.h.

◆ Direction

Angular directions.

Since
QGIS 3.12
Enumerator
Clockwise 

Clockwise orientation.

Counterclockwise 

Counter-clockwise orientation.

Definition at line 385 of file qgsdiagramrenderer.h.

◆ LabelPlacementMethod

Enumerator
Height 
XHeight 

Definition at line 366 of file qgsdiagramrenderer.h.

◆ StackedDiagramMode

Orientation of the stacked diagrams.

Since
QGIS 3.40
Enumerator
Horizontal 
Vertical 

Definition at line 395 of file qgsdiagramrenderer.h.

Constructor & Destructor Documentation

◆ QgsDiagramSettings() [1/2]

QgsDiagramSettings::QgsDiagramSettings ( )

Definition at line 1213 of file qgsdiagramrenderer.cpp.

◆ ~QgsDiagramSettings()

QgsDiagramSettings::~QgsDiagramSettings ( )
default

◆ QgsDiagramSettings() [2/2]

QgsDiagramSettings::QgsDiagramSettings ( const QgsDiagramSettings other)

Definition at line 1220 of file qgsdiagramrenderer.cpp.

Member Function Documentation

◆ axisLineSymbol()

QgsLineSymbol * QgsDiagramSettings::axisLineSymbol ( ) const

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

See also
setAxisLineSymbol()
showAxis()
Since
QGIS 3.12

Definition at line 1181 of file qgsdiagramrenderer.cpp.

◆ direction()

QgsDiagramSettings::Direction QgsDiagramSettings::direction ( ) const

Returns the chart's angular direction.

See also
setDirection()
Since
QGIS 3.12

Definition at line 1298 of file qgsdiagramrenderer.cpp.

◆ legendItems()

QList< QgsLayerTreeModelLegendNode * > QgsDiagramSettings::legendItems ( QgsLayerTreeLayer nodeLayer) const

Returns list of legend nodes for the diagram.

Note
caller is responsible for deletion of QgsLayerTreeModelLegendNodes

Definition at line 1168 of file qgsdiagramrenderer.cpp.

◆ operator=()

QgsDiagramSettings & QgsDiagramSettings::operator= ( const QgsDiagramSettings other)

Definition at line 1259 of file qgsdiagramrenderer.cpp.

◆ paintEffect()

QgsPaintEffect * QgsDiagramSettings::paintEffect ( ) const

Returns the paint effect to use while rendering diagrams.

See also
setPaintEffect()
Since
QGIS 3.12

Definition at line 1202 of file qgsdiagramrenderer.cpp.

◆ readXml()

void QgsDiagramSettings::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context = QgsReadWriteContext() 
)

Reads diagram settings from XML.

Definition at line 179 of file qgsdiagramrenderer.cpp.

◆ setAxisLineSymbol()

void QgsDiagramSettings::setAxisLineSymbol ( QgsLineSymbol symbol)

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

Ownership of symbol is transferred to the settings.

See also
axisLineSymbol()
setShowAxis()
Since
QGIS 3.12

Definition at line 1186 of file qgsdiagramrenderer.cpp.

◆ setDirection()

void QgsDiagramSettings::setDirection ( Direction  direction)

Sets the chart's angular direction.

See also
direction()
Since
QGIS 3.12

Definition at line 1303 of file qgsdiagramrenderer.cpp.

◆ setPaintEffect()

void QgsDiagramSettings::setPaintEffect ( QgsPaintEffect effect)

Sets the paint effect to use while rendering diagrams.

Ownership of effect is transferred to the settings.

See also
paintEffect()
Since
QGIS 3.12

Definition at line 1207 of file qgsdiagramrenderer.cpp.

◆ setShowAxis()

void QgsDiagramSettings::setShowAxis ( bool  showAxis)

Sets whether the diagram axis should be shown.

See also
showAxis()
setAxisLineSymbol()
Since
QGIS 3.12

Definition at line 1197 of file qgsdiagramrenderer.cpp.

◆ setSpacing()

void QgsDiagramSettings::setSpacing ( double  spacing)
inline

Sets the spacing between diagram contents.

Spacing units are set via setSpacingUnit().

See also
spacing()
setSpacingUnit()
setSpacingMapUnitScale()
Since
QGIS 3.12

Definition at line 497 of file qgsdiagramrenderer.h.

◆ setSpacingMapUnitScale()

void QgsDiagramSettings::setSpacingMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for the content spacing.

See also
spacingMapUnitScale()
setSpacing()
setSpacingUnit()
Since
QGIS 3.12

Definition at line 526 of file qgsdiagramrenderer.h.

◆ setSpacingUnit()

void QgsDiagramSettings::setSpacingUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the content spacing.

See also
spacingUnit()
setSpacing()
setSpacingMapUnitScale()
Since
QGIS 3.12

Definition at line 507 of file qgsdiagramrenderer.h.

◆ setStackedDiagramSpacing()

void QgsDiagramSettings::setStackedDiagramSpacing ( double  spacing)
inline

Sets the spacing between subdiagrams in a stacked diagram.

Spacing units are set via setStackedDiagramSpacingUnit().

See also
stackedDiagramSpacing()
setStackedDiagramSpacingUnit()
setStackedDiagramSpacingMapUnitScale()
Since
QGIS 3.40

Definition at line 562 of file qgsdiagramrenderer.h.

◆ setStackedDiagramSpacingMapUnitScale()

void QgsDiagramSettings::setStackedDiagramSpacingMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for the spacing between subdiagrams in a stacked diagram.

See also
stackedDiagramSpacingMapUnitScale()
setStackedDiagramSpacing()
setStackedDiagramSpacingUnit()
Since
QGIS 3.40

Definition at line 592 of file qgsdiagramrenderer.h.

◆ setStackedDiagramSpacingUnit()

void QgsDiagramSettings::setStackedDiagramSpacingUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the spacing between subdiagrams in a stacked diagram.

See also
stackedDiagramSpacingUnit()
setStackedDiagramSpacing()
setStackedDiagramSpacingMapUnitScale()
Since
QGIS 3.40

Definition at line 572 of file qgsdiagramrenderer.h.

◆ showAxis()

bool QgsDiagramSettings::showAxis ( ) const

Returns true if the diagram axis should be shown.

See also
setShowAxis()
axisLineSymbol()
Since
QGIS 3.12

Definition at line 1192 of file qgsdiagramrenderer.cpp.

◆ spacing()

double QgsDiagramSettings::spacing ( ) const
inline

Returns the spacing between diagram contents.

Spacing units can be retrieved by calling spacingUnit().

See also
setSpacing()
spacingUnit()
spacingMapUnitScale()
Since
QGIS 3.12

Definition at line 484 of file qgsdiagramrenderer.h.

◆ spacingMapUnitScale()

const QgsMapUnitScale & QgsDiagramSettings::spacingMapUnitScale ( ) const
inline

Returns the map unit scale for the content spacing.

See also
setSpacingMapUnitScale()
spacing()
spacingUnit()
Since
QGIS 3.12

Definition at line 536 of file qgsdiagramrenderer.h.

◆ spacingUnit()

Qgis::RenderUnit QgsDiagramSettings::spacingUnit ( ) const
inline

Returns the units for the content spacing.

See also
setSpacingUnit()
spacing()
spacingMapUnitScale()
Since
QGIS 3.12

Definition at line 516 of file qgsdiagramrenderer.h.

◆ stackedDiagramSpacing()

double QgsDiagramSettings::stackedDiagramSpacing ( ) const
inline

Returns the spacing between subdiagrams in a stacked diagram.

Spacing units can be retrieved by calling stackedDiagramSpacingUnit().

See also
setStackedDiagramSpacing()
stackedDiagramSpacingUnit()
stackedDiagramSpacingMapUnitScale()
Since
QGIS 3.40

Definition at line 549 of file qgsdiagramrenderer.h.

◆ stackedDiagramSpacingMapUnitScale()

const QgsMapUnitScale & QgsDiagramSettings::stackedDiagramSpacingMapUnitScale ( ) const
inline

Returns the map unit scale for the spacing between subdiagrams in a stacked diagram.

See also
setStackedDiagramSpacingMapUnitScale();
stackedDiagramSpacing()
stackedDiagramSpacingUnit()
Since
QGIS 3.40

Definition at line 602 of file qgsdiagramrenderer.h.

◆ stackedDiagramSpacingUnit()

Qgis::RenderUnit QgsDiagramSettings::stackedDiagramSpacingUnit ( ) const
inline

Returns the units for the spacing between subdiagrams in a stacked diagram.

See also
setStackedDiagramSpacingUnit()
stackedDiagramSpacing()
stackedDiagramSpacingMapUnitScale()
Since
QGIS 3.40

Definition at line 582 of file qgsdiagramrenderer.h.

◆ writeXml()

void QgsDiagramSettings::writeXml ( QDomElement &  rendererElem,
QDomDocument &  doc,
const QgsReadWriteContext context = QgsReadWriteContext() 
) const

Writes diagram settings to XML.

Definition at line 362 of file qgsdiagramrenderer.cpp.

Member Data Documentation

◆ backgroundColor

QColor QgsDiagramSettings::backgroundColor

Definition at line 434 of file qgsdiagramrenderer.h.

◆ barWidth

double QgsDiagramSettings::barWidth = 5.0

Definition at line 440 of file qgsdiagramrenderer.h.

◆ categoryAttributes

QList< QString > QgsDiagramSettings::categoryAttributes

Definition at line 410 of file qgsdiagramrenderer.h.

◆ categoryColors

QList< QColor > QgsDiagramSettings::categoryColors

Definition at line 409 of file qgsdiagramrenderer.h.

◆ categoryLabels

QList< QString > QgsDiagramSettings::categoryLabels

Definition at line 411 of file qgsdiagramrenderer.h.

◆ diagramOrientation

DiagramOrientation QgsDiagramSettings::diagramOrientation = QgsDiagramSettings::Up

Definition at line 438 of file qgsdiagramrenderer.h.

◆ enabled

bool QgsDiagramSettings::enabled = true

Definition at line 407 of file qgsdiagramrenderer.h.

◆ font

QFont QgsDiagramSettings::font

Definition at line 408 of file qgsdiagramrenderer.h.

◆ labelPlacementMethod

LabelPlacementMethod QgsDiagramSettings::labelPlacementMethod = QgsDiagramSettings::Height

Definition at line 437 of file qgsdiagramrenderer.h.

◆ lineSizeScale

QgsMapUnitScale QgsDiagramSettings::lineSizeScale

Line unit scale.

Definition at line 432 of file qgsdiagramrenderer.h.

◆ lineSizeUnit

Qgis::RenderUnit QgsDiagramSettings::lineSizeUnit = Qgis::RenderUnit::Millimeters

Line unit index.

Definition at line 427 of file qgsdiagramrenderer.h.

◆ maximumScale

double QgsDiagramSettings::maximumScale = 0

The maximum map scale (i.e.

most "zoomed in" scale) at which the diagrams will be visible. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

See also
minimumScale

Definition at line 460 of file qgsdiagramrenderer.h.

◆ minimumScale

double QgsDiagramSettings::minimumScale = 0

The minimum map scale (i.e.

most "zoomed out" scale) at which the diagrams will be visible. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

See also
maximumScale

Definition at line 468 of file qgsdiagramrenderer.h.

◆ minimumSize

double QgsDiagramSettings::minimumSize = 0.0

Scale diagrams smaller than mMinimumSize to mMinimumSize.

Definition at line 471 of file qgsdiagramrenderer.h.

◆ opacity

double QgsDiagramSettings::opacity = 1.0

Opacity, from 0 (transparent) to 1.0 (opaque)

Definition at line 443 of file qgsdiagramrenderer.h.

◆ penColor

QColor QgsDiagramSettings::penColor

Definition at line 435 of file qgsdiagramrenderer.h.

◆ penWidth

double QgsDiagramSettings::penWidth = 0.0

Definition at line 436 of file qgsdiagramrenderer.h.

◆ rotationOffset

double QgsDiagramSettings::rotationOffset = 270

Rotation offset, in degrees clockwise from horizontal.

Definition at line 450 of file qgsdiagramrenderer.h.

◆ scaleBasedVisibility

bool QgsDiagramSettings::scaleBasedVisibility = false

Definition at line 452 of file qgsdiagramrenderer.h.

◆ scaleByArea

bool QgsDiagramSettings::scaleByArea = true

Definition at line 445 of file qgsdiagramrenderer.h.

◆ size

QSizeF QgsDiagramSettings::size

Definition at line 412 of file qgsdiagramrenderer.h.

◆ sizeScale

QgsMapUnitScale QgsDiagramSettings::sizeScale

Diagram size unit scale.

Definition at line 422 of file qgsdiagramrenderer.h.

◆ sizeType

Qgis::RenderUnit QgsDiagramSettings::sizeType = Qgis::RenderUnit::Millimeters

Diagram size unit.

Definition at line 417 of file qgsdiagramrenderer.h.

◆ stackedDiagramMode

StackedDiagramMode QgsDiagramSettings::stackedDiagramMode = QgsDiagramSettings::Horizontal

Definition at line 439 of file qgsdiagramrenderer.h.


The documentation for this class was generated from the following files: