31#include "moc_qgsplotwidget.cpp"
33using namespace Qt::StringLiterals;
37 mExpressionContextGenerator = generator;
43 if ( mExpressionContextGenerator )
45 context = mExpressionContextGenerator->createExpressionContext();
52 auto plotScope = std::make_unique<QgsExpressionContextScope>( u
"plot"_s );
57 auto chartScope = std::make_unique<QgsExpressionContextScope>( u
"chart"_s );
63 context.
setHighlightedVariables( { u
"plot_axis"_s, u
"plot_axis_value"_s, u
"chart_series_name"_s, u
"chart_category"_s, u
"chart_value"_s } );
70 button->blockSignals(
true );
74 button->blockSignals(
false );
93void QgsPlotWidget::updateProperty()
109 mSymbolsList->setColumnCount( 2 );
110 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
111 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
112 mSymbolsList->setSortingEnabled(
false );
113 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
114 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
115 mSymbolsList->horizontalHeader()->hide();
116 mSymbolsList->verticalHeader()->hide();
118 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mAddSymbolPushButton_clicked );
119 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked );
121 mSpinMinXAxis->setClearValue( 0 );
122 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
128 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
134 mSpinMinYAxis->setClearValue( 0 );
135 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
141 mSpinMaxYAxis->setClearValue( 0 );
142 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
164 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
170 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
176 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
198 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
204 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
210 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
232 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
235 widget->
setFormat( mXAxisNumericFormat.get() );
237 mXAxisNumericFormat.reset( widget->
format() );
243 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
246 widget->
setFormat( mYAxisNumericFormat.get() );
248 mYAxisNumericFormat.reset( widget->
format() );
254 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
255 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
271 mSpinLeftMargin->setClearValue( 0 );
272 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
278 mSpinRightMargin->setClearValue( 0 );
279 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
285 mSpinTopMargin->setClearValue( 0 );
286 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
292 mSpinBottomMargin->setClearValue( 0 );
293 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
301 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
312 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
318 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
319 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
320 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
321 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
322 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
323 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
324 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
325 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
345void QgsBarChartPlotWidget::mAddSymbolPushButton_clicked()
347 const int row = mSymbolsList->rowCount();
348 mSymbolsList->insertRow( row );
350 QTableWidgetItem *item =
new QTableWidgetItem();
351 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
352 mSymbolsList->setItem( row, 0, item );
364 mSymbolsList->setCellWidget( row, 1, symbolButton );
369void QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked()
371 QTableWidgetItem *item = mSymbolsList->currentItem();
377 mSymbolsList->removeRow( mSymbolsList->row( item ) );
392 mSymbolsList->clear();
394 for (
int i = 0; i < symbolCount; i++ )
396 const int row = mSymbolsList->rowCount();
397 mSymbolsList->insertRow( row );
399 QTableWidgetItem *item =
new QTableWidgetItem();
400 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
401 mSymbolsList->setItem( row, 0, item );
413 mSymbolsList->setCellWidget( row, 1, symbolButton );
416 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
417 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
418 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
419 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
430 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
432 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
435 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
436 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
451 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
452 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
453 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
454 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
490 const int rowCount = mSymbolsList->rowCount();
491 for (
int i = 0; i < rowCount; i++ )
530 margins.
setLeft( mSpinLeftMargin->value() );
531 margins.
setRight( mSpinRightMargin->value() );
532 margins.
setTop( mSpinTopMargin->value() );
533 margins.
setBottom( mSpinBottomMargin->value() );
550 mSymbolsList->setColumnCount( 3 );
551 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
552 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
553 mSymbolsList->setSortingEnabled(
false );
554 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
555 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
556 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
557 mSymbolsList->horizontalHeader()->hide();
558 mSymbolsList->verticalHeader()->hide();
560 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mAddSymbolPushButton_clicked );
561 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked );
563 mSpinMinXAxis->setClearValue( 0 );
564 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
570 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
576 mSpinMinYAxis->setClearValue( 0 );
577 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
583 mSpinMaxYAxis->setClearValue( 0 );
584 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
606 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
612 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
618 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
640 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
646 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
652 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
674 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
677 widget->
setFormat( mXAxisNumericFormat.get() );
679 mXAxisNumericFormat.reset( widget->
format() );
685 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
688 widget->
setFormat( mYAxisNumericFormat.get() );
690 mYAxisNumericFormat.reset( widget->
format() );
696 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
697 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
713 mSpinLeftMargin->setClearValue( 0 );
714 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
720 mSpinRightMargin->setClearValue( 0 );
721 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
727 mSpinTopMargin->setClearValue( 0 );
728 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
734 mSpinBottomMargin->setClearValue( 0 );
735 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
743 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
754 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
760 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
761 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
762 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
763 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
764 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
765 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
766 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
767 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
787void QgsLineChartPlotWidget::mAddSymbolPushButton_clicked()
789 const int row = mSymbolsList->rowCount();
790 mSymbolsList->insertRow( row );
792 QTableWidgetItem *item =
new QTableWidgetItem();
793 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
794 mSymbolsList->setItem( row, 0, item );
807 mSymbolsList->setCellWidget( row, 1, symbolButton );
810 symbolButton =
new QgsSymbolButton(
this );
821 mSymbolsList->setCellWidget( row, 2, symbolButton );
826void QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked()
828 QTableWidgetItem *item = mSymbolsList->currentItem();
834 mSymbolsList->removeRow( mSymbolsList->row( item ) );
849 mSymbolsList->clear();
851 for (
int i = 0; i < symbolCount; i++ )
853 const int row = mSymbolsList->rowCount();
854 mSymbolsList->insertRow( row );
856 QTableWidgetItem *item =
new QTableWidgetItem();
857 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
858 mSymbolsList->setItem( row, 0, item );
871 mSymbolsList->setCellWidget( row, 1, symbolButton );
885 mSymbolsList->setCellWidget( row, 2, symbolButton );
888 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
889 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
890 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
891 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
902 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
903 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
905 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
906 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
921 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
922 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
923 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
924 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
960 const int rowCount = mSymbolsList->rowCount();
961 for (
int i = 0; i < rowCount; i++ )
969 symbolButton =
dynamic_cast<QgsSymbolButton *
>( mSymbolsList->cellWidget( i, 2 ) );
1004 margins.
setLeft( mSpinLeftMargin->value() );
1005 margins.
setRight( mSpinRightMargin->value() );
1006 margins.
setTop( mSpinTopMargin->value() );
1007 margins.
setBottom( mSpinBottomMargin->value() );
1024 mSymbolsList->setColumnCount( 3 );
1025 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
1026 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
1027 mSymbolsList->setSortingEnabled(
false );
1028 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1029 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
1030 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
1031 mSymbolsList->horizontalHeader()->hide();
1032 mSymbolsList->verticalHeader()->hide();
1037 connect( mLabelCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1038 if ( mBlockChanges )
1043 mLabelFontButton->setDialogTitle( tr(
"Chart Label Font" ) );
1046 if ( mBlockChanges )
1051 connect( mLabelFormatButton, &QPushButton::clicked,
this, [
this] {
1054 widget->
setFormat( mNumericFormat.get() );
1056 mNumericFormat.reset( widget->
format() );
1062 mSpinLeftMargin->setClearValue( 0 );
1063 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1064 if ( mBlockChanges )
1069 mSpinRightMargin->setClearValue( 0 );
1070 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1071 if ( mBlockChanges )
1076 mSpinTopMargin->setClearValue( 0 );
1077 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1078 if ( mBlockChanges )
1083 mSpinBottomMargin->setClearValue( 0 );
1084 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1085 if ( mBlockChanges )
1090 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mAddSymbolPushButton_clicked );
1091 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked );
1093 mLabelFontButton->registerExpressionContextGenerator(
this );
1101void QgsPieChartPlotWidget::mAddSymbolPushButton_clicked()
1103 const int row = mSymbolsList->rowCount();
1104 mSymbolsList->insertRow( row );
1106 QTableWidgetItem *item =
new QTableWidgetItem();
1107 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1108 mSymbolsList->setItem( row, 0, item );
1117 if ( mBlockChanges )
1121 mSymbolsList->setCellWidget( row, 1, symbolButton );
1124 QgsColorRampButton *colorRampButton =
new QgsColorRampButton(
this );
1128 if ( mBlockChanges )
1132 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1137void QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked()
1139 QTableWidgetItem *item = mSymbolsList->currentItem();
1145 mSymbolsList->removeRow( mSymbolsList->row( item ) );
1160 mSymbolsList->clear();
1162 for (
int i = 0; i < symbolCount; i++ )
1164 const int row = mSymbolsList->rowCount();
1165 mSymbolsList->insertRow( row );
1167 QTableWidgetItem *item =
new QTableWidgetItem();
1168 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1169 mSymbolsList->setItem( row, 0, item );
1178 if ( mBlockChanges )
1182 mSymbolsList->setCellWidget( row, 1, symbolButton );
1189 if ( mBlockChanges )
1193 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1197 mLabelFontButton->setTextFormat( chartPlot->
textFormat() );
1199 mLabelCombo->setCurrentIndex( mLabelCombo->findData( QVariant::fromValue( chartPlot->
labelType() ) ) );
1220 const int rowCount = mSymbolsList->rowCount();
1221 for (
int i = 0; i < rowCount; i++ )
1230 if ( colorRampButton )
1241 margins.
setLeft( mSpinLeftMargin->value() );
1242 margins.
setRight( mSpinRightMargin->value() );
1243 margins.
setTop( mSpinTopMargin->value() );
1244 margins.
setBottom( mSpinBottomMargin->value() );
PieChartLabelType
Pie chart label types.
@ Categories
Category labels are drawn.
@ Values
Value labels are drawn.
@ NoLabels
Labels are not drawn.
PlotAxisSuffixPlacement
Placement options for suffixes in the labels for axis of plots.
@ FirstAndLastLabels
Place suffix after the first and last label values only.
@ EveryLabel
Place suffix after every value label.
@ FirstLabel
Place suffix after the first label value only.
@ LastLabel
Place suffix after the last label value only.
@ NoLabels
Do not place suffixes.
PlotAxisType
Plots axis types.
@ Categorical
The axis represents categories.
@ Interval
The axis represents a range of values.
const QgsMargins & margins() const
Returns the margins of the plot area (in millimeters).
void setMargins(const QgsMargins &margins)
Sets the margins of the plot area (in millimeters).
void setXMaximum(double maximum)
Sets the maximum value of the x axis.
double yMaximum() const
Returns the maximum value of the y axis.
void setYMinimum(double minimum)
Sets the minimum value of the y axis.
double xMinimum() const
Returns the minimum value of the x axis.
void setChartBackgroundSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used to render the background of the chart.
void setFlipAxes(bool flipAxes)
Sets whether the X and Y axes are flipped.
QgsPlotAxis & yAxis()
Returns a reference to the plot's y axis.
void setChartBorderSymbol(QgsFillSymbol *symbol)
Sets the symbol used to render the border of the chart.
bool flipAxes() const
Returns whether the X and Y axes are flipped.
QgsFillSymbol * chartBackgroundSymbol()
Returns the fill symbol used to render the background of the chart.
void setXMinimum(double minimum)
Sets the minimum value of the x axis.
QgsPlotAxis & xAxis()
Returns a reference to the plot's x axis.
QgsFillSymbol * chartBorderSymbol()
Returns the symbol used to render the border of the chart.
double yMinimum() const
Returns the minimum value of the y axis.
void setYMaximum(double maximum)
Sets the maximum value of the y axis.
double xMaximum() const
Returns the maximum value of the x axis.
static QgsPlotRegistry * plotRegistry()
Returns the application's plot registry, used for plot types.
A simple bar chart class.
void setFillSymbolAt(int index, QgsFillSymbol *symbol)
Sets the fill symbol to use for the series with matching index.
int fillSymbolCount() const
Returns the fill symbols list count.
QgsFillSymbol * fillSymbolAt(int index) const
Returns the fill symbol for the series with matching index.
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
Abstract interface for generating an expression context.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
A simple line chart class.
QgsMarkerSymbol * markerSymbolAt(int index) const
Returns the marker symbol for the series with matching index.
QgsLineSymbol * lineSymbolAt(int index) const
Returns the line symbol for the series with matching index.
void setLineSymbolAt(int index, QgsLineSymbol *symbol)
Sets the line symbol to use for the series with matching index.
int lineSymbolCount() const
Returns the line symbols list count.
void setMarkerSymbolAt(int index, QgsMarkerSymbol *symbol)
Sets the fill symbol to use for the series with matching index.
int markerSymbolCount() const
Returns the line symbols list count.
A line symbol type, for rendering LineString and MultiLineString geometries.
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
Defines the four margins of a rectangle.
void setBottom(double bottom)
Sets the bottom margin to bottom.
double top() const
Returns the top margin.
void setLeft(double left)
Sets the left margin to left.
double right() const
Returns the right margin.
double bottom() const
Returns the bottom margin.
void setRight(double right)
Sets the right margin to right.
void setTop(double top)
Sets the top margin to top.
double left() const
Returns the left margin.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
A simple pie chart class.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for the pie chart labels.
QgsTextFormat textFormat() const
Returns the text format used for the pie chart labels.
QgsFillSymbol * fillSymbolAt(int index) const
Returns the fill symbol for the series with matching index.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for the pie chart labels.
QgsColorRamp * colorRampAt(int index) const
Returns the color ramp for the series with matching index.
QgsNumericFormat * numericFormat() const
Returns the numeric format used for the pie chart labels.
void setLabelType(Qgis::PieChartLabelType type)
Sets the pie chart label type.
Qgis::PieChartLabelType labelType() const
Returns the pie chart label type.
int fillSymbolCount() const
Returns the fill symbols list count.
void setColorRampAt(int index, QgsColorRamp *ramp)
Sets the color ramp for the series with matching index.
void setFillSymbolAt(int index, QgsFillSymbol *symbol)
Sets the fill symbol to use for the series with matching index.
int colorRampCount() const
Returns the color ramps list count.
QgsLineSymbol * gridMinorSymbol()
Returns the line symbol used to render the minor lines in the axis grid.
void setGridMajorSymbol(QgsLineSymbol *symbol)
Sets the symbol used to render the major lines in the axis grid.
double gridIntervalMinor() const
Returns the interval of minor grid lines for the axis.
double gridIntervalMajor() const
Returns the interval of major grid lines for the axis.
void setType(Qgis::PlotAxisType type)
Sets the axis type.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for the axis labels.
QgsTextFormat textFormat() const
Returns the text format used for the axis labels.
void setGridIntervalMajor(double interval)
Sets the interval of major grid lines for the axis.
void setLabelSuffixPlacement(Qgis::PlotAxisSuffixPlacement placement)
Sets the placement for the axis label suffixes.
void setGridIntervalMinor(double interval)
Sets the interval of minor grid lines for the axis.
void setLabelInterval(double interval)
Sets the interval of labels for the axis.
Qgis::PlotAxisType type() const
Returns the axis type.
double labelInterval() const
Returns the interval of labels for the axis.
QgsLineSymbol * gridMajorSymbol()
Returns the line symbol used to render the major lines in the axis grid.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for the axis labels.
void setGridMinorSymbol(QgsLineSymbol *symbol)
Sets the symbol used to render the minor lines in the axis grid.
QgsNumericFormat * numericFormat() const
Returns the numeric format used for the axis labels.
Qgis::PlotAxisSuffixPlacement labelSuffixPlacement() const
Returns the placement for the axis label suffixes.
static QgsFillSymbol * chartBorderSymbol()
Returns the default fill symbol to use for the chart area border.
static QgsColorRamp * pieChartColorRamp()
Returns the default color ramp to use for pie charts.
static QgsFillSymbol * barChartFillSymbol()
Returns the default fill symbol to use for bar charts.
static QgsLineSymbol * lineChartLineSymbol()
Returns the default line symbol to use for line charts.
static QgsLineSymbol * axisGridMinorSymbol()
Returns the default line symbol to use for axis minor grid lines.
static QgsFillSymbol * pieChartFillSymbol()
Returns the default fill symbol to use for pie charts.
static QgsMarkerSymbol * lineChartMarkerSymbol()
Returns the default marker symbol to use for line charts.
static QgsFillSymbol * chartBackgroundSymbol()
Returns the default fill symbol to use for the chart area background fill.
static QgsLineSymbol * axisGridMajorSymbol()
Returns the default line symbol to use for axis major grid lines.
QgsPlot * createPlot(const QString &type) const
Creates a new instance of a plot given the type.
Base class for plot/chart/graphs.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the plot's property collection, used for data defined overrides.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the plot property definitions.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the plot's property collection, used for data defined overrides.
DataDefinedProperty
Data defined properties for different plot types.
@ YAxisMinorInterval
Minor grid line interval for Y axis.
@ YAxisLabelInterval
Label interval for Y axis.
@ XAxisMajorInterval
Major grid line interval for X axis.
@ XAxisMaximum
Maximum X axis value.
@ XAxisMinimum
Minimum X axis value.
@ XAxisLabelInterval
Label interval for X axis.
@ MarginBottom
Bottom margin.
@ XAxisMinorInterval
Minor grid line interval for X axis.
@ YAxisMajorInterval
Major grid line interval for Y axis.
@ YAxisMaximum
Maximum Y axis value.
@ MarginRight
Right margin.
@ YAxisMinimum
Minimum Y axis value.
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Single variable definition for use within a QgsExpressionContextScope.