Class: QgsLayoutItemChart¶
A layout item subclass that renders chart plots.
Added in version 4.0.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Base class for graphical items within a |
|
A base class for objects which belong to a layout. |
|
Abstract interface for generating an expression context. |
|
Interface for layout objects which support undo/redo commands. |
Classes
Chart series details covering all supported series types. |
Methods
Returns |
|
Returns |
|
Returns the layout map to use to limit the series' use of features. |
|
Returns the plot used to render the chart. |
|
Returns the plot series details used to generate the plot data. |
|
Sets the series to only use features which are visible in a map item. |
|
Sets series to only use features which intersect the current atlas feature. |
|
Sets a layout map to use to limit the series' use of features. |
|
Sets the plot used to render the chart. |
|
Sets the plot series details used to generate the plot data. |
|
Sets whether features should be sorted in an ascending order when iterating through the vector layer from which the plot data will be gathered from. |
|
Sets the expression used to sort features when iterating through the vector layer from which the plot data will be gathered from. |
|
Sets whether features should be sorted when iterating through the vector layer from which the plot data will be gathered from. |
|
Sets the source vector layer from which the plot data will be gathered from. |
|
Returns |
|
Returns the expression used to sort features when iterating through the vector layer from which the plot data will be gathered from. |
|
Returns |
|
Returns the source vector layer from which the plot data will be gathered from. |
Static Methods
Returns a new chart item for the specified layout. |
- class qgis.core.QgsLayoutItemChart[source]¶
Bases:
QgsLayoutItem- __init__(layout: QgsLayout | None)
Constructor for QgsLayoutItemChart, with the specified parent
layout.
- class SeriesDetails[source]¶
Bases:
objectChart series details covering all supported series types.
Note
this class is experimental and therefore is not considered as stable API, it may change in the future as more chart plot types are implemented.
Added in version 4.0.
- __init__(name: str | None = '')
Constructor for SeriesDetails with an optional
nameparameter to provide a name string to the series.- Parameters:
name (Optional[str] = '')
- __init__(a0: QgsLayoutItemChart.SeriesDetails)
- Parameters:
- filterExpression(self) str[source]¶
Returns the filter expression used to generate a series against a subset of the source layer.
- Return type:
str
- setFilterExpression(self, filterExpression: str | None)[source]¶
Sets the filter expression used to generate a series against a subset of the source layer.
- Parameters:
filterExpression (Optional[str])
- setXExpression(self, xExpression: str | None)[source]¶
Sets the expression used to generate X-axis values. If the associated chart X axis type is set to
Qgis.PlotAxisType.Categorical, the generated values will be converted to strings. ForQgis.PlotAxisType.Interval, the generated values will be converted to double.- Parameters:
xExpression (Optional[str])
- setYExpression(self, yExpression: str | None)[source]¶
Sets the expression used to generate Y-axis values. The generated values will be converted to double.
- Parameters:
yExpression (Optional[str])
- xExpression(self) str[source]¶
Returns the expression used to generate X-axis values. If the associated chart X axis type is set to
Qgis.PlotAxisType.Categorical, the generated values will be converted to strings. ForQgis.PlotAxisType.Interval, the generated values will be converted to double.- Return type:
str
- static create(layout: QgsLayout | None) QgsLayoutItemChart | None[source]¶
Returns a new chart item for the specified
layout.The caller takes responsibility for deleting the returned object.
- Parameters:
- Return type:
- filterOnlyVisibleFeatures(self) bool[source]¶
Returns
Trueif the series are set to use only features visible on a corresponding map item.See also
See also
- Return type:
bool
- filterToAtlasFeature(self) bool[source]¶
Returns
Trueif the series are set to only show features which intersect the current atlas feature.See also
- Return type:
bool
- map(self) QgsLayoutItemMap | None[source]¶
Returns the layout
mapto use to limit the series’ use of features. This setting only has an effect if setFilterOnlyVisibleFeatures is set toTrue.See also
See also
- Return type:
- seriesList(self) list[QgsLayoutItemChart.SeriesDetails]¶
Returns the plot series details used to generate the plot data.
See also
- Return type:
- setFilterOnlyVisibleFeatures(self, visibleOnly: bool)[source]¶
Sets the series to only use features which are visible in a map item. Changing this setting forces the chart to refetch features from its vector layer.
See also
See also
- Parameters:
visibleOnly (bool)
- setFilterToAtlasFeature(self, filterToAtlas: bool)[source]¶
Sets series to only use features which intersect the current atlas feature.
See also
- Parameters:
filterToAtlas (bool)
- setMap(self, map: QgsLayoutItemMap | None)[source]¶
Sets a layout
mapto use to limit the series’ use of features. This setting only has an effect if setFilterOnlyVisibleFeatures is set toTrue. Changing the map forces the chart to refetch features from its vector layer.See also
See also
- Parameters:
map (Optional[QgsLayoutItemMap])
- setPlot(self, plot: QgsPlot | None)[source]¶
Sets the
plotused to render the chart.Ownership is transferred to the item.
- setSeriesList(self, seriesList: Iterable[QgsLayoutItemChart.SeriesDetails])[source]¶
Sets the plot series details used to generate the plot data.
See also
- Parameters:
seriesList (Iterable[QgsLayoutItemChart.SeriesDetails])
- setSortAscending(self, ascending: bool)[source]¶
Sets whether features should be sorted in an
ascendingorder when iterating through the vector layer from which the plot data will be gathered from.This property has no effect is
sortFeatures()isFalse.See also
See also
See also
- Parameters:
ascending (bool)
- setSortExpression(self, expression: str | None)[source]¶
Sets the
expressionused to sort features when iterating through the vector layer from which the plot data will be gathered from.See also
See also
See also
- Parameters:
expression (Optional[str])
- setSortFeatures(self, sorted: bool)[source]¶
Sets whether features should be
sortedwhen iterating through the vector layer from which the plot data will be gathered from.See also
See also
See also
- Parameters:
sorted (bool)
- setSourceLayer(self, layer: QgsVectorLayer | None)[source]¶
Sets the source vector
layerfrom which the plot data will be gathered from.See also
- Parameters:
layer (Optional[QgsVectorLayer])
- sortAscending(self) bool[source]¶
Returns
Trueif features should be sorted in an ascending order when iterating through the vector layer from which the plot data will be gathered from.This property has no effect is
sortFeatures()isFalse.See also
See also
See also
- Return type:
bool
- sortExpression(self) str[source]¶
Returns the expression used to sort features when iterating through the vector layer from which the plot data will be gathered from.
See also
See also
See also
- Return type:
str
- sortFeatures(self) bool[source]¶
Returns
Trueif features should be sorted when iterating through the vector layer from which the plot data will be gathered from.See also
See also
See also
- Return type:
bool
- sourceLayer(self) QgsVectorLayer | None[source]¶
Returns the source vector layer from which the plot data will be gathered from.
See also
- Return type: