Example #1
0
void HistPlot::populate()
{
	setTitle("Watching TV during a weekend");
	setAxisTitle(QwtPlot::yLeft, "Number of People");
	setAxisTitle(QwtPlot::xBottom, "Number of Hours");

	QwtPlotGrid *grid = new QwtPlotGrid;
	grid->enableX(false);
	grid->enableY(true);
	grid->enableXMin(false);
	grid->enableYMin(false);
	grid->setMajPen(QPen(Qt::black, 0, Qt::SolidLine));
	grid->attach(this);

	const double juneValues[] = { 7, 19, 24, 32, 10, 5, 3 };
	const double novemberValues[] = { 4, 15, 22, 34, 13, 8, 4 };

	Histogram *histogramJune = new Histogram("Summer", Qt::red);
	histogramJune->setValues(
		sizeof(juneValues) / sizeof(double), juneValues);
	histogramJune->attach(this);

	Histogram *histogramNovember = new Histogram("Winter", Qt::blue);
	histogramNovember->setValues(
		sizeof(novemberValues) / sizeof(double), novemberValues);
	histogramNovember->attach(this);
}
Example #2
0
void Plot::populate()
{
    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setMinorPen( Qt::black, 0, Qt::DashLine );
    grid->enableXMin( true );
    grid->attach( this );

    QwtPlotCurve *curve = new QwtPlotCurve();
    curve->setTitle("Some Points");
    curve->setPen( Qt::blue, 4 ),
          curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );

    QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                       QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
    curve->setSymbol( symbol );

    QPolygonF points;
    points << QPointF( 10.0, 4.4 )
           << QPointF( 100.0, 3.0 ) << QPointF( 200.0, 4.5 )
           << QPointF( 300.0, 6.8 ) << QPointF( 400.0, 7.9 )
           << QPointF( 500.0, 7.1 ) << QPointF( 600.0, 7.9 )
           << QPointF( 700.0, 7.1 ) << QPointF( 800.0, 5.4 )
           << QPointF( 900.0, 2.8 ) << QPointF( 1000.0, 3.6 );
    curve->setSamples( points );
    curve->attach( this );
}
Example #3
0
// MyPlot2D::MyPlot2D(QWidget *parent, const char *name)
MyPlot2D::MyPlot2D( QWidget *parent ):
        QwtPlot(parent) {
    setAutoReplot( false );

    setTitle( "Comparison of WATER FIT against Measurements" );

    QwtPlotCanvas *canvas = new QwtPlotCanvas();
    canvas->setBorderRadius( 10 );

    setCanvas( canvas );
    setCanvasBackground( QColor( "LightGray" ) );

    // legend
    // QwtLegend *legend = new QwtLegend;
    // insertLegend( legend, QwtPlot::BottomLegend );

    // grid
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin( true );
    grid->setMajorPen( Qt::white, 0, Qt::DotLine );
    grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
    grid->attach( this );

    // axes
    enableAxis( QwtPlot::yRight );
    setAxisTitle( QwtPlot::xBottom, "Distance from CAX (cm)" );
    setAxisTitle( QwtPlot::yLeft, "Relative Output Factor" );
    // setAxisTitle( QwtPlot::yRight, "Phase [deg]" );

    // setAxisMaxMajor( QwtPlot::xBottom, 6 );
    // setAxisMaxMinor( QwtPlot::xBottom, 9 );
    // setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );

    setAutoReplot( true );
}
EcgCh::EcgCh(QWidget *parent) :
    QwtPlot(parent)
{
     setMinimumHeight(10);
     setMinimumWidth(10);
     QwtPlotGrid *grid = new QwtPlotGrid;
     grid->enableXMin(true);
     grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
     grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
     grid->attach(this);
     setAxisTitle(QwtPlot::xBottom, "Czas [s]");
     setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]");
