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()
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, &QgsBarChartPlotWidget::updateXAxisProperties );
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 ) );
382void QgsBarChartPlotWidget::updateXAxisProperties()
386 mLabelMinXAxis->setEnabled( enable );
387 mSpinMinXAxis->setEnabled( enable );
388 mDDBtnMinXAxis->setEnabled( enable );
389 mLabelMaxXAxis->setEnabled( enable );
390 mSpinMaxXAxis->setEnabled( enable );
391 mDDBtnMaxXAxis->setEnabled( enable );
393 mXAxisMajorIntervalLabel->setEnabled( enable );
394 mXAxisMajorIntervalSpin->setEnabled( enable );
395 mDDBtnXAxisMajorInterval->setEnabled( enable );
396 mXAxisMajorLinesLabel->setEnabled( enable );
397 mXAxisMajorLinesSymbolButton->setEnabled( enable );
398 mXAxisMinorIntervalLabel->setEnabled( enable );
399 mXAxisMinorIntervalSpin->setEnabled( enable );
400 mDDBtnXAxisMinorInterval->setEnabled( enable );
401 mXAxisMinorLinesLabel->setEnabled( enable );
402 mXAxisMinorLinesSymbolButton->setEnabled( enable );
415 mSymbolsList->clear();
417 for (
int i = 0; i < symbolCount; i++ )
419 const int row = mSymbolsList->rowCount();
420 mSymbolsList->insertRow( row );
422 QTableWidgetItem *item =
new QTableWidgetItem();
423 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
424 mSymbolsList->setItem( row, 0, item );
436 mSymbolsList->setCellWidget( row, 1, symbolButton );
439 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
440 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
441 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
442 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
453 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
455 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
458 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
459 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
474 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
475 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
476 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
477 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
512 const int rowCount = mSymbolsList->rowCount();
513 for (
int i = 0; i < rowCount; i++ )
552 margins.
setLeft( mSpinLeftMargin->value() );
553 margins.
setRight( mSpinRightMargin->value() );
554 margins.
setTop( mSpinTopMargin->value() );
555 margins.
setBottom( mSpinBottomMargin->value() );
572 mSymbolsList->setColumnCount( 3 );
573 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
574 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
575 mSymbolsList->setSortingEnabled(
false );
576 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
577 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
578 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
579 mSymbolsList->horizontalHeader()->hide();
580 mSymbolsList->verticalHeader()->hide();
582 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mAddSymbolPushButton_clicked );
583 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked );
585 mSpinMinXAxis->setClearValue( 0 );
586 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
592 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
598 mSpinMinYAxis->setClearValue( 0 );
599 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
605 mSpinMaxYAxis->setClearValue( 0 );
606 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
628 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
634 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
640 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
662 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
668 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
674 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
696 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
699 widget->
setFormat( mXAxisNumericFormat.get() );
701 mXAxisNumericFormat.reset( widget->
format() );
707 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
710 widget->
setFormat( mYAxisNumericFormat.get() );
712 mYAxisNumericFormat.reset( widget->
format() );
718 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
719 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
735 mSpinLeftMargin->setClearValue( 0 );
736 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
742 mSpinRightMargin->setClearValue( 0 );
743 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
749 mSpinTopMargin->setClearValue( 0 );
750 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
756 mSpinBottomMargin->setClearValue( 0 );
757 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
765 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsLineChartPlotWidget::updateXAxisProperties );
766 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
777 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
783 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
784 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
785 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
786 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
787 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
788 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
789 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
790 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
810void QgsLineChartPlotWidget::mAddSymbolPushButton_clicked()
812 const int row = mSymbolsList->rowCount();
813 mSymbolsList->insertRow( row );
815 QTableWidgetItem *item =
new QTableWidgetItem();
816 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
817 mSymbolsList->setItem( row, 0, item );
830 mSymbolsList->setCellWidget( row, 1, symbolButton );
833 symbolButton =
new QgsSymbolButton(
this );
844 mSymbolsList->setCellWidget( row, 2, symbolButton );
849void QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked()
851 QTableWidgetItem *item = mSymbolsList->currentItem();
857 mSymbolsList->removeRow( mSymbolsList->row( item ) );
862void QgsLineChartPlotWidget::updateXAxisProperties()
866 mLabelMinXAxis->setEnabled( enable );
867 mSpinMinXAxis->setEnabled( enable );
868 mDDBtnMinXAxis->setEnabled( enable );
869 mLabelMaxXAxis->setEnabled( enable );
870 mSpinMaxXAxis->setEnabled( enable );
871 mDDBtnMaxXAxis->setEnabled( enable );
873 mXAxisMajorIntervalLabel->setEnabled( enable );
874 mXAxisMajorIntervalSpin->setEnabled( enable );
875 mDDBtnXAxisMajorInterval->setEnabled( enable );
876 mXAxisMajorLinesLabel->setEnabled( enable );
877 mXAxisMajorLinesSymbolButton->setEnabled( enable );
878 mXAxisMinorIntervalLabel->setEnabled( enable );
879 mXAxisMinorIntervalSpin->setEnabled( enable );
880 mDDBtnXAxisMinorInterval->setEnabled( enable );
881 mXAxisMinorLinesLabel->setEnabled( enable );
882 mXAxisMinorLinesSymbolButton->setEnabled( enable );
895 mSymbolsList->clear();
897 for (
int i = 0; i < symbolCount; i++ )
899 const int row = mSymbolsList->rowCount();
900 mSymbolsList->insertRow( row );
902 QTableWidgetItem *item =
new QTableWidgetItem();
903 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
904 mSymbolsList->setItem( row, 0, item );
917 mSymbolsList->setCellWidget( row, 1, symbolButton );
931 mSymbolsList->setCellWidget( row, 2, symbolButton );
934 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
935 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
936 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
937 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
948 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
949 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
951 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
952 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
967 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
968 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
969 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
970 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
1005 const int rowCount = mSymbolsList->rowCount();
1006 for (
int i = 0; i < rowCount; i++ )
1014 symbolButton =
dynamic_cast<QgsSymbolButton *
>( mSymbolsList->cellWidget( i, 2 ) );
1049 margins.
setLeft( mSpinLeftMargin->value() );
1050 margins.
setRight( mSpinRightMargin->value() );
1051 margins.
setTop( mSpinTopMargin->value() );
1052 margins.
setBottom( mSpinBottomMargin->value() );
1069 mSymbolsList->setColumnCount( 3 );
1070 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
1071 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
1072 mSymbolsList->setSortingEnabled(
false );
1073 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1074 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
1075 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
1076 mSymbolsList->horizontalHeader()->hide();
1077 mSymbolsList->verticalHeader()->hide();
1082 connect( mLabelCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1083 if ( mBlockChanges )
1088 mLabelFontButton->setDialogTitle( tr(
"Chart Label Font" ) );
1091 if ( mBlockChanges )
1096 connect( mLabelFormatButton, &QPushButton::clicked,
this, [
this] {
1099 widget->
setFormat( mNumericFormat.get() );
1101 mNumericFormat.reset( widget->
format() );
1107 mSpinLeftMargin->setClearValue( 0 );
1108 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1109 if ( mBlockChanges )
1114 mSpinRightMargin->setClearValue( 0 );
1115 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1116 if ( mBlockChanges )
1121 mSpinTopMargin->setClearValue( 0 );
1122 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1123 if ( mBlockChanges )
1128 mSpinBottomMargin->setClearValue( 0 );
1129 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1130 if ( mBlockChanges )
1135 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mAddSymbolPushButton_clicked );
1136 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked );
1138 mLabelFontButton->registerExpressionContextGenerator(
this );
1146void QgsPieChartPlotWidget::mAddSymbolPushButton_clicked()
1148 const int row = mSymbolsList->rowCount();
1149 mSymbolsList->insertRow( row );
1151 QTableWidgetItem *item =
new QTableWidgetItem();
1152 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1153 mSymbolsList->setItem( row, 0, item );
1162 if ( mBlockChanges )
1166 mSymbolsList->setCellWidget( row, 1, symbolButton );
1169 QgsColorRampButton *colorRampButton =
new QgsColorRampButton(
this );
1173 if ( mBlockChanges )
1177 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1182void QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked()
1184 QTableWidgetItem *item = mSymbolsList->currentItem();
1190 mSymbolsList->removeRow( mSymbolsList->row( item ) );
1205 mSymbolsList->clear();
1207 for (
int i = 0; i < symbolCount; i++ )
1209 const int row = mSymbolsList->rowCount();
1210 mSymbolsList->insertRow( row );
1212 QTableWidgetItem *item =
new QTableWidgetItem();
1213 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1214 mSymbolsList->setItem( row, 0, item );
1223 if ( mBlockChanges )
1227 mSymbolsList->setCellWidget( row, 1, symbolButton );
1234 if ( mBlockChanges )
1238 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1242 mLabelFontButton->setTextFormat( chartPlot->
textFormat() );
1244 mLabelCombo->setCurrentIndex( mLabelCombo->findData( QVariant::fromValue( chartPlot->
labelType() ) ) );
1265 const int rowCount = mSymbolsList->rowCount();
1266 for (
int i = 0; i < rowCount; i++ )
1275 if ( colorRampButton )
1286 margins.
setLeft( mSpinLeftMargin->value() );
1287 margins.
setRight( mSpinRightMargin->value() );
1288 margins.
setTop( mSpinTopMargin->value() );
1289 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.