Ejemplo n.º 1
0
RandomPlot::RandomPlot(QWidget *parent):
    IncrementalPlot(parent),
    d_timer(0),
    d_timerCount(0)
{
    setFrameStyle(QFrame::NoFrame);
    setLineWidth(0);
    setCanvasLineWidth(2);

    plotLayout()->setAlignCanvasToScales(true);

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
    grid->attach(this);

    setCanvasBackground(QColor(29, 100, 141)); // nice blue

    setAxisScale(xBottom, 0, c_rangeMax);
    setAxisScale(yLeft, 0, c_rangeMax);
    
    replot();

    // enable zooming

    (void) new Zoomer(canvas());
}
Ejemplo n.º 2
0
DataPlotFFT::DataPlotFFT(QWidget *parent):
    QwtPlot(parent),
    d_data(NULL),
    d_curve(NULL)
{
    setAutoReplot(false);

    setFrameStyle(QFrame::NoFrame);
    setLineWidth(0);
    setCanvasLineWidth(2);

    //plotLayout()->setAlignCanvasToScales(true);

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
    grid->attach(this);

    setCanvasBackground(Qt::white);
    //setCanvasBackground(QColor(29, 100, 141)); // nice blue

    //setAxisAutoScale(xBottom);
    //s/etAxisAutoScale(yLeft);

    setAxisScale(xBottom, 0.5, -0.5);
    setAxisScale(yLeft, -10.00, 10.00);
    setAxisAutoScale(yLeft);
    //setAxisAutoScale(xBottom);

    replot();
}
Ejemplo n.º 3
0
CopasiPlot::CopasiPlot(const CPlotSpecification* plotspec, QWidget* parent):
  QwtPlot(parent),
  mCurves(0),
  mCurveMap(),
  mDataBefore(0),
  mDataDuring(0),
  mDataAfter(0),
  mHaveBefore(false),
  mHaveDuring(false),
  mHaveAfter(false),
  mpPlotSpecification(NULL),
  mNextPlotTime(),
  mIgnoreUpdate(false),
  mpZoomer(NULL),
  mReplotFinished(false)
{
  QwtLegend *legend = new QwtLegend;
  legend->setItemMode(QwtLegend::CheckableItem);

  // whole legend can not be displayed at bottom on DARWIN
  // maybe a Qwt bug ?!?
#ifdef Darwin
  insertLegend(legend, QwtPlot::TopLegend);
#else
  insertLegend(legend, QwtPlot::BottomLegend);
#endif

  // Set up the zoom facility
  mpZoomer = new ScrollZoomer(canvas());
  mpZoomer->setRubberBandPen(QColor(Qt::black));
  mpZoomer->setTrackerPen(QColor(Qt::black));
  mpZoomer->setTrackerMode(QwtPicker::AlwaysOn);
  mpZoomer->setTrackerFont(this->font());

  // white background better for printing...
  setCanvasBackground(Qt::white);

  //  setTitle(FROM_UTF8(plotspec->getTitle()));
  setCanvasLineWidth(0);

  canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, true);

  connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)),
          SLOT(showCurve(QwtPlotItem *, bool)));

  // Size the vectors to be able to store information for all activities.
  mData.resize(ActivitySize);
  mObjectValues.resize(ActivitySize);
  mObjectInteger.resize(ActivitySize);
  mDataSize.resize(ActivitySize);
  mDataIndex.clear();

  // Initialize from the plot specification
  initFromSpec(plotspec);
  connect(this, SIGNAL(replotSignal()), this, SLOT(replot()));
}
Ejemplo n.º 4
0
BasicPlot::BasicPlot(QWidget *parent) :
  QwtPlot(parent)
{
  setFrameStyle(QFrame::NoFrame);
  setLineWidth(0);
  setCanvasLineWidth(2);
  plotLayout()->setAlignCanvasToScales(true);
  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
  grid->attach(this);
  setCanvasBackground(QColor(29, 100, 141)); // nice blue

  // enable zooming
  Zoomer *zoomer = new Zoomer(canvas());
  zoomer->setRubberBandPen(QPen(Qt::white, 2, Qt::DotLine));
  zoomer->setTrackerPen(QPen(Qt::white));
  QObject::connect(this, SIGNAL(setNewBase(QwtScaleDiv*,QwtScaleDiv*)), zoomer,
      SLOT(setNewBase(QwtScaleDiv*,QwtScaleDiv*)));

}
Ejemplo n.º 5
0
void Plot::initCanvas()
{
    setGeometry(100,100,800,600);
    setTitle(tr("Title"));
    setCanvasBackground(QBrush(QColor("white")));
    setCanvasLineWidth(1); //  画布边缘宽度
    // enableAxis(0,false);
    /*
    * axisId:
    *     y_leff:   0
    *     y_right:  1
    *     x_buttom: 2
    *     x_top:    4
    */
    setAxisTitle(2, tr("wave number"));
    setAxisTitle(0, tr("DOP"));
    
    setAxisMaxMajor(0, 10); // 主刻度的个数
    setAxisMaxMinor(0, 10); // 辅助刻度的分裂数目
    
    insertLegend(new QwtLegend(),QwtPlot::RightLegend);
}