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 ) {
307 connect( mXAxisLabelSuffixEdit, &QLineEdit::textChanged,
this, [
this] {
318 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
324 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
325 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
326 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
327 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
328 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
329 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
330 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
331 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
351void QgsBarChartPlotWidget::mAddSymbolPushButton_clicked()
353 const int row = mSymbolsList->rowCount();
354 mSymbolsList->insertRow( row );
356 QTableWidgetItem *item =
new QTableWidgetItem();
357 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
358 mSymbolsList->setItem( row, 0, item );
370 mSymbolsList->setCellWidget( row, 1, symbolButton );
375void QgsBarChartPlotWidget::mRemoveSymbolPushButton_clicked()
377 QTableWidgetItem *item = mSymbolsList->currentItem();
383 mSymbolsList->removeRow( mSymbolsList->row( item ) );
388void QgsBarChartPlotWidget::updateXAxisProperties()
392 mXAxisLabelSuffixLabel->setEnabled( enable );
393 mXAxisLabelSuffixEdit->setEnabled( enable );
394 mLabelMinXAxis->setEnabled( enable );
395 mSpinMinXAxis->setEnabled( enable );
396 mDDBtnMinXAxis->setEnabled( enable );
397 mLabelMaxXAxis->setEnabled( enable );
398 mSpinMaxXAxis->setEnabled( enable );
399 mDDBtnMaxXAxis->setEnabled( enable );
401 mXAxisMajorIntervalLabel->setEnabled( enable );
402 mXAxisMajorIntervalSpin->setEnabled( enable );
403 mDDBtnXAxisMajorInterval->setEnabled( enable );
404 mXAxisMajorLinesLabel->setEnabled( enable );
405 mXAxisMajorLinesSymbolButton->setEnabled( enable );
406 mXAxisMinorIntervalLabel->setEnabled( enable );
407 mXAxisMinorIntervalSpin->setEnabled( enable );
408 mDDBtnXAxisMinorInterval->setEnabled( enable );
409 mXAxisMinorLinesLabel->setEnabled( enable );
410 mXAxisMinorLinesSymbolButton->setEnabled( enable );
423 mSymbolsList->clear();
425 for (
int i = 0; i < symbolCount; i++ )
427 const int row = mSymbolsList->rowCount();
428 mSymbolsList->insertRow( row );
430 QTableWidgetItem *item =
new QTableWidgetItem();
431 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
432 mSymbolsList->setItem( row, 0, item );
444 mSymbolsList->setCellWidget( row, 1, symbolButton );
447 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
448 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
449 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
450 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
461 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
463 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
466 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
468 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
483 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
484 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
485 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
486 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
521 const int rowCount = mSymbolsList->rowCount();
522 for (
int i = 0; i < rowCount; i++ )
562 margins.
setLeft( mSpinLeftMargin->value() );
563 margins.
setRight( mSpinRightMargin->value() );
564 margins.
setTop( mSpinTopMargin->value() );
565 margins.
setBottom( mSpinBottomMargin->value() );
582 mSymbolsList->setColumnCount( 3 );
583 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
584 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
585 mSymbolsList->setSortingEnabled(
false );
586 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
587 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
588 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
589 mSymbolsList->horizontalHeader()->hide();
590 mSymbolsList->verticalHeader()->hide();
592 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mAddSymbolPushButton_clicked );
593 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked );
595 mSpinMinXAxis->setClearValue( 0 );
596 connect( mSpinMinXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
602 connect( mSpinMaxXAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
608 mSpinMinYAxis->setClearValue( 0 );
609 connect( mSpinMinYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
615 mSpinMaxYAxis->setClearValue( 0 );
616 connect( mSpinMaxYAxis, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
638 connect( mXAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
644 connect( mXAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
650 connect( mXAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
672 connect( mYAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
678 connect( mYAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
684 connect( mYAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
706 connect( mXAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
709 widget->
setFormat( mXAxisNumericFormat.get() );
711 mXAxisNumericFormat.reset( widget->
format() );
717 connect( mYAxisLabelFormatButton, &QPushButton::clicked,
this, [
this] {
720 widget->
setFormat( mYAxisNumericFormat.get() );
722 mYAxisNumericFormat.reset( widget->
format() );
728 mXAxisLabelFontButton->setDialogTitle( tr(
"X Axis Label Font" ) );
729 mYAxisLabelFontButton->setDialogTitle( tr(
"Y Axis Label Font" ) );
745 mSpinLeftMargin->setClearValue( 0 );
746 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
752 mSpinRightMargin->setClearValue( 0 );
753 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
759 mSpinTopMargin->setClearValue( 0 );
760 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
766 mSpinBottomMargin->setClearValue( 0 );
767 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
775 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsLineChartPlotWidget::updateXAxisProperties );
776 connect( mXAxisTypeCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
782 connect( mXAxisLabelSuffixEdit, &QLineEdit::textChanged,
this, [
this] {
793 connect( mXAxisLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
799 mXAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
800 mXAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
801 mXAxisLabelFontButton->registerExpressionContextGenerator(
this );
802 mYAxisMajorLinesSymbolButton->registerExpressionContextGenerator(
this );
803 mYAxisMinorLinesSymbolButton->registerExpressionContextGenerator(
this );
804 mYAxisLabelFontButton->registerExpressionContextGenerator(
this );
805 mChartBackgroundSymbolButton->registerExpressionContextGenerator(
this );
806 mChartBorderSymbolButton->registerExpressionContextGenerator(
this );
826void QgsLineChartPlotWidget::mAddSymbolPushButton_clicked()
828 const int row = mSymbolsList->rowCount();
829 mSymbolsList->insertRow( row );
831 QTableWidgetItem *item =
new QTableWidgetItem();
832 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
833 mSymbolsList->setItem( row, 0, item );
846 mSymbolsList->setCellWidget( row, 1, symbolButton );
849 symbolButton =
new QgsSymbolButton(
this );
860 mSymbolsList->setCellWidget( row, 2, symbolButton );
865void QgsLineChartPlotWidget::mRemoveSymbolPushButton_clicked()
867 QTableWidgetItem *item = mSymbolsList->currentItem();
873 mSymbolsList->removeRow( mSymbolsList->row( item ) );
878void QgsLineChartPlotWidget::updateXAxisProperties()
882 mXAxisLabelSuffixLabel->setEnabled( enable );
883 mXAxisLabelSuffixEdit->setEnabled( enable );
884 mLabelMinXAxis->setEnabled( enable );
885 mSpinMinXAxis->setEnabled( enable );
886 mDDBtnMinXAxis->setEnabled( enable );
887 mLabelMaxXAxis->setEnabled( enable );
888 mSpinMaxXAxis->setEnabled( enable );
889 mDDBtnMaxXAxis->setEnabled( enable );
891 mXAxisMajorIntervalLabel->setEnabled( enable );
892 mXAxisMajorIntervalSpin->setEnabled( enable );
893 mDDBtnXAxisMajorInterval->setEnabled( enable );
894 mXAxisMajorLinesLabel->setEnabled( enable );
895 mXAxisMajorLinesSymbolButton->setEnabled( enable );
896 mXAxisMinorIntervalLabel->setEnabled( enable );
897 mXAxisMinorIntervalSpin->setEnabled( enable );
898 mDDBtnXAxisMinorInterval->setEnabled( enable );
899 mXAxisMinorLinesLabel->setEnabled( enable );
900 mXAxisMinorLinesSymbolButton->setEnabled( enable );
913 mSymbolsList->clear();
915 for (
int i = 0; i < symbolCount; i++ )
917 const int row = mSymbolsList->rowCount();
918 mSymbolsList->insertRow( row );
920 QTableWidgetItem *item =
new QTableWidgetItem();
921 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
922 mSymbolsList->setItem( row, 0, item );
935 mSymbolsList->setCellWidget( row, 1, symbolButton );
949 mSymbolsList->setCellWidget( row, 2, symbolButton );
952 mSpinMinXAxis->setValue( chartPlot->
xMinimum() );
953 mSpinMaxXAxis->setValue( chartPlot->
xMaximum() );
954 mSpinMinYAxis->setValue( chartPlot->
yMinimum() );
955 mSpinMaxYAxis->setValue( chartPlot->
yMaximum() );
966 mXAxisLabelFontButton->setTextFormat( chartPlot->
xAxis().
textFormat() );
967 mYAxisLabelFontButton->setTextFormat( chartPlot->
yAxis().
textFormat() );
969 mXAxisTypeCombo->setCurrentIndex( mXAxisTypeCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
type() ) ) );
971 mXAxisLabelsCombo->setCurrentIndex( mXAxisLabelsCombo->findData( QVariant::fromValue( chartPlot->
xAxis().
labelSuffixPlacement() ) ) );
986 mSpinLeftMargin->setValue( chartPlot->
margins().
left() );
987 mSpinRightMargin->setValue( chartPlot->
margins().
right() );
988 mSpinTopMargin->setValue( chartPlot->
margins().
top() );
989 mSpinBottomMargin->setValue( chartPlot->
margins().
bottom() );
1024 const int rowCount = mSymbolsList->rowCount();
1025 for (
int i = 0; i < rowCount; i++ )
1033 symbolButton =
dynamic_cast<QgsSymbolButton *
>( mSymbolsList->cellWidget( i, 2 ) );
1069 margins.
setLeft( mSpinLeftMargin->value() );
1070 margins.
setRight( mSpinRightMargin->value() );
1071 margins.
setTop( mSpinTopMargin->value() );
1072 margins.
setBottom( mSpinBottomMargin->value() );
1089 mSymbolsList->setColumnCount( 3 );
1090 mSymbolsList->setSelectionBehavior( QAbstractItemView::SelectRows );
1091 mSymbolsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
1092 mSymbolsList->setSortingEnabled(
false );
1093 mSymbolsList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1094 mSymbolsList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
1095 mSymbolsList->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
1096 mSymbolsList->horizontalHeader()->hide();
1097 mSymbolsList->verticalHeader()->hide();
1102 connect( mLabelCombo, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1103 if ( mBlockChanges )
1108 mLabelFontButton->setDialogTitle( tr(
"Chart Label Font" ) );
1111 if ( mBlockChanges )
1116 connect( mLabelFormatButton, &QPushButton::clicked,
this, [
this] {
1119 widget->
setFormat( mNumericFormat.get() );
1121 mNumericFormat.reset( widget->
format() );
1127 mSpinLeftMargin->setClearValue( 0 );
1128 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1129 if ( mBlockChanges )
1134 mSpinRightMargin->setClearValue( 0 );
1135 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1136 if ( mBlockChanges )
1141 mSpinTopMargin->setClearValue( 0 );
1142 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1143 if ( mBlockChanges )
1148 mSpinBottomMargin->setClearValue( 0 );
1149 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double ) {
1150 if ( mBlockChanges )
1155 connect( mAddSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mAddSymbolPushButton_clicked );
1156 connect( mRemoveSymbolPushButton, &QPushButton::clicked,
this, &QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked );
1158 mLabelFontButton->registerExpressionContextGenerator(
this );
1166void QgsPieChartPlotWidget::mAddSymbolPushButton_clicked()
1168 const int row = mSymbolsList->rowCount();
1169 mSymbolsList->insertRow( row );
1171 QTableWidgetItem *item =
new QTableWidgetItem();
1172 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1173 mSymbolsList->setItem( row, 0, item );
1182 if ( mBlockChanges )
1186 mSymbolsList->setCellWidget( row, 1, symbolButton );
1189 QgsColorRampButton *colorRampButton =
new QgsColorRampButton(
this );
1193 if ( mBlockChanges )
1197 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1202void QgsPieChartPlotWidget::mRemoveSymbolPushButton_clicked()
1204 QTableWidgetItem *item = mSymbolsList->currentItem();
1210 mSymbolsList->removeRow( mSymbolsList->row( item ) );
1225 mSymbolsList->clear();
1227 for (
int i = 0; i < symbolCount; i++ )
1229 const int row = mSymbolsList->rowCount();
1230 mSymbolsList->insertRow( row );
1232 QTableWidgetItem *item =
new QTableWidgetItem();
1233 item->setData( Qt::DisplayRole, tr(
"Symbol" ) );
1234 mSymbolsList->setItem( row, 0, item );
1243 if ( mBlockChanges )
1247 mSymbolsList->setCellWidget( row, 1, symbolButton );
1254 if ( mBlockChanges )
1258 mSymbolsList->setCellWidget( row, 2, colorRampButton );
1262 mLabelFontButton->setTextFormat( chartPlot->
textFormat() );
1264 mLabelCombo->setCurrentIndex( mLabelCombo->findData( QVariant::fromValue( chartPlot->
labelType() ) ) );
1285 const int rowCount = mSymbolsList->rowCount();
1286 for (
int i = 0; i < rowCount; i++ )
1295 if ( colorRampButton )
1306 margins.
setLeft( mSpinLeftMargin->value() );
1307 margins.
setRight( mSpinRightMargin->value() );
1308 margins.
setTop( mSpinTopMargin->value() );
1309 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 setLabelSuffix(const QString &suffix)
Sets the axis label suffix.
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.
QString labelSuffix() const
Returns the axis label suffix, or an empty string if no label suffix is to be used.
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.