29#include "moc_qgsplotwidget.cpp"
33 mExpressionContextGenerator = generator;
39 if ( mExpressionContextGenerator )
41 context = mExpressionContextGenerator->createExpressionContext();
48 auto plotScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral(
"plot" ) );
53 auto chartScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral(
"chart" ) );
58 context.
setHighlightedVariables( { QStringLiteral(
"plot_axis" ), QStringLiteral(
"plot_axis_value" ), QStringLiteral(
"chart_category" ), QStringLiteral(
"chart_value" ) } );
65 button->blockSignals(
true );
69 button->blockSignals(
false );
88void QgsPlotWidget::updateProperty()
104 mSymbolsList->setColumnCount( 2 );
105 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
106 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
107 mSymbolsList->setSortingEnabled(
false );
108 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
109 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
110 mSymbolsList->horizontalHeader()->hide();
111 mSymbolsList->verticalHeader()->hide();
113 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mAddSymbolPushButton_clicked );
114 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked );
116 mSpinMinXAxis->setClearValue( 0 );
117 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
123 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
129 mSpinMinYAxis->setClearValue( 0 );
130 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
136 mSpinMaxYAxis->setClearValue( 0 );
137 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
159 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
165 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
171 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
193 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
199 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
205 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
227 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
230 widget->
setFormat( mXAxisNumericFormat.get() );
232 mXAxisNumericFormat.reset( widget->
format() );
238 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
241 widget->
setFormat( mYAxisNumericFormat.get() );
243 mYAxisNumericFormat.reset( widget->
format() );
249 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
250 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
266 mSpinLeftMargin->setClearValue( 0 );
267 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
273 mSpinRightMargin->setClearValue( 0 );
274 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
280 mSpinTopMargin->setClearValue( 0 );
281 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
287 mSpinBottomMargin->setClearValue( 0 );
288 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
296 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
307 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
313 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
314 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
315 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
316 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
317 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
318 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
319 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
320 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
340void QgsBarChartPlotWidget::mAddSymbolPushButton_clicked()
342 const int row = mSymbolsList->rowCount();
343 mSymbolsList->insertRow( row );
345 QTableWidgetItem *item =
new QTableWidgetItem();
346 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
347 mSymbolsList->setItem( row, 0, item );
359 mSymbolsList->setCellWidget( row, 1, symbolButton );
364void QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked()
366 QTableWidgetItem *item = mSymbolsList->currentItem();
372 mSymbolsList->removeRow( mSymbolsList->row( item ) );
387 mSymbolsList->clear();
389 for (
int i = 0; i < symbolCount; i++ )
391 const int row = mSymbolsList->rowCount();
392 mSymbolsList->insertRow( row );
394 QTableWidgetItem *item =
new QTableWidgetItem();
395 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
396 mSymbolsList->setItem( row, 0, item );
408 mSymbolsList->setCellWidget( row, 1, symbolButton );
411 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
412 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
413 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
414 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
425 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
427 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
430 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
431 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
446 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
447 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
448 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
449 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
483 const int rowCount = mSymbolsList->rowCount();
484 for (
int i = 0; i < rowCount; i++ )
523 margins.
setLeft( mSpinLeftMargin->value() );
524 margins.
setRight( mSpinRightMargin->value() );
525 margins.
setTop( mSpinTopMargin->value() );
526 margins.
setBottom( mSpinBottomMargin->value() );
542 mSymbolsList->setColumnCount( 3 );
543 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
544 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
545 mSymbolsList->setSortingEnabled(
false );
546 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
547 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
548 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
549 mSymbolsList->horizontalHeader()->hide();
550 mSymbolsList->verticalHeader()->hide();
552 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mAddSymbolPushButton_clicked );
553 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked );
555 mSpinMinXAxis->setClearValue( 0 );
556 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
562 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
568 mSpinMinYAxis->setClearValue( 0 );
569 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
575 mSpinMaxYAxis->setClearValue( 0 );
576 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
598 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
604 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
610 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
632 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
638 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
644 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
666 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
669 widget->
setFormat( mXAxisNumericFormat.get() );
671 mXAxisNumericFormat.reset( widget->
format() );
677 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
680 widget->
setFormat( mYAxisNumericFormat.get() );
682 mYAxisNumericFormat.reset( widget->
format() );
688 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
689 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
705 mSpinLeftMargin->setClearValue( 0 );
706 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
712 mSpinRightMargin->setClearValue( 0 );
713 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
719 mSpinTopMargin->setClearValue( 0 );
720 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
726 mSpinBottomMargin->setClearValue( 0 );
727 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
735 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
746 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
752 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
753 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
754 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
755 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
756 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
757 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
758 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
759 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
779void QgsLineChartPlotWidget::mAddSymbolPushButton_clicked()
781 const int row = mSymbolsList->rowCount();
782 mSymbolsList->insertRow( row );
784 QTableWidgetItem *item =
new QTableWidgetItem();
785 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
786 mSymbolsList->setItem( row, 0, item );
799 mSymbolsList->setCellWidget( row, 1, symbolButton );
802 symbolButton =
new QgsSymbolButton(
this );
813 mSymbolsList->setCellWidget( row, 2, symbolButton );
818void QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked()
820 QTableWidgetItem *item = mSymbolsList->currentItem();
826 mSymbolsList->removeRow( mSymbolsList->row( item ) );
841 mSymbolsList->clear();
843 for (
int i = 0; i < symbolCount; i++ )
845 const int row = mSymbolsList->rowCount();
846 mSymbolsList->insertRow( row );
848 QTableWidgetItem *item =
new QTableWidgetItem();
849 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
850 mSymbolsList->setItem( row, 0, item );
863 mSymbolsList->setCellWidget( row, 1, symbolButton );
877 mSymbolsList->setCellWidget( row, 2, symbolButton );
880 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
881 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
882 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
883 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
894 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
895 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
897 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
898 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
913 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
914 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
915 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
916 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
950 const int rowCount = mSymbolsList->rowCount();
951 for (
int i = 0; i < rowCount; i++ )
959 symbolButton =
dynamic_cast<QgsSymbolButton *
>( mSymbolsList->cellWidget( i, 2 ) );
994 margins.
setLeft( mSpinLeftMargin->value() );
995 margins.
setRight( mSpinRightMargin->value() );
996 margins.
setTop( mSpinTopMargin->value() );
997 margins.
setBottom( mSpinBottomMargin->value() );
1013 mSymbolsList->setColumnCount( 3 );
1014 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
1015 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
1016 mSymbolsList->setSortingEnabled(
false );
1017 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1018 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
1019 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
1020 mSymbolsList->horizontalHeader()->hide();
1021 mSymbolsList->verticalHeader()->hide();
1026 connect( mLabelCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1027 if ( mBlockChanges )
1032 mLabelFontButton->setDialogTitle( tr(
"Chart Label Font" ) );
1035 if ( mBlockChanges )
1040 connect( mLabelFormatButton, &QPushButton::clicked,
this, [
this] {
1043 widget->
setFormat( mNumericFormat.get() );
1045 mNumericFormat.reset( widget->
format() );
1051 mSpinLeftMargin->setClearValue( 0 );
1052 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1053 if ( mBlockChanges )
1058 mSpinRightMargin->setClearValue( 0 );
1059 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1060 if ( mBlockChanges )
1065 mSpinTopMargin->setClearValue( 0 );
1066 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1067 if ( mBlockChanges )
1072 mSpinBottomMargin->setClearValue( 0 );
1073 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1074 if ( mBlockChanges )
1079 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mAddSymbolPushButton_clicked );
1080 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked );
1082 mLabelFontButton->registerExpressionContextGenerator(
this );
1090void QgsPieChartPlotWidget::mAddSymbolPushButton_clicked()
1092 const int row = mSymbolsList->rowCount();
1093 mSymbolsList->insertRow( row );
1095 QTableWidgetItem *item =
new QTableWidgetItem();
1096 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1097 mSymbolsList->setItem( row, 0, item );
1106 if ( mBlockChanges )
1110 mSymbolsList->setCellWidget( row, 1, symbolButton );
1113 QgsColorRampButton *colorRampButton =
new QgsColorRampButton(
this );
1117 if ( mBlockChanges )
1121 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1126void QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked()
1128 QTableWidgetItem *item = mSymbolsList->currentItem();
1134 mSymbolsList->removeRow( mSymbolsList->row( item ) );
1149 mSymbolsList->clear();
1151 for (
int i = 0; i < symbolCount; i++ )
1153 const int row = mSymbolsList->rowCount();
1154 mSymbolsList->insertRow( row );
1156 QTableWidgetItem *item =
new QTableWidgetItem();
1157 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1158 mSymbolsList->setItem( row, 0, item );
1167 if ( mBlockChanges )
1171 mSymbolsList->setCellWidget( row, 1, symbolButton );
1178 if ( mBlockChanges )
1182 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1186 mLabelFontButton->setTextFormat( chartPlot->
textFormat() );
1188 mLabelCombo->setCurrentIndex( mLabelCombo->findData( QVariant::fromValue( chartPlot->
labelType() ) ) );
1209 const int rowCount = mSymbolsList->rowCount();
1210 for (
int i = 0; i < rowCount; i++ )
1219 if ( colorRampButton )
1230 margins.
setLeft( mSpinLeftMargin->value() );
1231 margins.
setRight( mSpinRightMargin->value() );
1232 margins.
setTop( mSpinTopMargin->value() );
1233 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.