QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
Qgs2DPlot Class Reference

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

#include <qgsplot.h>

Inheritance diagram for Qgs2DPlot:
Inheritance graph
[legend]

Public Member Functions

 Qgs2DPlot ()
 Constructor for Qgs2DPlot. More...
 
 Qgs2DPlot (const Qgs2DPlot &other)=delete
 Qgs2DPlot cannot be copied. More...
 
 ~Qgs2DPlot () override
 
void calculateOptimisedIntervals (QgsRenderContext &context)
 Automatically sets the grid and label intervals to optimal values for display in the given render context. More...
 
QgsFillSymbolchartBackgroundSymbol ()
 Returns the fill symbol used to render the background of the chart. More...
 
QgsFillSymbolchartBorderSymbol ()
 Returns the symbol used to render the border of the chart. More...
 
QRectF interiorPlotArea (QgsRenderContext &context) 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). More...
 
const QgsMarginsmargins () const
 Returns the margins of the plot area (in millimeters) More...
 
Qgs2DPlotoperator= (const Qgs2DPlot &other)=delete
 Qgs2DPlot cannot be copied. More...
 
bool readXml (const QDomElement &element, QgsReadWriteContext &context) override
 Reads the plot's properties from an XML element. More...
 
void render (QgsRenderContext &context)
 Renders the plot. More...
 
virtual void renderContent (QgsRenderContext &context, const QRectF &plotArea)
 Renders the plot content. More...
 
void setChartBackgroundSymbol (QgsFillSymbol *symbol)
 Sets the fill symbol used to render the background of the chart. More...
 
void setChartBorderSymbol (QgsFillSymbol *symbol)
 Sets the symbol used to render the border of the chart. More...
 
void setMargins (const QgsMargins &margins)
 Sets the margins of the plot area (in millimeters) More...
 
void setSize (QSizeF size)
 Sets the overall size of the plot (including titles and over components which sit outside the plot area). More...
 
void setXMaximum (double maximum)
 Sets the maximum value of the x axis. More...
 
void setXMinimum (double minimum)
 Sets the minimum value of the x axis. More...
 
void setYMaximum (double maximum)
 Sets the maximum value of the y axis. More...
 
void setYMinimum (double minimum)
 Sets the minimum value of the y axis. More...
 
QSizeF size () const
 Returns the overall size of the plot (in millimeters) (including titles and other components which sit outside the plot area). More...
 
bool writeXml (QDomElement &element, QDomDocument &document, QgsReadWriteContext &context) const override
 Writes the plot's properties into an XML element. More...
 
QgsPlotAxisxAxis ()
 Returns a reference to the plot's x axis. More...
 
const QgsPlotAxisxAxis () const
 Returns a reference to the plot's x axis. More...
 
double xMaximum () const
 Returns the maximum value of the x axis. More...
 
double xMinimum () const
 Returns the minimum value of the x axis. More...
 
QgsPlotAxisyAxis ()
 Returns a reference to the plot's y axis. More...
 
const QgsPlotAxisyAxis () const
 Returns a reference to the plot's y axis. More...
 
double yMaximum () const
 Returns the maximum value of the y axis. More...
 
double yMinimum () const
 Returns the minimum value of the y axis. More...
 
- Public Member Functions inherited from QgsPlot
 QgsPlot ()=default
 Constructor for QgsPlot. More...
 
virtual ~QgsPlot ()
 
virtual bool readXml (const QDomElement &element, QgsReadWriteContext &context)
 Reads the plot's properties from an XML element. More...
 
virtual bool writeXml (QDomElement &element, QDomDocument &document, QgsReadWriteContext &context) const
 Writes the plot's properties into an XML element. More...
 

Detailed Description

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

The base class is responsible for rendering the axis, grid lines and chart area. Subclasses can implement the renderContent() method to render their actual plot content.

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

Definition at line 234 of file qgsplot.h.

Constructor & Destructor Documentation

◆ Qgs2DPlot() [1/2]

Qgs2DPlot::Qgs2DPlot ( )

Constructor for Qgs2DPlot.

Definition at line 151 of file qgsplot.cpp.

◆ ~Qgs2DPlot()

Qgs2DPlot::~Qgs2DPlot ( )
overridedefault

◆ Qgs2DPlot() [2/2]

Qgs2DPlot::Qgs2DPlot ( const Qgs2DPlot other)
delete

Qgs2DPlot cannot be copied.

Member Function Documentation

◆ calculateOptimisedIntervals()

void Qgs2DPlot::calculateOptimisedIntervals ( QgsRenderContext context)

Automatically sets the grid and label intervals to optimal values for display in the given render context.

Intervals will be calculated in order to avoid overlapping axis labels and to ensure round values are shown.