//     picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas());
//     picker->setStateMachine(new QwtPickerDragPointMachine());
//     picker->setRubberBandPen(QColor(Qt::green));
//     picker->setRubberBand(QwtPicker::CrossRubberBand);
//     picker->setTrackerPen(QColor(Qt::white));
     curve = new QwtPlotCurve("signal");
     curve->setYAxis(QwtPlot::yLeft);
     curve->attach(this);
     peaksCurve = new QwtPlotCurve("signal");
     peaksCurve->setYAxis(QwtPlot::yLeft);
     peaksCurve->setStyle(QwtPlotCurve::CurveStyle::Dots);
     peaksCurve->setPen(QPen(Qt::red, 5));
     peaksCurve->attach(this);
     samples = new QVector<QPointF>;
     data = new QwtPointSeriesData;
     peaksSamples = new QVector<QPointF>;
     peaksData = new QwtPointSeriesData;
     replot();
}
Example #5
0
Plot::Plot( QWidget *parent ):
    QwtPlot( parent )
{
    setAutoFillBackground( true );
    setPalette( Qt::darkGray );
    setCanvasBackground( Qt::white );

    plotLayout()->setAlignCanvasToScales( true );

    initAxis( QwtAxis::yLeft, "Local Time", Qt::LocalTime );
    initAxis( QwtAxis::yRight, 
        "Coordinated Universal Time ( UTC )", Qt::UTC );

    QwtPlotPanner *panner = new QwtPlotPanner( canvas() );
    QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( canvas() );

    for ( int axis = 0; axis < QwtAxis::PosCount; axis++ )
    {
        const bool on = QwtAxis::isYAxis( axis );

        setAxisVisible( axis, on );
        panner->setAxisEnabled( axis, on );
        magnifier->setAxisEnabled( axis, on );
    }

    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setMajorPen( Qt::black, 0, Qt::SolidLine );
    grid->setMinorPen( Qt::gray, 0 , Qt::SolidLine );
    grid->enableX( false );
    grid->enableXMin( false );
    grid->enableY( true );
    grid->enableYMin( true );

    grid->attach( this );
}
Example #6
0
SimDialog::SimDialog( QWidget * parent, Qt::WFlags f) 
	: QDialog(parent, f)
{
  setupUi(this);

  // setup the plot ...
  m_plot->setTitle("Comparing Similarity Measures");
  m_plot->insertLegend(new QwtLegend(), QwtPlot::BottomLegend);

  // set up the axes ...
  m_plot->setAxisTitle(QwtPlot::xBottom, "Variations");
  m_plot->setAxisScale(QwtPlot::xBottom, -10, 10);

  m_plot->setAxisTitle(QwtPlot::yLeft, "Similarity");
  m_plot->setAxisScale(QwtPlot::yLeft, -1.5, 1.5);

  // enable grid ...
  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->enableXMin(true);
  grid->enableYMin(true);
  grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
  grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
  grid->attach(m_plot);

  //  Insert zero line at y = 0
  QwtPlotMarker *mY = new QwtPlotMarker();
  mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
  mY->setLineStyle(QwtPlotMarker::HLine);
  mY->setYValue(0.0);
  mY->attach(m_plot);

  //  Insert zero line at x = 0
  QwtPlotMarker *mX = new QwtPlotMarker();
  mX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
  mX->setLineStyle(QwtPlotMarker::VLine);
  mX->setXValue(0.0);
  mX->attach(m_plot);

  // Insert new curves
  cReg = new QwtPlotCurve("Regular Similarity Measure");
  cReg->attach(m_plot);

  cOct = new QwtPlotCurve("Octree based Similarity Measure");
  cOct->attach(m_plot);

  // Set curve styles
  cReg->setPen(QPen(Qt::red, 2));
  cOct->setPen(QPen(Qt::blue, 2));

  // Populate the volume combos ...
  MainWindow* _win  = (MainWindow *)this->parent();
  viewer3d *  _view = (viewer3d *) _win->getViewer();
  QList<Volume*> _vols = _view->getVolumes();

  // append Volume names to combo boxes ...
  // Need to modify Volume class so that it stored patient name ...
  // More importantly modify PatientBrowser so that the data can be directly
  // loaded.
}
Example #7
0
StPlot::StPlot(QWidget* parent): 
  QwtPlot(parent),
  viewFactor(-1.0)
{
  setMinimumHeight(10);
  setMinimumWidth(10);
  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->enableXMin(true);
  grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
  grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
  grid->attach(this);
  setAxisTitle(QwtPlot::xBottom, "Czas [s]");
  setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]");
  
  curve = new QwtPlotCurve("Filtered signal");
  curve->setYAxis(QwtPlot::yLeft);
  curve->attach(this);

  ISOPoints = new QwtPlotCurve("ISO");
  ISOPoints->setStyle(QwtPlotCurve::NoCurve);
  ISOPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::green), QColor(Qt::green), QSize(5, 5)));
  ISOPoints->setYAxis(QwtPlot::yLeft);
  ISOPoints->attach(this);
  
  JPoints = new QwtPlotCurve("J");
  JPoints->setStyle(QwtPlotCurve::NoCurve);
  JPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::blue), QColor(Qt::blue), QSize(5, 5)));
  JPoints->setYAxis(QwtPlot::yLeft);
  JPoints->attach(this);
  
  STPoints = new QwtPlotCurve("ST");
  STPoints->setStyle(QwtPlotCurve::NoCurve);
  STPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::red), QColor(Qt::red), QSize(5, 5)));
  STPoints->setYAxis(QwtPlot::yLeft);
  STPoints->attach(this);

  RPoints = new QwtPlotCurve("R");
  RPoints->setStyle(QwtPlotCurve::NoCurve);
  RPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::yellow), QColor(Qt::yellow), QSize(5, 5)));
  RPoints->setYAxis(QwtPlot::yLeft);
  //RPoints->attach(this);

  legend = new QwtLegend();
  legend->setItemMode(QwtLegend::ReadOnlyItem);
  legend->setWhatsThis("Click on an item to show/hide the plot");
  this->insertLegend(legend, QwtPlot::RightLegend);
  
  samples = new QVector<QPointF>;
  data = new QwtPointSeriesData;
  replot();
  
  zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, canvas());
  zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect4, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect5, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect6, Qt::NoButton);
}
// Init X axis.
void DataPlot::setGridPlot()
{
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
    grid->attach(this);
}
Example #9
0
Plot::Plot(QWidget *parent):
    QwtPlot(parent),
    d_paintedPoints(0),
    d_interval(0.0, 10.0),
    d_timerId(-1)
{
    d_directPainter = new QwtPlotDirectPainter();

    setAutoReplot(false);

    // We don't need the cache here
    canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
    //canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);


#if defined(Q_WS_X11)
    // Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
    // works on X11. This has a nice effect on the performance.
    
    canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
    canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
#endif

    plotLayout()->setAlignCanvasToScales(true);

    setAxisTitle(QwtPlot::xBottom, "Time [s]");
    setAxisScale(QwtPlot::xBottom, d_interval.minValue(), d_interval.maxValue()); 
    setAxisScale(QwtPlot::yLeft, -200.0, 200.0);

    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setPen(QPen(Qt::gray, 0.0, Qt::DotLine));
    grid->enableX(true);
    grid->enableXMin(true);
    grid->enableY(true);
    grid->enableYMin(false);
    grid->attach(this);

    d_origin = new QwtPlotMarker();
    d_origin->setLineStyle(QwtPlotMarker::Cross);
    d_origin->setValue(d_interval.minValue() + d_interval.width() / 2.0, 0.0);
    d_origin->setLinePen(QPen(Qt::gray, 0.0, Qt::DashLine));
    d_origin->attach(this);

    d_curve = new QwtPlotCurve();
    d_curve->setStyle(QwtPlotCurve::Lines);
    d_curve->setPen(QPen(Qt::green));
#if 1
    d_curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
#endif
#if 1
    d_curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, false);
