QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
Base class for 2-dimensional plot/chart/graphs. More...
#include <qgsplot.h>
Public Member Functions | |
Qgs2DPlot () | |
Constructor for Qgs2DPlot. | |
Qgs2DPlot (const Qgs2DPlot &other)=delete | |
Qgs2DPlot cannot be copied. | |
~Qgs2DPlot () override | |
void | calculateOptimisedIntervals (QgsRenderContext &context) |
Automatically sets the grid and label intervals to optimal values for display in the given render context. | |
QgsFillSymbol * | chartBackgroundSymbol () |
Returns the fill symbol used to render the background of the chart. | |
QgsFillSymbol * | chartBorderSymbol () |
Returns the symbol used to render the border of the chart. | |
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). | |
const QgsMargins & | margins () const |
Returns the margins of the plot area (in millimeters) | |
Qgs2DPlot & | operator= (const Qgs2DPlot &other)=delete |
Qgs2DPlot cannot be copied. | |
bool | readXml (const QDomElement &element, const QgsReadWriteContext &context) override |
Reads the plot's properties from an XML element. | |
void | render (QgsRenderContext &context) |
Renders the plot. | |
virtual void | renderContent (QgsRenderContext &context, const QRectF &plotArea) |
Renders the plot content. | |
void | setChartBackgroundSymbol (QgsFillSymbol *symbol) |
Sets the fill symbol used to render the background of the chart. | |
void | setChartBorderSymbol (QgsFillSymbol *symbol) |
Sets the symbol used to render the border of the chart. | |
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). | |
void | setXMaximum (double maximum) |
Sets the maximum value of the x axis. | |
void | setXMinimum (double minimum) |
Sets the minimum value of the x axis. | |
void | setYMaximum (double maximum) |
Sets the maximum value of the y axis. | |
void | setYMinimum (double minimum) |
Sets the minimum value of the y axis. | |
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. | |
QgsPlotAxis & | xAxis () |
Returns a reference to the plot's x axis. | |
const QgsPlotAxis & | xAxis () const |
Returns a reference to the plot's x axis. | |
double | xMaximum () const |
Returns the maximum value of the x axis. | |
double | xMinimum () const |
Returns the minimum value of the x axis. | |
QgsPlotAxis & | yAxis () |
Returns a reference to the plot's y axis. | |
const QgsPlotAxis & | yAxis () const |
Returns a reference to the plot's y axis. | |
double | yMaximum () const |
Returns the maximum value of the y axis. | |
double | yMinimum () const |
Returns the minimum value of the y axis. | |
Public Member Functions inherited from QgsPlot | |
QgsPlot ()=default | |
Constructor for QgsPlot. | |
virtual | ~QgsPlot () |
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.
Qgs2DPlot::Qgs2DPlot | ( | ) |
Constructor for Qgs2DPlot.
Definition at line 169 of file qgsplot.cpp.
|
overridedefault |
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 599 of file qgsplot.cpp.
QgsFillSymbol * Qgs2DPlot::chartBackgroundSymbol | ( | ) |
Returns the fill symbol used to render the background of the chart.
Definition at line 734 of file qgsplot.cpp.
QgsFillSymbol * Qgs2DPlot::chartBorderSymbol | ( | ) |
Returns the symbol used to render the border of the chart.
Definition at line 744 of file qgsplot.cpp.
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 487 of file qgsplot.cpp.
const QgsMargins & Qgs2DPlot::margins | ( | ) | const |
Returns the margins of the plot area (in millimeters)
Definition at line 754 of file qgsplot.cpp.
|
overridevirtual |
Reads the plot's properties from an XML element.
Reimplemented from QgsPlot.
Definition at line 205 of file qgsplot.cpp.
void Qgs2DPlot::render | ( | QgsRenderContext & | context | ) |
Renders the plot.
Definition at line 229 of file qgsplot.cpp.
|
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 470 of file qgsplot.cpp.
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.
Definition at line 739 of file qgsplot.cpp.
void Qgs2DPlot::setChartBorderSymbol | ( | QgsFillSymbol * | symbol | ) |
Sets the symbol used to render the border of the chart.
Ownership of symbol is transferred to the plot.
Definition at line 749 of file qgsplot.cpp.
void Qgs2DPlot::setMargins | ( | const QgsMargins & | margins | ) |
Sets the margins of the plot area (in millimeters)
Definition at line 759 of file qgsplot.cpp.
void Qgs2DPlot::setSize | ( | QSizeF | size | ) |
Sets the overall size of the plot (including titles and over components which sit outside the plot area).
Definition at line 482 of file qgsplot.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
QSizeF Qgs2DPlot::size | ( | ) | const |
Returns the overall size of the plot (in millimeters) (including titles and other components which sit outside the plot area).
Definition at line 477 of file qgsplot.cpp.
|
overridevirtual |
Writes the plot's properties into an XML element.
Reimplemented from QgsPlot.
Definition at line 177 of file qgsplot.cpp.
|
inline |
|
inline |
|
inline |
Returns the maximum value of the x axis.
|
inline |
Returns the minimum value of the x axis.
|
inline |
|
inline |
|
inline |
Returns the maximum value of the y axis.
|
inline |
Returns the minimum value of the y axis.