Class: Qgs2DXyPlot

Base class for 2-dimensional plot/chart/graphs with an X and Y axes.

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!

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.core.Qgs2DXyPlot

Base classes

Qgs2DPlot

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

QgsPlot

Base class for plot/chart/graphs.

Subclasses

QgsBarChartPlot

A simple bar chart class.

QgsLineChartPlot

A simple line chart class.

Methods

calculateOptimisedIntervals

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

chartBackgroundSymbol

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

chartBorderSymbol

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

setChartBackgroundSymbol

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

setChartBorderSymbol

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

setXMaximum

Sets the maximum value of the x axis.

setXMinimum

Sets the minimum value of the x axis.

setYMaximum

Sets the maximum value of the y axis.

setYMinimum

Sets the minimum value of the y axis.

xAxis

Returns a reference to the plot's x axis.

xMaximum

Returns the maximum value of the x axis.

xMinimum

Returns the minimum value of the x axis.

yAxis

Returns a reference to the plot's y axis.

yMaximum

Returns the maximum value of the y axis.

yMinimum

Returns the minimum value of the y axis.

class qgis.core.Qgs2DXyPlot[source]

Bases: Qgs2DPlot

__init__()

Constructor for Qgs2DXyPlot.

calculateOptimisedIntervals(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext)[source]

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.

Parameters:
chartBackgroundSymbol(self) QgsFillSymbol | None[source]

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

Return type:

Optional[QgsFillSymbol]

chartBorderSymbol(self) QgsFillSymbol | None[source]

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

Return type:

Optional[QgsFillSymbol]

setChartBackgroundSymbol(self, symbol: QgsFillSymbol | None)[source]

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

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsFillSymbol])

setChartBorderSymbol(self, symbol: QgsFillSymbol | None)[source]

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

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsFillSymbol])

setXMaximum(self, maximum: float)[source]

Sets the maximum value of the x axis.

See also

xMaximum()

Parameters:

maximum (float)

setXMinimum(self, minimum: float)[source]

Sets the minimum value of the x axis.

See also

xMinimum()

Parameters:

minimum (float)

setYMaximum(self, maximum: float)[source]

Sets the maximum value of the y axis.

See also

yMaximum()

Parameters:

maximum (float)

setYMinimum(self, minimum: float)[source]

Sets the minimum value of the y axis.

See also

yMinimum()

Parameters:

minimum (float)

xAxis(self) QgsPlotAxis

Returns a reference to the plot’s x axis.

See also

yAxis()

Return type:

QgsPlotAxis

xMaximum(self) float[source]

Returns the maximum value of the x axis.

See also

setXMaximum()

Return type:

float

xMinimum(self) float[source]

Returns the minimum value of the x axis.

See also

setXMinimum()

Return type:

float

yAxis(self) QgsPlotAxis

Returns a reference to the plot’s y axis.

See also

xAxis()

Return type:

QgsPlotAxis

yMaximum(self) float[source]

Returns the maximum value of the y axis.

See also

setYMaximum()

Return type:

float

yMinimum(self) float[source]

Returns the minimum value of the y axis.

See also

setYMinimum()

Return type:

float