#endif
    d_curve->setData(new CurveData());
    d_curve->attach(this);
}
Example #10
0
QmitkHistogramWidget::QmitkHistogramWidget(QWidget * parent, bool showreport)
  : QDialog(parent)
{
  QBoxLayout *layout = new QVBoxLayout(this);

  //***histogram***

  QGroupBox *hgroupbox = new QGroupBox("", this);

  hgroupbox->setMinimumSize(900, 400);

  m_Plot = new QwtPlot(hgroupbox);
  m_Plot->setCanvasBackground(QColor(Qt::white));
  m_Plot->setTitle("Histogram");
  QwtText text = m_Plot->titleLabel()->text();
  text.setFont(QFont("Helvetica", 12, QFont::Normal));

  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->enableXMin(true);
  grid->enableYMin(true);
  grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
  grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
  grid->attach(m_Plot);

  layout->addWidget(hgroupbox);

  layout->setSpacing(20);

  if (showreport == true)
  {
    //***report***
    QGroupBox *rgroupbox = new QGroupBox("", this);

    rgroupbox->setMinimumSize(900, 400);

    QLabel *label = new QLabel("Gray  Value  Analysis", rgroupbox);
    label->setAlignment(Qt::AlignHCenter);
    label->setFont(QFont("Helvetica", 14, QFont::Bold));

    m_Textedit = new QTextEdit(rgroupbox);
    m_Textedit->setFont(QFont("Helvetica", 12, QFont::Normal));
    m_Textedit->setReadOnly(true);

    layout->addWidget(rgroupbox);
  }

  m_Picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
    QwtPicker::PointSelection, 
    QwtPlotPicker::NoRubberBand, QwtPicker::AlwaysOn, 
    m_Plot->canvas());

  connect(m_Picker, SIGNAL(selected(const QwtDoublePoint &)),
    SLOT(OnSelect(const QwtDoublePoint &)));
}
Example #11
0
RTVTPlotWindow::RTVTPlotWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RTVTPlotWindow)
{
    ui->setupUi(this);

    connect(ui->plotChannelListView, SIGNAL(clicked(QModelIndex)), this, SLOT(curveSelected(QModelIndex)));
    // Setup curves
    numberOfCurves = 10;
    startColorIndex = 0;
    channelListStringModel = new QStringListModel();
    channelListStringModel->setStringList(channelStringList);
    ui->plotChannelListView->setModel(channelListStringModel);

    // Setup the plot view
    ui->plotQwtView->setCanvasBackground(QColor(Qt::darkBlue));
    ui->plotQwtView->setTitle("Frequency Response of Amplifier");
    ui->plotQwtView->setTitle("Amplitude");
    ui->plotQwtView->setAxisTitle(QwtPlot::yLeft,"dBm");
    ui->plotQwtView->setAxisTitle(QwtPlot::xBottom,"Frequency (Hz)");

    // grid
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
    grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
    grid->attach(ui->plotQwtView);

    ui->plotQwtView->setAxisMaxMajor(QwtPlot::xBottom, 6);
    ui->plotQwtView->setAxisMaxMinor(QwtPlot::xBottom, 10);
    ui->plotQwtView->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine);

    //QwtPlotGrid *gridy = new QwtPlotGrid();
    //gridy->attach(ui->plotQwtView);


    /*QwtLog10ScaleEngine * log10SE = new QwtLog10ScaleEngine();
    double x1=0.0, x2=4.3, stepSize=0.1;

    log10SE->autoScale(100, x1, x2, stepSize);

    QwtLinearScaleEngine * yAxisEngine = new  QwtLinearScaleEngine();
    double y1=-100.0, y2 = 10.0, yStep = 10.0;

    yAxisEngine->autoScale(10, y1, y2, yStep);*/

    //ui->plotQwtView->setAxisScaleEngine(QwtPlot::xBottom,log10SE);
    //ui->plotQwtView->setAxisScaleEngine(QwtPlot::yLeft,yAxisEngine);

    //ui->plotQwtView->setAxis

    ui->plotQwtView->replot();

}
void GenericHistogramView::populate()
{
  QwtPlotGrid* grid = new QwtPlotGrid();
  grid->enableX(false);
  grid->enableY(true);
  grid->enableXMin(false);
  grid->enableYMin(false);
  grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
  grid->attach(_qwtPlot);

	for(unsigned int i = 0; i < _image->getNbChannels(); ++i)
	{
		imagein::Array<unsigned int>* histogram;
		if(_projection)
			histogram = new imagein::ProjectionHistogram(*_image, _value, _horizontal, *_rectangle, i);
		else
			histogram = new imagein::Histogram(*_image, i, *_rectangle);
		
		int values[histogram->getWidth()];

		for(unsigned int j = 0; j < histogram->getWidth(); ++j)
			values[j] = (*histogram)[j];
		
		GraphicalHistogram* graphicalHisto;
		switch(i)
		{
			case 0:
				if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2)
					graphicalHisto = new GraphicalHistogram("Black", Qt::black);
				else
					graphicalHisto = new GraphicalHistogram("Red", Qt::red);
			break;
			case 1:
				if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2)
					graphicalHisto = new GraphicalHistogram("Alpha", Qt::white);
				else
					graphicalHisto = new GraphicalHistogram("Green", Qt::green);
			break;
			case 2:
				graphicalHisto = new GraphicalHistogram("Blue", Qt::blue);
			break;
			case 3:
				graphicalHisto = new GraphicalHistogram("Alpha", Qt::black);
			break;
			default:
				graphicalHisto = new GraphicalHistogram("Default", Qt::black);
		}
		graphicalHisto->setValues(sizeof(values) / sizeof(int), values);
		if(_horizontal)
			graphicalHisto->setOrientation(Qt::Horizontal);
		graphicalHisto->attach(_qwtPlot);
    _graphicalHistos.push_back(graphicalHisto);
	}
}
Example #13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
//-----------------------------------------------------
    vBox = new QWidget;
    vBox->setWindowTitle( "Графік температури" );
    TempPlot *plot = new TempPlot;
    plot->setParent(this);
    plot->setTitle( "Графік температури" );
    QwtPlotGrid *grid;
    grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->setMajorPen(QPen(Qt::gray,0,Qt::DashLine));
    grid->setMinorPen((QPen(Qt::gray,0,Qt::DotLine)));
    grid->attach(plot);
    QwtPlotZoomer *zoom;
    zoom = new QwtPlotZoomer(plot->canvas());
    zoom->setRubberBandPen(QPen(Qt::white));
    const int margin = 1;
    plot->setContentsMargins( margin, margin, margin, margin );
    QVBoxLayout *layout = new QVBoxLayout( vBox );
    layout->addWidget( plot );
    vBox->resize( 650, 330);