Definition at line 434 of file qgsplot.cpp.

◆ chartBackgroundSymbol()

QgsFillSymbol * Qgs2DPlot::chartBackgroundSymbol ( )

Returns the fill symbol used to render the background of the chart.

See also
setChartBackgroundSymbol()

Definition at line 560 of file qgsplot.cpp.

◆ chartBorderSymbol()

QgsFillSymbol * Qgs2DPlot::chartBorderSymbol ( )

Returns the symbol used to render the border of the chart.

See also
setChartBorderSymbol()

Definition at line 570 of file qgsplot.cpp.

◆ interiorPlotArea()

QRectF Qgs2DPlot::interiorPlotArea ( QgsRenderContext context) 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).

Definition at line 385 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 580 of file qgsplot.cpp.

◆ operator=()

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

Qgs2DPlot cannot be copied.

◆ readXml()

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

Reads the plot's properties from an XML element.

Reimplemented from QgsPlot.

Definition at line 190 of file qgsplot.cpp.

◆ render()

void Qgs2DPlot::render ( QgsRenderContext context)

Renders the plot.

Definition at line 214 of file qgsplot.cpp.

◆ renderContent()

void Qgs2DPlot::renderContent ( QgsRenderContext context,
const QRectF &  plotArea 
)
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.

Definition at line 368 of file qgsplot.cpp.

◆ setChartBackgroundSymbol()

void Qgs2DPlot::setChartBackgroundSymbol ( QgsFillSymbol symbol)

Sets the fill symbol used to render the background of the chart.

Ownership of symbol is transferred to the plot.

See also
chartBackgroundSymbol()

Definition at line 565 of file qgsplot.cpp.

◆ setChartBorderSymbol()

void Qgs2DPlot::setChartBorderSymbol ( QgsFillSymbol symbol)

Sets the symbol used to render the border of the chart.

Ownership of symbol is transferred to the plot.

See also
chartBorderSymbol()

Definition at line 575 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 585 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 380 of file qgsplot.cpp.

◆ setXMaximum()

void Qgs2DPlot::setXMaximum ( double  maximum)
inline

Sets the maximum value of the x axis.

See also
xMaximum()

Definition at line 340 of file qgsplot.h.

◆ setXMinimum()

void Qgs2DPlot::setXMinimum ( double  minimum)
inline

Sets the minimum value of the x axis.

See also
xMinimum()

Definition at line 312 of file qgsplot.h.

◆ setYMaximum()

void Qgs2DPlot::setYMaximum ( double  maximum)
inline

Sets the maximum value of the y axis.

See also
yMaximum()

Definition at line 354 of file qgsplot.h.

◆ setYMinimum()

void Qgs2DPlot::setYMinimum ( double  minimum)
inline

Sets the minimum value of the y axis.

See also
yMinimum()

Definition at line 326 of file qgsplot.h.

◆ 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 375 of file qgsplot.cpp.

◆ writeXml()

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

Writes the plot's properties into an XML element.

Reimplemented from QgsPlot.

Definition at line 162 of file qgsplot.cpp.

◆ xAxis() [1/2]

QgsPlotAxis & Qgs2DPlot::xAxis ( )
inline

Returns a reference to the plot's x axis.

See also
yAxis()

Definition at line 361 of file qgsplot.h.

◆ xAxis() [2/2]

const QgsPlotAxis & Qgs2DPlot::xAxis ( ) const
inline

Returns a reference to the plot's x axis.

See also
yAxis()

Definition at line 368 of file qgsplot.h.

◆ xMaximum()

double Qgs2DPlot::xMaximum ( ) const
inline

Returns the maximum value of the x axis.

See also
setXMaximum()

Definition at line 333 of file qgsplot.h.

◆ xMinimum()

double Qgs2DPlot::xMinimum ( ) const
inline

Returns the minimum value of the x axis.

See also
setXMinimum()

Definition at line 305 of file qgsplot.h.

◆ yAxis() [1/2]

QgsPlotAxis & Qgs2DPlot::yAxis ( )
inline

Returns a reference to the plot's y axis.

See also
xAxis()

Definition at line 375 of file qgsplot.h.

◆ yAxis() [2/2]

const QgsPlotAxis & Qgs2DPlot::yAxis ( ) const
inline

Returns a reference to the plot's y axis.

See also
xAxis()

Definition at line 383 of file qgsplot.h.

◆ yMaximum()

double Qgs2DPlot::yMaximum ( ) const
inline

Returns the maximum value of the y axis.

See also
setYMaximum()

Definition at line 347 of file qgsplot.h.

◆ yMinimum()

double Qgs2DPlot::yMinimum ( ) const
inline

Returns the minimum value of the y axis.

See also
setYMinimum()

Definition at line 319 of file qgsplot.h.


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