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 );
62 context.
setHighlightedVariables( { u
"plot_axis"_s, u
"plot_axis_value"_s, u
"chart_category"_s, u
"chart_value"_s } );
69 button->blockSignals(
true );
73 button->blockSignals(
false );
92void QgsPlotWidget::updateProperty()
108 mSymbolsList->setColumnCount( 2 );
109 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
110 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
111 mSymbolsList->setSortingEnabled(
false );
112 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
113 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
114 mSymbolsList->horizontalHeader()->hide();
115 mSymbolsList->verticalHeader()->hide();
117 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mAddSymbolPushButton_clicked );
118 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked );
120 mSpinMinXAxis->setClearValue( 0 );
121 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
127 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
133 mSpinMinYAxis->setClearValue( 0 );
134 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
140 mSpinMaxYAxis->setClearValue( 0 );
141 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
163 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
169 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
175 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
197 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
203 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
209 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
231 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
234 widget->
setFormat( mXAxisNumericFormat.get() );
236 mXAxisNumericFormat.reset( widget->
format() );
242 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
245 widget->
setFormat( mYAxisNumericFormat.get() );
247 mYAxisNumericFormat.reset( widget->
format() );
253 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
254 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
270 mSpinLeftMargin->setClearValue( 0 );
271 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
277 mSpinRightMargin->setClearValue( 0 );
278 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
284 mSpinTopMargin->setClearValue( 0 );
285 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
291 mSpinBottomMargin->setClearValue( 0 );
292 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
300 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
311 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
317 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
318 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
319 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
320 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
321 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
322 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
323 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
324 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
344void QgsBarChartPlotWidget::mAddSymbolPushButton_clicked()
346 const int row = mSymbolsList->rowCount();
347 mSymbolsList->insertRow( row );
349 QTableWidgetItem *item =
new QTableWidgetItem();
350 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
351 mSymbolsList->setItem( row, 0, item );
363 mSymbolsList->setCellWidget( row, 1, symbolButton );
368void QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked()
370 QTableWidgetItem *item = mSymbolsList->currentItem();
376 mSymbolsList->removeRow( mSymbolsList->row( item ) );
391 mSymbolsList->clear();
393 for (
int i = 0; i < symbolCount; i++ )
395 const int row = mSymbolsList->rowCount();
396 mSymbolsList->insertRow( row );
398 QTableWidgetItem *item =
new QTableWidgetItem();
399 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
400 mSymbolsList->setItem( row, 0, item );
412 mSymbolsList->setCellWidget( row, 1, symbolButton );
415 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
416 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
417 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
418 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
429 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
431 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
434 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
435 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
450 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
451 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
452 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
453 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
487 const int rowCount = mSymbolsList->rowCount();
488 for (
int i = 0; i < rowCount; i++ )
527 margins.
setLeft( mSpinLeftMargin->value() );
528 margins.
setRight( mSpinRightMargin->value() );
529 margins.
setTop( mSpinTopMargin->value() );
530 margins.
setBottom( mSpinBottomMargin->value() );
546 mSymbolsList->setColumnCount( 3 );
547 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
548 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
549 mSymbolsList->setSortingEnabled(
false );
550 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
551 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
552 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
553 mSymbolsList->horizontalHeader()->hide();
554 mSymbolsList->verticalHeader()->hide();
556 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mAddSymbolPushButton_clicked );
557 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked );
559 mSpinMinXAxis->setClearValue( 0 );
560 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
566 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
572 mSpinMinYAxis->setClearValue( 0 );
573 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
579 mSpinMaxYAxis->setClearValue( 0 );
580 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
602 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
608 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
614 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
636 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
642 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
648 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
670 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
673 widget->
setFormat( mXAxisNumericFormat.get() );
675 mXAxisNumericFormat.reset( widget->
format() );
681 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
684 widget->
setFormat( mYAxisNumericFormat.get() );
686 mYAxisNumericFormat.reset( widget->
format() );
692 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
693 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
709 mSpinLeftMargin->setClearValue( 0 );
710 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
716 mSpinRightMargin->setClearValue( 0 );
717 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
723 mSpinTopMargin->setClearValue( 0 );
724 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
730 mSpinBottomMargin->setClearValue( 0 );
731 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
739 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
750 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
756 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
757 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
758 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
759 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
760 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
761 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
762 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
763 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
783void QgsLineChartPlotWidget::mAddSymbolPushButton_clicked()
785 const int row = mSymbolsList->rowCount();
786 mSymbolsList->insertRow( row );
788 QTableWidgetItem *item =
new QTableWidgetItem();
789 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
790 mSymbolsList->setItem( row, 0, item );
803 mSymbolsList->setCellWidget( row, 1, symbolButton );
806 symbolButton =
new QgsSymbolButton(
this );
817 mSymbolsList->setCellWidget( row, 2, symbolButton );
822void QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked()
824 QTableWidgetItem *item = mSymbolsList->currentItem();
830 mSymbolsList->removeRow( mSymbolsList->row( item ) );
845 mSymbolsList->clear();
847 for (
int i = 0; i < symbolCount; i++ )
849 const int row = mSymbolsList->rowCount();
850 mSymbolsList->insertRow( row );
852 QTableWidgetItem *item =
new QTableWidgetItem();
853 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
854 mSymbolsList->setItem( row, 0, item );
867 mSymbolsList->setCellWidget( row, 1, symbolButton );
881 mSymbolsList->setCellWidget( row, 2, symbolButton );
884 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
885 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
886 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
887 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
898 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
899 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
901 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
902 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
917 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
918 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
919 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
920 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
954 const int rowCount = mSymbolsList->rowCount();
955 for (
int i = 0; i < rowCount; i++ )
963 symbolButton =
dynamic_cast<QgsSymbolButton *
>( mSymbolsList->cellWidget( i, 2 ) );
998 margins.
setLeft( mSpinLeftMargin->value() );
999 margins.
setRight( mSpinRightMargin->value() );
1000 margins.
setTop( mSpinTopMargin->value() );
1001 margins.
setBottom( mSpinBottomMargin->value() );
1017 mSymbolsList->setColumnCount( 3 );
1018 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
1019 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
1020 mSymbolsList->setSortingEnabled(
false );
1021 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1022 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
1023 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
1024 mSymbolsList->horizontalHeader()->hide();
1025 mSymbolsList->verticalHeader()->hide();
1030 connect( mLabelCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1031 if ( mBlockChanges )
1036 mLabelFontButton->setDialogTitle( tr(
"Chart Label Font" ) );
1039 if ( mBlockChanges )
1044 connect( mLabelFormatButton, &QPushButton::clicked,
this, [
this] {
1047 widget->
setFormat( mNumericFormat.get() );
1049 mNumericFormat.reset( widget->
format() );
1055 mSpinLeftMargin->setClearValue( 0 );
1056 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1057 if ( mBlockChanges )
1062 mSpinRightMargin->setClearValue( 0 );
1063 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1064 if ( mBlockChanges )
1069 mSpinTopMargin->setClearValue( 0 );
1070 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1071 if ( mBlockChanges )
1076 mSpinBottomMargin->setClearValue( 0 );
1077 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1078 if ( mBlockChanges )
1083 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mAddSymbolPushButton_clicked );
1084 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked );
1086 mLabelFontButton->registerExpressionContextGenerator(
this );
1094void QgsPieChartPlotWidget::mAddSymbolPushButton_clicked()
1096 const int row = mSymbolsList->rowCount();
1097 mSymbolsList->insertRow( row );
1099 QTableWidgetItem *item =
new QTableWidgetItem();
1100 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1101 mSymbolsList->setItem( row, 0, item );
1110 if ( mBlockChanges )
1114 mSymbolsList->setCellWidget( row, 1, symbolButton );
1117 QgsColorRampButton *colorRampButton =
new QgsColorRampButton(
this );
1121 if ( mBlockChanges )
1125 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1130void QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked()
1132 QTableWidgetItem *item = mSymbolsList->currentItem();
1138 mSymbolsList->removeRow( mSymbolsList->row( item ) );
1153 mSymbolsList->clear();
1155 for (
int i = 0; i < symbolCount; i++ )
1157 const int row = mSymbolsList->rowCount();
1158 mSymbolsList->insertRow( row );
1160 QTableWidgetItem *item =
new QTableWidgetItem();
1161 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1162 mSymbolsList->setItem( row, 0, item );
1171 if ( mBlockChanges )
1175 mSymbolsList->setCellWidget( row, 1, symbolButton );
1182 if ( mBlockChanges )
1186 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1190 mLabelFontButton->setTextFormat( chartPlot->
textFormat() );
1192 mLabelCombo->setCurrentIndex( mLabelCombo->findData( QVariant::fromValue( chartPlot->
labelType() ) ) );
1213 const int rowCount = mSymbolsList->rowCount();
1214 for (
int i = 0; i < rowCount; i++ )
1223 if ( colorRampButton )
1234 margins.
setLeft( mSpinLeftMargin->value() );
1235 margins.
setRight( mSpinRightMargin->value() );
1236 margins.
setTop( mSpinTopMargin->value() );
1237 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.
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.
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.