//-----------------------------------------------------
    vBox2 = new QWidget;
    vBox2->setWindowTitle( "Графік рівня радіосигналу");
    RssiPlot *plot2 = new RssiPlot;
    plot2->setParent(this);
    plot2->setTitle( "Графік рівня радіосигналу" );
    QwtPlotGrid *grid2;
    grid2 = new QwtPlotGrid;
    grid2->enableXMin(true);
    grid2->setMajorPen(QPen(Qt::gray,0,Qt::DashLine));
    grid2->setMinorPen((QPen(Qt::gray,0,Qt::DotLine)));
    grid2->attach(plot2);
    QwtPlotZoomer *zoom2;
    zoom2 = new QwtPlotZoomer(plot2->canvas());
    zoom2->setRubberBandPen(QPen(Qt::white));
    const int margin2 = 1;
    plot2->setContentsMargins( margin2, margin2, margin2, margin2 );
    QVBoxLayout *layout2 = new QVBoxLayout( vBox2 );
    layout2->addWidget( plot2 );
    vBox2->resize( 650, 330 );
//-----------------------------------------------------
    timer = new QTimer(this);
    serial = new QSerialPort(this);
    QString str;
    foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) {
        str=serialPortInfo.portName();
        ui->comboBox_2->addItem(str);
    }
