15 _mapped_data(datamap),
20 _layout =
new QGridLayout(
this );
33 plot->setWindowTitle(QString(
"PlotWidget ") + QString::number(
widget_uid++));
43 plot->setAttribute(Qt::WA_DeleteOnClose);
45 _layout->addWidget( plot, row, col );
47 _layout->setColumnStretch(col,1);
63 for (
unsigned col = 0; col <
colsCount(); col++ ) {
81 for (
unsigned row = 0; row <
rowsCount(); row++ )
92 QWidget *widgetA =
_layout->itemAtPosition(rowA, colA)->widget();
93 QWidget *widgetB =
_layout->itemAtPosition(rowB, colB)->widget();
98 _layout->addWidget(widgetA, rowB, colB);
99 _layout->addWidget(widgetB, rowA, colA);
109 for(
unsigned col = column_to_delete; col<
_num_cols-1; col++)
111 for(
unsigned row=0; row<
_num_rows; row++)
116 for(
unsigned row=0; row<
_num_rows; row++)
118 plotAt( row, _num_cols -1)->close();
120 _layout->setColumnStretch(_num_cols -1,0);
136 for(
unsigned row = row_to_delete; row<
_num_rows-1; row++)
138 for(
unsigned col = 0; col<
_num_cols; col++)
143 for(
unsigned col=0; col<
_num_cols; col++)
145 plotAt( _num_rows-1, col)->close();
147 _layout->setRowStretch(_num_rows -1,0);
159 for(
unsigned row = 0; row<
rowsCount(); row++)
169 for(
unsigned col = 0; col<
colsCount(); col++)
200 for (
int r=0; r <
_layout->rowCount(); r++)
202 auto plot =
plotAt(r, col);
203 if( plot && ! plot->isEmpty() ) {
212 for (
int c=0; c<
_layout->columnCount(); c++)
214 auto plot =
plotAt(row, c);
215 if( plot && ! plot->isEmpty() ) {
225 QLayoutItem* item =
_layout->itemAtPosition(row,column);
235 QLayoutItem* item =
_layout->itemAtPosition(row,column);
255 double min,
double max,
double step )
267 QDomElement element = doc.createElement(
"plotmatrix");
269 element.setAttribute(
"rows",
_num_rows );
270 element.setAttribute(
"columns",
_num_cols );
272 for(
unsigned col = 0; col<
_num_cols; col++)
274 for(
unsigned row = 0; row<
_num_rows; row++)
279 child.setAttribute(
"row", row);
280 child.setAttribute(
"col", col);
282 element.appendChild( child );
290 if( !plotmatrix.hasAttribute(
"rows") || !plotmatrix.hasAttribute(
"columns") )
292 qWarning() <<
"No [rows] or [columns] attribute in <plotmatrix> XML file!";
295 unsigned rows = plotmatrix.attribute(
"rows").toUInt();
296 unsigned cols = plotmatrix.attribute(
"columns" ).toUInt();
304 QDomElement plot_element;
305 for ( plot_element = plotmatrix.firstChildElement(
"plot" ) ;
306 !plot_element.isNull();
307 plot_element = plot_element.nextSiblingElement(
"plot" ) )
309 if( !plot_element.hasAttribute(
"row") || !plot_element.hasAttribute(
"col") )
311 qWarning() <<
"No [row] or [col] attribute in <plot> XML file!";
314 unsigned row = plot_element.attribute(
"row").toUInt();
315 unsigned col = plot_element.attribute(
"col").toUInt();
330 for (
unsigned row = 0; row <
rowsCount(); row++ )
336 for (
unsigned col = 0; col <
colsCount(); col++ )
421 if( plot->
isEmpty() ==
false &&
422 modified_plot != plot &&
426 bound_act.setLeft( new_range.left() );
427 bound_act.setRight( new_range.right() );
456 double maxExtent = 0;
458 for (
unsigned i = 0;
i < COUNT;
i++ )
468 const double extent = sd->
extent( scaleWidget->font() );
469 if ( extent > maxExtent )
474 for (
unsigned i = 0;
i < COUNT;
i++ )
489 for (
unsigned col = 0; col <
colsCount(); col++ )
498 for (
unsigned row = 0; row <
rowsCount(); row++ )
void maximumZoomOutVertical()
QGridLayout * gridLayout()
void setAxisScale(QwtPlot::Axis axisId, unsigned row, unsigned col, double min, double max, double step=0)
bool isColumnEmpty(unsigned row) const
virtual double extent(const QFont &) const
Y axis right of the canvas.
QDomElement xmlSaveState(QDomDocument &doc) const
bool xmlLoadState(QDomElement &plotmatrix_element)
void swapPlots(unsigned rowA, unsigned colA, unsigned rowB, unsigned colB)
Y axis left of the canvas.
PlotWidget * plotAt(unsigned row, unsigned column)
const QString & name() const
const QwtScaleWidget * axisWidget(int axisId) const
unsigned plotCount() const
void alignScaleBorder(unsigned rowOrColumn, QwtPlot::Axis axisId)
void removeRow(unsigned row_to_delete)
unsigned colsCount() const
bool isRowEmpty(unsigned row) const
void alignAxes(unsigned rowOrColumn, QwtPlot::Axis axisId)
unsigned rowsCount() const
void on_legendSizeChanged(int point_size)
void on_singlePlotScaleChanged(PlotWidget *modified_plot, QRectF range)
PlotDataMapRef & _mapped_data
void plotAdded(PlotWidget *)
void setMinimumExtent(double)
Set a minimum for the extent.
PlotWidget * addPlotWidget(unsigned row, unsigned col)
A class for drawing scales.
void setHorizontalLink(bool linked)
void setName(const QString &new_name)
PlotMatrix(QString name, PlotDataMapRef &datamap, QWidget *parent=nullptr)
void removeColumn(unsigned column_to_delete)
void setAxisScale(int axisId, double min, double max, double step=0)
Disable autoscaling and specify a fixed scale for a selected axis.
void updateAxes()
Rebuild the axes scales.
void maximumZoomOutHorizontal()