QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
Qgs2DPlot Class Reference

Base class for 2-dimensional plot/chart/graphs. More...

#include <qgsplot.h>

Inheritance diagram for Qgs2DPlot:

Public Member Functions

 Qgs2DPlot ()
 Constructor for Qgs2DPlot.
 Qgs2DPlot (const Qgs2DPlot &other)=delete
 ~Qgs2DPlot () override
virtual QRectF interiorPlotArea (QgsRenderContext &context, QgsPlotRenderContext &plotContext) const
 Returns the area of the plot which corresponds to the actual plot content (excluding all titles and other components which sit outside the plot area).
const QgsMarginsmargins () const
 Returns the margins of the plot area (in millimeters).
Qgs2DPlotoperator= (const Qgs2DPlot &other)=delete
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the plot's properties from an XML element.
virtual void render (QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QgsPlotData &plotData=QgsPlotData())
 Renders the plot.
virtual void renderContent (QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QRectF &plotArea, const QgsPlotData &plotData=QgsPlotData())
 Renders the plot content.
void setMargins (const QgsMargins &margins)
 Sets the margins of the plot area (in millimeters).
void setSize (QSizeF size)
 Sets the overall size of the plot (including titles and over components which sit outside the plot area).
QSizeF size () const
 Returns the overall size of the plot (in millimeters) (including titles and other components which sit outside the plot area).
bool writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
 Writes the plot's properties into an XML element.
Public Member Functions inherited from QgsPlot
 QgsPlot ()=default
virtual ~QgsPlot ()
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the plot's property collection, used for data defined overrides.
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the plot's property collection, used for data defined overrides.
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the plot's property collection, used for data defined overrides.
void setDataDefinedProperty (DataDefinedProperty key, const QgsProperty &property)
 Sets a data defined property for the plot.
virtual QString type () const
 Returns the plot's type.

Protected Member Functions

void applyDataDefinedProperties (QgsRenderContext &context, QgsMargins &margins) const
 Applies 2D plot data-defined properties.

Friends

class Qgs2DXyPlot

Additional Inherited Members

Public Types inherited from QgsPlot
enum class  DataDefinedProperty : int {
  MarginLeft , MarginTop , MarginRight , MarginBottom ,
  XAxisMajorInterval , XAxisMinorInterval , XAxisLabelInterval , YAxisMajorInterval ,
  YAxisMinorInterval , YAxisLabelInterval , XAxisMinimum , XAxisMaximum ,
  YAxisMinimum , YAxisMaximum
}
 Data defined properties for different plot types. More...
Static Public Member Functions inherited from QgsPlot
static const QgsPropertiesDefinitionpropertyDefinitions ()
 Returns the plot property definitions.
Protected Attributes inherited from QgsPlot
QgsPropertyCollection mDataDefinedProperties

Detailed Description

Base class for 2-dimensional plot/chart/graphs.

Warning
This class is not considered stable API, and may change in future!
Since
QGIS 3.26

Definition at line 561 of file qgsplot.h.

Constructor & Destructor Documentation

◆ Qgs2DPlot() [1/2]

Qgs2DPlot::Qgs2DPlot ( )

Constructor for Qgs2DPlot.

Definition at line 229 of file qgsplot.cpp.

◆ ~Qgs2DPlot()

Qgs2DPlot::~Qgs2DPlot ( )
overridedefault

◆ Qgs2DPlot() [2/2]

Qgs2DPlot::Qgs2DPlot ( const Qgs2DPlot & other)
delete

Member Function Documentation

◆ applyDataDefinedProperties()

void Qgs2DPlot::applyDataDefinedProperties ( QgsRenderContext & context,
QgsMargins & margins ) const
protected

Applies 2D plot data-defined properties.

Definition at line 302 of file qgsplot.cpp.

◆ interiorPlotArea()

QRectF Qgs2DPlot::interiorPlotArea ( QgsRenderContext & context,
QgsPlotRenderContext & plotContext ) const
virtual

Returns the area of the plot which corresponds to the actual plot content (excluding all titles and other components which sit outside the plot area).

Reimplemented in Qgs2DXyPlot.

Definition at line 279 of file qgsplot.cpp.

◆ margins()

const QgsMargins & Qgs2DPlot::margins ( ) const

Returns the margins of the plot area (in millimeters).

See also
setMargins()

Definition at line 292 of file qgsplot.cpp.

◆ operator=()

Qgs2DPlot & Qgs2DPlot::operator= ( const Qgs2DPlot & other)
delete

◆ readXml()

bool Qgs2DPlot::readXml ( const QDomElement & element,
const QgsReadWriteContext & context )
overridevirtual

Reads the plot's properties from an XML element.

Reimplemented from QgsPlot.

Reimplemented in Qgs2DXyPlot, QgsBarChartPlot, QgsLineChartPlot, and QgsPieChartPlot.

Definition at line 243 of file qgsplot.cpp.

◆ render()

void Qgs2DPlot::render ( QgsRenderContext & context,
QgsPlotRenderContext & plotContext,
const QgsPlotData & plotData = QgsPlotData() )
virtual

Renders the plot.

Reimplemented in Qgs2DXyPlot.

Definition at line 252 of file qgsplot.cpp.

◆ renderContent()

void Qgs2DPlot::renderContent ( QgsRenderContext & context,
QgsPlotRenderContext & plotContext,
const QRectF & plotArea,
const QgsPlotData & plotData = QgsPlotData() )
virtual

Renders the plot content.

Subclasses can implement this method to render the actual plot content (e.g. bar charts, scatter plots). This method will be called after the chart background and grid are rendered, but before the chart border is rendered.

The default implementation does nothing.

The plotArea argument specifies that area of the plot which corresponds to the actual plot content. Implementations should take care to scale values accordingly to render points correctly inside this plot area.

Reimplemented in QgsBarChartPlot, QgsLineChartPlot, and QgsPieChartPlot.

Definition at line 263 of file qgsplot.cpp.

◆ setMargins()

void Qgs2DPlot::setMargins ( const QgsMargins & margins)

Sets the margins of the plot area (in millimeters).

See also
setMargins()

Definition at line 297 of file qgsplot.cpp.

◆ setSize()

void Qgs2DPlot::setSize ( QSizeF size)

Sets the overall size of the plot (including titles and over components which sit outside the plot area).

See also
size()

Definition at line 274 of file qgsplot.cpp.

◆ size()

QSizeF Qgs2DPlot::size ( ) const

Returns the overall size of the plot (in millimeters) (including titles and other components which sit outside the plot area).

See also
setSize()

Definition at line 269 of file qgsplot.cpp.

◆ writeXml()

bool Qgs2DPlot::writeXml ( QDomElement & element,
QDomDocument & document,
const QgsReadWriteContext & context ) const
overridevirtual

Writes the plot's properties into an XML element.

Reimplemented from QgsPlot.

Reimplemented in Qgs2DXyPlot, QgsBarChartPlot, QgsLineChartPlot, and QgsPieChartPlot.

Definition at line 234 of file qgsplot.cpp.

◆ Qgs2DXyPlot

friend class Qgs2DXyPlot
friend

Definition at line 644 of file qgsplot.h.


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