Example #14
0
MavPlot::MavPlot(QWidget *parent) : QwtPlot(parent), _havePrintColors(false) {
    setAutoReplot(false);
    setTitle("MAV System Data Plot");
    setCanvasBackground(QColor(Qt::darkGray));

    // legend
    QwtLegend *legend = new QwtLegend;
    insertLegend(legend, QwtPlot::BottomLegend);
    #if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0))
        legend->setItemMode(QwtLegend::ClickableItem);
        connect(this, SIGNAL(legendClicked(QwtPlotItem*)), SLOT(legendClicked(QwtPlotItem*)));
    #else
        legend->setDefaultItemMode(QwtLegendData::Clickable);        
        connect(legend, SIGNAL(clicked(const QVariant&, int)), SLOT(legendClickedNew(const QVariant&, int)));
    #endif    

    // grid
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    #if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0))
        grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
        grid->setMinPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine));
    #else
        grid->setMajorPen(QPen(Qt::gray, 0, Qt::DotLine));
        grid->setMinorPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine));
    #endif
    grid->attach(this);

    // axes
    //enableAxis(QwtPlot::yRight);
    setAxisTitle(QwtPlot::xBottom, "time");
    setAxisScaleDraw(QwtPlot::xBottom, new HumanReadableTime()); // no need to de-alloc or store, plot does it

    // A-B markers
    for (int i=0; i<2; i++) {
        _user_markers[i].setLineStyle(QwtPlotMarker::VLine);
        _user_markers[i].setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
        _user_markers[i].setLinePen(QPen(QColor(255, 140, 0), 0, Qt::SolidLine));
        _user_markers_visible[i] = false;
    }
    _user_markers[0].setLabel(QwtText("A"));
    _user_markers[1].setLabel(QwtText("B"));

    // data marker
    _data_marker.setLineStyle(QwtPlotMarker::VLine);
    _data_marker.setLinePen(QPen(QColor(255, 160, 47), 2, Qt::SolidLine));
    _data_marker.setLabel(QwtText("data"));
    _data_marker.setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
    _data_marker_visible = false;
    _data_marker.setZ(9999); // higher value -> paint on top of everything else

    setAutoReplot(true);
}
Example #15
0
int main(int argc, char **argv)
{
    QApplication a(argc, argv);

    QwtPlot plot;
    plot.setCanvasBackground(QColor(Qt::white));
    plot.setTitle("Histogram");

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
    grid->attach(&plot);

    HistogramItem *histogram = new HistogramItem();
    histogram->setColor(Qt::darkCyan);

    const int numValues = 20;

    QwtArray<QwtDoubleInterval> intervals(numValues);
    QwtArray<double> values(numValues);

    double pos = 0.0;
    for ( int i = 0; i < (int)intervals.size(); i++ )
    {
        const int width = 5 + rand() % 15;
        const int value = rand() % 100;

        intervals[i] = QwtDoubleInterval(pos, pos + double(width));
        values[i] = value; 

        pos += width;
    }

    histogram->setData(QwtIntervalData(intervals, values));
    histogram->attach(&plot);

    plot.setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
    plot.setAxisScale(QwtPlot::xBottom, 0.0, pos);
    plot.replot();

#if QT_VERSION < 0x040000
    a.setMainWidget(&plot);
#endif

    plot.resize(600,400);
    plot.show();

    return a.exec(); 
}
Example #16
0
void SpectrumWindow::createSpectrumPlot()
{
    m_pSpectrumPlot = new QwtPlot();
    m_pSpectrumPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    m_pSpectrumPlot->setMinimumSize(0, 0);
    m_pSpectrumPlot->setBaseSize(0, 0);
    m_pSpectrumPlot->enableAxis(QwtPlot::xBottom, true);
    m_pSpectrumPlot->enableAxis(QwtPlot::yLeft, true);
    QwtLogScaleEngine *pLogScale = new QwtLogScaleEngine();
    m_pSpectrumPlot->setAxisScaleEngine(QwtPlot::xBottom, pLogScale);
    m_pSpectrumPlot->setAxisAutoScale(QwtPlot::xBottom, false);
    m_pSpectrumPlot->setAxisScale(QwtPlot::xBottom, cMinFrequency, cMaxFrequency);
    m_pSpectrumPlot->setAxisFont(QwtPlot::xBottom, cAxisFont);
    m_pSpectrumPlot->setAxisFont(QwtPlot::yLeft, cAxisFont);
    m_pSpectrumPlot->setCanvasBackground(QColor(19, 19, 22));
    dynamic_cast<QwtPlotCanvas*>(m_pSpectrumPlot->canvas())->setFrameShadow(QFrame::Plain);

    m_pSpectrumPicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                          QwtPicker::CrossRubberBand,
                                          QwtPicker::AlwaysOn,
                                          m_pSpectrumPlot->canvas());
    m_pSpectrumPicker->setTrackerPen(QColor(128, 255, 255));

    QwtText title(tr("Frequency, Hz"));
    title.setFont(cAxisTitleFont);
    title.setColor(cAxisTitleColor);
    m_pSpectrumPlot->setAxisTitle(QwtPlot::xBottom, title);
    m_pSpectrumPlot->setAxisAutoScale(QwtPlot::yLeft, false);
    //m_pSpectrumPlot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0);
    m_pSpectrumPlot->setAxisScale(QwtPlot::yLeft, cDbScale, 0.0);
    m_yAxisScale = 1.0;

    QwtPlotGrid *pGrid = new QwtPlotGrid();
    pGrid->enableXMin(true);
    pGrid->setMajorPen(Qt::darkGray, 0, Qt::DotLine);
    pGrid->setMinorPen(Qt::gray, 0, Qt::DotLine);
    pGrid->attach(m_pSpectrumPlot);

    QPen pen;
    pen.setColor(cSpectrumColor);
    pen.setWidthF(1.0f);
    m_pSpectrumCurve = new QwtPlotCurve();
    m_pSpectrumCurve->setPen(pen);
    m_pSpectrumCurve->setBrush(cSpectrumFillColor);
    m_pSpectrumCurve->setBaseline(cDbScale - 50);   // Add offset to compensate plot margins
    m_pSpectrumCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    m_pSpectrumCurve->attach(m_pSpectrumPlot);
}
Example #17
0
void AnalogGraph::populate()
{
    QwtPlotGrid *grid = new QwtPlotGrid;

    grid->enableX(false);
    grid->enableY(false);
    grid->enableXMin(false);
    grid->enableYMin(false);
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));

    grid->attach(this);

    analogHistogram_ = new Histogram("", QColor(80, 180, 220, 150));
    //analogHistogram_->setValues(analogChannels_);
    analogHistogram_->attach(this);
}
Example #18
0
int main( int argc, char **argv )
{
  //using HistogramItem = QwtPlotItem;
  using HistogramItem = QwtPlotHistogram;
  //using QwtIntervalData = QwtSeriesData<QwtIntervalSample>;

  QApplication a(argc, argv);
  QwtPlot plot;
  plot.setCanvasBackground(QColor(Qt::white));
  plot.setTitle("Histogram");
  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->enableXMin(true);
  grid->enableYMin(true);

  grid->setMajorPen(QPen(Qt::black, 0, Qt::DotLine));
  grid->setMinorPen(QPen(Qt::gray, 0 , Qt::DotLine));
  grid->attach(&plot);
  HistogramItem *histogram = new HistogramItem;
  //histogram->setColor(Qt::darkCyan);
  const int numValues = 20;
  //QwtArray<QwtDoubleInterval> intervals(numValues);
  QwtArray<QwtIntervalSample> intervals(numValues);
  QwtArray<double> values(numValues);
  double pos = 0.0;
  for ( int i = 0; i < (int)intervals.size(); i++ )
  {
    //const int width = 5 + rand() % 15;
    const int value = rand() % 100;
    //intervals[i] = QwtDoubleInterval(pos, pos + double(width));
    intervals[i] = QwtIntervalSample(value, pos, pos + double(width));
    //values[i] = value;
    pos += width;
  }

  //histogram->setData(QwtIntervalData(intervals, values));
  histogram->setSamples(intervals);
  //histogram->setSamples(QwtIntervalData(intervals, values));
  //QwtIntervalData d;
  //histogram->setData(d);
  histogram->attach(&plot);
  plot.setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
  plot.setAxisScale(QwtPlot::xBottom, 0.0, pos);
  plot.replot();
  plot.resize(600,400);
  plot.show();
  return a.exec();
}
Example #19
0
HarmPlot::HarmPlot(const QString& aDir, IRInfo anIi, QWidget *parent) throw (QLE) : QwtPlot(parent)
{
    this->setAttribute(Qt::WA_DeleteOnClose);

    this->dir = aDir;
    this->ii = anIi;

    this->data = (HarmData**) new char[sizeof(HarmData*) * (MAX_HARM - 1)];

    this->setAutoReplot(false);
    this->setCanvasBackground(BG_COLOR);

    this->setAxisScale(QwtPlot::yLeft, -120.0, 20.0);
    this->setAxisMaxMajor(QwtPlot::yLeft, 7);
    this->setAxisMaxMinor(QwtPlot::yLeft, 10);

    this->setAxisMaxMajor(QwtPlot::xBottom, 6);
    this->setAxisMaxMinor(QwtPlot::xBottom, 10);
#if QWT_VERSION > 0x060000
    QwtLogScaleEngine* logEngine = new QwtLogScaleEngine(10.0);
#else
    QwtLog10ScaleEngine* logEngine = new QwtLog10ScaleEngine();
#endif
    this->setAxisScaleEngine(QwtPlot::xBottom, logEngine);

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
#if QWT_VERSION > 0x060000
    grid->setMajorPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
    grid->setMinorPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#else
    grid->setMajPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
    grid->setMinPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#endif
    grid->attach(this);

    this->addCurves();

    QwtPlotPanner* panner = new QwtPlotPanner(this->canvas());
    panner->setMouseButton(Qt::MidButton);
    panner->setEnabled(true);

    this->setAutoReplot(true);

}
void ICResultChart::populate()
{
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableX( false );
    grid->enableY( true );
    grid->enableXMin( false );
    grid->enableYMin( false );
    grid->setMajorPen( Qt::black, 0, Qt::DotLine );
    grid->attach( this );

    QColor color = Qt::blue;
    color.setAlpha(180);

    QwtColumnSymbol *symbol = new QwtColumnSymbol(QwtColumnSymbol::Box);
    symbol->setLineWidth(2);
    symbol->setFrameStyle(QwtColumnSymbol::Raised);
    symbol->setPalette(QPalette(color));

    d_barChartItem->setSymbol(symbol);

    QVector<double> samples;

    QMap<QString, int>::const_iterator i = result.constBegin();
    while (i != result.constEnd()) {
        samples.append(i.value());
        ++i;
    }

    d_barChartItem->setSamples(samples);

    double k = (0.0 + SPACING_RATIO) / MARGIN_RATIO;

    double m = (0.0 + WINDOW_WIDTH - BAR_WIDTH) / (2 + k * (result.size() - 1));
    int margin = static_cast<int>(m);
    int spacing = static_cast<int>(m * k);

    if (spacing < MIN_SPACING) spacing = MIN_SPACING;
    if (margin < MIN_MARGIN) margin = MIN_MARGIN;

    d_barChartItem->setSpacing(spacing);
    d_barChartItem->setMargin(100);
    //d_barChartItem->setLayoutPolicy(QwtPlotAbstractBarChart::FixedSampleSize);
    //d_barChartItem->setLayoutHint(BAR_WIDTH);

}
Example #21
0
void HistPlot::setValueHist(const vector<double>& histogram, int origin)
{
	setTitle("Histogram");
	setAxisTitle(QwtPlot::yLeft, "Count");
	setAxisTitle(QwtPlot::xBottom, "Value");

	QwtPlotGrid *grid = new QwtPlotGrid;
	grid->enableX(false);
	grid->enableY(true);
	grid->enableXMin(false);
	grid->enableYMin(false);
	grid->setMajPen(QPen(Qt::darkGreen, 0, Qt::SolidLine));
	grid->attach(this);

	Histogram *histogramJune = new Histogram("Summer", Qt::red);
	histogramJune->setValues(
		histogram.size(), &histogram[0], origin);
	histogramJune->attach(this);
}
Example #22
0
Spectrograph::Spectrograph(QWidget *parent):
    QwtPlot(parent)
{
    //real-time plotting
    d_directPainter = new QwtPlotDirectPainter();

    setAutoReplot( false );
    //all plot widgets will be displayed on the canvas
    setCanvas( new QwtPlotCanvas() );

    plotLayout()->setAlignCanvasToScales( true );
    //set plot title and range
    setAxisTitle( QwtPlot::xBottom, "Frequency (MHz)" );
    setAxisTitle( QwtPlot::yLeft, "Amplitude (dB)" );
    setAxisScale( QwtPlot::xBottom, 0, RESULT_LENGTH );
    setAxisScale( QwtPlot::yLeft, -90, -10);

    //black background
    setCanvasBackground(QColor(0,0,0));

    //add grid
    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setPen( Qt::white, 0.0, Qt::DotLine );
    grid->enableX( true );
    grid->enableXMin( true );
    grid->enableY( true );
    grid->enableYMin( false );
    grid->attach( this );//attach grid to plot

    //add curve
    d_curve = new QwtPlotCurve();
    d_curve->setStyle( QwtPlotCurve::Lines );
    d_curve->setPen(Qt::yellow);
    d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
    d_curve->attach( this );//attach curve to plot

    for(int i=0; i<RESULT_LENGTH; ++i) {
        d_x[i] = i;
    }

}
Example #23
0
PlotHRT::PlotHRT(QWidget *parent) :
    QwtPlot(parent)
{
	setMinimumHeight(10);
	setMinimumWidth(10);
	QwtPlotGrid *grid = new QwtPlotGrid;
	grid->enableXMin(true);
	grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
	grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
	grid->attach(this);
	setAxisTitle(QwtPlot::xBottom, "relative interval number");
	setAxisTitle(QwtPlot::yLeft, "RR [ms]");
	rr = new QwtPlotCurve("RR");
	ts = new QwtPlotCurve("TS");
	ts->setPen(QPen(Qt::red, 2));
	rr->setYAxis(QwtPlot::yLeft);
	ts->setYAxis(QwtPlot::yLeft);
	rr->attach(this);
	ts->attach(this);
	replot();
}
Example #24
0
void SpectrumWindow::createWaveformPlot()
{
    m_pWaveformPlot = new QwtPlot();
    m_pWaveformPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    m_pWaveformPlot->setMinimumSize(0, 0);
    m_pWaveformPlot->setBaseSize(0, 0);
    m_pWaveformPlot->enableAxis(QwtPlot::xBottom, true);
    m_pWaveformPlot->enableAxis(QwtPlot::yLeft, true);
    m_pWaveformPlot->setAxisFont(QwtPlot::xBottom, cAxisFont);
    QwtText title(tr("Time, ms"));
    title.setFont(cAxisTitleFont);
    title.setColor(cAxisTitleColor);
    m_pWaveformPlot->setAxisTitle(QwtPlot::xBottom, title);
    m_pWaveformPlot->setAxisFont(QwtPlot::yLeft, cAxisFont);
    m_pWaveformPlot->setAxisAutoScale(QwtPlot::yLeft, false);
    m_pWaveformPlot->setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
    m_pWaveformPlot->setCanvasBackground(QColor(32, 24, 16));
    dynamic_cast<QwtPlotCanvas*>(m_pWaveformPlot->canvas())->setFrameShadow(QFrame::Plain);

    m_pWaveformPicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                          QwtPicker::CrossRubberBand,
                                          QwtPicker::AlwaysOn,
                                          m_pWaveformPlot->canvas());
    m_pWaveformPicker->setTrackerPen(QColor(255, 255, 128));

    QwtPlotGrid *pGrid = new QwtPlotGrid();
    pGrid->enableXMin(true);
    pGrid->setMajorPen(Qt::darkGray, 0, Qt::DotLine);
    pGrid->setMinorPen(Qt::gray, 0, Qt::DotLine);
    pGrid->attach(m_pWaveformPlot);

    QPen pen;
    pen.setColor(cWaveformColor);
    pen.setWidthF(1.5f);

    m_pWaveformCurve = new QwtPlotCurve();
    m_pWaveformCurve->setPen(pen);
    m_pWaveformCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    m_pWaveformCurve->attach(m_pWaveformPlot);
}
Example #25
0
IRPlot::IRPlot(const QString& aDir, IRInfo anIi, QWidget *parent) throw (QLE) : QwtPlot(parent)
{
    this->dir = aDir;
    this->ii = anIi;

    this->time = 0;
    this->amps = 0;

    this->setAutoReplot(false);
    this->setCanvasBackground(BG_COLOR);

    unsigned curveLength = this->calculate();

    this->setAxisScale( xBottom, this->time[0], this->time[curveLength-1]);
    this->setAxisAutoScale( xBottom);
    this->setAxisScale( yLeft, -1.5, 1.5);

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
#if QWT_VERSION > 0x060000
    grid->setMajorPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
    grid->setMinorPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#else
    grid->setMajPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
    grid->setMinPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#endif
    grid->attach(this);

    QwtPlotCurve* ampCurve = new QwtPlotCurve("IR_Plot");
    ampCurve->setPen(QPen(AMP_CURVE_COLOR));
    ampCurve->setYAxis(QwtPlot::yLeft);
    ampCurve->attach(this);
    ampCurve->setSamples(this->time, this->amps, curveLength);

    QwtPlotPanner* panner = new QwtPlotPanner(this->canvas());
    panner->setMouseButton(Qt::MidButton);
    panner->setEnabled(true);

    this->setAutoReplot(true);
}
OscilloscopePlot::OscilloscopePlot( QWidget *parent ):
    QwtPlot( parent ),
    d_paintedPoints( 0 ),
    d_interval( 0.0, 10.0 ),
    d_timerId( -1 )
{
    d_directPainter = new QwtPlotDirectPainter();

    setAutoReplot( false );
    setCanvas( new Canvas() );

    plotLayout()->setAlignCanvasToScales( true );

    setAxisTitle( QwtPlot::xBottom, "Time [s]" );
    setAxisScale( QwtPlot::xBottom, d_interval.minValue(), d_interval.maxValue() );
    setAxisScale( QwtPlot::yLeft, -200.0, 200.0 );

    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setPen( Qt::gray, 0.0, Qt::DotLine );
    grid->enableX( true );
    grid->enableXMin( true );
    grid->enableY( true );
    grid->enableYMin( false );
    grid->attach( this );

    d_origin = new QwtPlotMarker();
    d_origin->setLineStyle( QwtPlotMarker::Cross );
    d_origin->setValue( d_interval.minValue() + d_interval.width() / 2.0, 0.0 );
    d_origin->setLinePen( Qt::gray, 0.0, Qt::DashLine );
    d_origin->attach( this );

    d_curve = new QwtPlotCurve();
    d_curve->setStyle( QwtPlotCurve::Lines );
    d_curve->setPen( canvas()->palette().color( QPalette::WindowText ) );
    d_curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
    d_curve->setData( new CurveData() );
    d_curve->attach( this );
}
Example #27
0
void Histograma::populate(QImage *img)
{
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableX(false);
    grid->enableY(true);
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid->setMajorPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->setMinorPen(QPen(Qt::gray, 0, Qt::DotLine));
    grid->attach(this);

    int cinza, mQtd = 0;
    int x, y;
    // Quantidade de pontos de 0 a 255
    const int pts = 256;

    QVector<float> valores(pts);

    // inicializa os valores com 0
    for (int i = 0; i < pts; i++)
            valores[i] = 0.0;

    for (x = 0; x < img->width(); x++) {
        for (y = 0; y < img->height(); y++) {
            cinza = qGray(img->pixel(QPoint(x,y)));
            valores[cinza]++;

            if (valores[cinza] > mQtd)
                mQtd = valores[cinza];
        }
    }

    Histogram *hist = new Histogram("", Qt::black);
    hist->setValues(pts, &valores);

    hist->attach(this);
    this->replot();
}
Example #28
0
Osc::Osc( QWidget * parent )
: QwtPlot( parent )
{
    COscScaler * scaler = new COscScaler( this );
    scaler->setWheelZoomX( true );
    scaler->setWheelZoomY( true );
    scaler->setEqualScales( false );
    scaler->setSaveScales( false );

    QwtPlotGrid * g = new QwtPlotGrid();
    g->enableXMin( true );
    g->enableYMin( true );
    g->setPen( QPen( Qt::gray, 0.0, Qt::DotLine ) );
    g->attach( this );

    g = new QwtPlotGrid();
    g->enableX( true );
    g->enableY( true );
    g->setPen( QPen( Qt::gray, 0.0, Qt::SolidLine ) );
    g->attach( this );

    canvas()->setBorderRadius( 10 );
    plotLayout()->setAlignCanvasToScales( true );

    // Nice background coloration.
    QPalette pal = canvas()->palette();
    QLinearGradient gr( 0.0, 0.0, 1.0, 1.0 );
    gr.setCoordinateMode( QGradient::StretchToDeviceMode );
    gr.setColorAt( 0.0, QColor( 200, 200, 230 ) );
    gr.setColorAt( 1.0, QColor( 230, 230, 250 ) );
    pal.setBrush( QPalette::Window, QBrush( gr ) );
    canvas()->setPalette( pal );
    canvas()->setBorderRadius( 10 );
    plotLayout()->setAlignCanvasToScales( true );

    m_timer = new QTimer( this );
    connect( m_timer, SIGNAL(timeout()), this, SIGNAL(timeout()) );
}
Example #29
0
void TVPlot::populate()
{
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableX( false );
    grid->enableY( true );
    grid->enableXMin( false );
    grid->enableYMin( false );
    grid->setMajorPen( Qt::black, 0, Qt::DotLine );
    grid->attach( this );

    const double juneValues[] = { 7, 19, 24, 32, 10, 5, 3 };
    const double novemberValues[] = { 4, 15, 22, 34, 13, 8, 4 };

    Histogram *histogramJune = new Histogram( "Summer", Qt::red );
    histogramJune->setValues(
        sizeof( juneValues ) / sizeof( double ), juneValues );
    histogramJune->attach( this );

    Histogram *histogramNovember = new Histogram( "Winter", Qt::blue );
    histogramNovember->setValues(
        sizeof( novemberValues ) / sizeof( double ), novemberValues );
    histogramNovember->attach( this );
}
Example #30
0
MainWindow::MainWindow():
    PlotMatrix(3, 4)
{
    enableAxis(QwtPlot::yLeft);
    enableAxis(QwtPlot::yRight);
    enableAxis(QwtPlot::xBottom);

    for ( int row = 0; row < numRows(); row++ )
    {
        const double v = qPow(10.0, row);
        setAxisScale(QwtPlot::yLeft, row, -v, v);
        setAxisScale(QwtPlot::yRight, row, -v, v);
    }

    for ( int col = 0; col < numColumns(); col++ )
    {
        const double v = qPow(10.0, col);
        setAxisScale(QwtPlot::xBottom, col, -v, v);
        setAxisScale(QwtPlot::xTop, col, -v, v);
    }

    for ( int row = 0; row < numRows(); row++ )
    {
        for ( int col = 0; col < numColumns(); col++ )
        {
            QwtPlot *plt = plot(row, col);
            plt->setCanvasBackground(QColor(Qt::darkBlue));

            QwtPlotGrid *grid = new QwtPlotGrid();
            grid->enableXMin(true);
            grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
            grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
            grid->attach(plt);
        }
    }
}