17#ifndef QGSLAYOUTITEMCHART_H
18#define QGSLAYOUTITEMCHART_H
63 return mName == other.mName
64 && mXExpression == other.mXExpression
65 && mYExpression == other.mYExpression
66 && mFilterExpression == other.mFilterExpression;
72 QString
name()
const {
return mName; }
121 QString mXExpression;
122 QString mYExpression;
123 QString mFilterExpression;
131 int type()
const override;
132 QIcon
icon()
const override;
168 void setSortFeatures(
bool sorted );
190 void setSortAscending(
bool ascending );
212 void setSortExpression(
const QString &expression );
229 void setSeriesList(
const QList<QgsLayoutItemChart::SeriesDetails> &seriesList );
236 QList<QgsLayoutItemChart::SeriesDetails>
seriesList()
const {
return mSeriesList; }
262 void setFilterOnlyVisibleFeatures(
bool visibleOnly );
278 void setFilterToAtlasFeature(
bool filterToAtlas );
295 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
314 void prepareGatherer();
320 std::unique_ptr<Qgs2DPlot> mPlot;
324 bool mSortFeatures =
false;
325 bool mSortAscending =
true;
326 QString mSortExpression;
328 QList<QgsLayoutItemChart::SeriesDetails> mSeriesList;
330 QPointer< QgsLayoutItemMap > mMap =
nullptr;
333 bool mFilterOnlyVisibleFeatures =
false;
334 bool mFilterToAtlasIntersection =
false;
336 bool mNeedsGathering =
false;
337 bool mIsGathering =
false;
338 QTimer mGathererTimer;
339 QPointer<QgsVectorLayerAbstractPlotDataGatherer> mGatherer;
QString yExpression() const
Returns the expression used to generate Y-axis values.
void setName(const QString &name)
Sets the series name.
void setFilterExpression(const QString &filterExpression)
Sets the filter expression used to generate a series against a subset of the source layer.
QString name() const
Returns the series name.
bool operator==(const SeriesDetails &other) const
SeriesDetails(const QString &name=QString())
Constructor for SeriesDetails with an optional name parameter to provide a name string to the series.
void setXExpression(const QString &xExpression)
Sets the expression used to generate X-axis values.
void setYExpression(const QString &yExpression)
Sets the expression used to generate Y-axis values.
QString filterExpression() const
Returns the filter expression used to generate a series against a subset of the source layer.
QString xExpression() const
Returns the expression used to generate X-axis values.
A layout item subclass that renders chart plots.
QgsPlot * plot()
Returns the plot used to render the chart.
bool filterOnlyVisibleFeatures() const
Returns true if the series are set to use only features visible on a corresponding map item.
QgsVectorLayer * sourceLayer() const
Returns the source vector layer from which the plot data will be gathered from.
bool sortFeatures() const
Returns true if features should be sorted when iterating through the vector layer from which the plot...
bool sortAscending() const
Returns true if features should be sorted in an ascending order when iterating through the vector lay...
bool filterToAtlasFeature() const
Returns true if the series are set to only show features which intersect the current atlas feature.
QgsLayoutItemChart(QgsLayout *layout)
Constructor for QgsLayoutItemChart, with the specified parent layout.
QgsLayoutItemMap * map() const
Returns the layout map to use to limit the series' use of features.
QString sortExpression() const
Returns the expression used to sort features when iterating through the vector layer from which the p...
QList< QgsLayoutItemChart::SeriesDetails > seriesList() const
Returns the plot series details used to generate the plot data.
Layout graphical items for displaying a map.
Contains settings and helpers relating to a render of a QgsLayoutItem.
QgsLayoutItem(QgsLayout *layout, bool manageZValue=true)
Constructor for QgsLayoutItem, with the specified parent layout.
virtual QIcon icon() const
Returns the item's icon.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
Handles preparing a paint surface for the layout item and painting the item's content.
friend class QgsLayoutItemMap
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
int type() const override
Returns a unique graphics item type identifier.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Encapsulates one or more plot series.
Base class for plot/chart/graphs.
A container for the context for various read/write operations on objects.
Represents a vector layer which manages a vector based dataset.
_LayerRef< QgsVectorLayer > QgsVectorLayerRef