QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsbarchartplot.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsbarchartplot.h
3 -----------------
4 begin : June 2025
5 copyright : (C) 2025 by Mathieu
6 email : mathieu at opengis dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSBARCHARTPLOT_H
18#define QGSBARCHARTPLOT_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgsfillsymbol.h"
23#include "qgsplot.h"
24
26
27
36class CORE_EXPORT QgsBarChartPlot : public Qgs2DXyPlot
37{
38 public:
39
41 ~QgsBarChartPlot() override = default;
42
43 QString type() const override { return QStringLiteral( "bar" ); }
44
45 void renderContent( QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QRectF &plotArea, const QgsPlotData &plotData = QgsPlotData() ) override;
46
47 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
48 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
49
53 QgsFillSymbol *fillSymbolAt( int index ) const;
54
58 void setFillSymbolAt( int index, QgsFillSymbol *symbol SIP_TRANSFER );
59
63 int fillSymbolCount() const { return mFillSymbols.size(); }
64
66 static QgsBarChartPlot *create() SIP_FACTORY;
67
69 static QgsVectorLayerAbstractPlotDataGatherer *createDataGatherer( QgsPlot *plot ) SIP_TRANSFERBACK;
70
71 private:
72
73 std::vector<std::unique_ptr<QgsFillSymbol>> mFillSymbols;
74};
75
76#endif // QGSBARCHARTPLOT_H
virtual void renderContent(QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QRectF &plotArea, const QgsPlotData &plotData=QgsPlotData())
Renders the plot content.
Definition qgsplot.cpp:263
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the plot's properties from an XML element.
Definition qgsplot.cpp:390
Qgs2DXyPlot()
Constructor for Qgs2DXyPlot.
Definition qgsplot.cpp:356
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the plot's properties into an XML element.
Definition qgsplot.cpp:364
A simple bar chart class.
QString type() const override
Returns the plot's type.
int fillSymbolCount() const
Returns the fill symbols list count.
~QgsBarChartPlot() override=default
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Encapsulates one or more plot series.
Definition qgsplot.h:300
Contains information about the context of a plot rendering operation.
Definition qgsplot.h:184
Base class for plot/chart/graphs.
Definition qgsplot.h:48
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
An abstract vector layer plot data gatherer base class.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48
#define SIP_FACTORY
Definition qgis_sip.h:84