17#ifndef QGSLAYOUTITEMCHART_H
18#define QGSLAYOUTITEMCHART_H
60 return mName == other.mName && mXExpression == other.mXExpression && mYExpression == other.mYExpression && mFilterExpression == other.mFilterExpression;
66 QString
name()
const {
return mName; }
115 QString mXExpression;
116 QString mYExpression;
117 QString mFilterExpression;
125 int type()
const override;
126 QIcon
icon()
const override;
162 void setSortFeatures(
bool sorted );
184 void setSortAscending(
bool ascending );
206 void setSortExpression(
const QString &expression );
223 void setSeriesList(
const QList<QgsLayoutItemChart::SeriesDetails> &seriesList );
230 QList<QgsLayoutItemChart::SeriesDetails>
seriesList()
const {
return mSeriesList; }
256 void setFilterOnlyVisibleFeatures(
bool visibleOnly );
272 void setFilterToAtlasFeature(
bool filterToAtlas );
288 void setGenerateCategoriesFromRenderer(
bool generateCategoriesFromRenderer );
304 void setApplyRendererStyle(
bool applyRendererStyle );
321 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
338 void prepareGatherer();
340 void createRendererSeriesDetails( QString &rendererXExpression, QStringList &rendererCategories );
341 void applyRendererStyleToPlot(
Qgs2DPlot *plot )
const;
347 std::unique_ptr<Qgs2DPlot> mPlot;
351 bool mSortFeatures =
false;
352 bool mSortAscending =
true;
353 QString mSortExpression;
355 QList<QgsLayoutItemChart::SeriesDetails> mSeriesList;
356 bool mGenerateCategoriesFromRenderer =
false;
357 bool mApplyRendererStyle =
true;
359 QPointer< QgsLayoutItemMap > mMap =
nullptr;
362 bool mFilterOnlyVisibleFeatures =
false;
363 bool mFilterToAtlasIntersection =
false;
365 bool mNeedsGathering =
false;
366 bool mIsGathering =
false;
367 QTimer mGathererTimer;
368 QPointer<QgsVectorLayerAbstractPlotDataGatherer> mGatherer;
Base class for 2-dimensional plot/chart/graphs.
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 applyRendererStyle() const
Returns true if chart symbols will adopt the source layer's symbology renderer (e....
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 generateCategoriesFromRenderer() const
Returns true if series' X axis will adopt categories generated from the source layer's symbology rend...
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