17#ifndef QGSLAYOUTITEMCHART_H
18#define QGSLAYOUTITEMCHART_H
62 return mName == other.mName
63 && mXExpression == other.mXExpression
64 && mYExpression == other.mYExpression
65 && mFilterExpression == other.mFilterExpression;
71 QString
name()
const {
return mName; }
120 QString mXExpression;
121 QString mYExpression;
122 QString mFilterExpression;
130 int type()
const override;
131 QIcon
icon()
const override;
167 void setSortFeatures(
bool sorted );
189 void setSortAscending(
bool ascending );
211 void setSortExpression(
const QString &expression );
228 void setSeriesList(
const QList<QgsLayoutItemChart::SeriesDetails> &seriesList );
235 QList<QgsLayoutItemChart::SeriesDetails>
seriesList()
const {
return mSeriesList; }
244 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
262 void prepareGatherer();
268 std::unique_ptr<Qgs2DPlot> mPlot;
272 bool mSortFeatures =
false;
273 bool mSortAscending =
true;
274 QString mSortExpression;
276 QList<QgsLayoutItemChart::SeriesDetails> mSeriesList;
278 bool mNeedsGathering =
false;
279 bool mIsGathering =
false;
280 QTimer mGathererTimer;
281 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.
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...
QgsLayoutItemChart(QgsLayout *layout)
Constructor for QgsLayoutItemChart, with the specified parent layout.
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.
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.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
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