Ejemplo n.º 1
0
//
// The (chart-level) implementation of tracing charts
//
TracingEngine::TracingEngine(Chart *chart)
{
    QwtPlotPicker *picker = chart->my.picker;

    my.chart = chart;
    my.chart->my.style = Chart::EventStyle;

    my.scaleDraw = new TracingScaleDraw(this);
    chart->setAxisScaleDraw(QwtPlot::yLeft, my.scaleDraw);

    my.scaleEngine = new TracingScaleEngine(this);
    chart->setAxisScaleEngine(QwtPlot::yLeft, my.scaleEngine);

    // use a rectangular point picker for event tracing
    picker->setStateMachine(new QwtPickerDragRectMachine());
    picker->setRubberBand(QwtPicker::RectRubberBand);
    picker->setRubberBandPen(QColor(Qt::green));
}
Ejemplo n.º 2
0
 /** Plot class contructor. */
 AmplitudePlot::AmplitudePlot(QWidget* parent)
 : QWidget(parent), _ui(new Ui::AmplitudePlotForm) { 
     _ui->setupUi(this);
     QwtPlot* p = _ui->plot;
     p->setCanvasBackground(QColor(Qt::white));
     // We don't need the cache here
     p->canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
     p->canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
     // Axis 
     p->setAxisTitle(QwtPlot::xBottom, "Ticks");
     
     p->setAxisTitle(QwtPlot::yLeft, "Height");
     
     QwtPlotPicker* picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                               QwtPicker::PointSelection | QwtPicker::DragSelection, 
                                               QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, 
                                               p->canvas());
     picker->setRubberBandPen(QColor(Qt::darkGreen));
     picker->setRubberBand(QwtPicker::CrossRubberBand);
     picker->setTrackerPen(QColor(Qt::darkGreen));
 }
Ejemplo n.º 3
0
//
// The SamplingEngine implements all sampling-specific Chart behaviour
//
SamplingEngine::SamplingEngine(Chart *chart, pmDesc &desc)
{
    QwtPlotPicker *picker = chart->my.picker;
    ChartEngine *engine = chart->my.engine;

    my.chart = chart;
    my.rateConvert = engine->rateConvert();
    my.antiAliasing = engine->antiAliasing();

    normaliseUnits(desc);
    my.units = desc.units;

    my.scaleEngine = new SamplingScaleEngine();
    chart->setAxisScaleEngine(QwtPlot::yLeft, my.scaleEngine);
    chart->setAxisScaleDraw(QwtPlot::yLeft, new QwtScaleDraw());

    // use an individual point picker for sampled data
    picker->setStateMachine(new QwtPickerDragPointMachine());
    picker->setRubberBand(QwtPicker::CrossRubberBand);
    picker->setRubberBandPen(QColor(Qt::green));
}
Ejemplo n.º 4
0
FrameView::FrameView (Connection * conn, FrameViewConfig const & cfg, QString const & fname, QStringList const & path)
	: DockedWidgetBase(conn->getMainWindow(), path)
	, m_bars(0)
	, m_config(cfg)
	, m_config_ui(m_config, this)
{
	setContextMenuPolicy(Qt::CustomContextMenu);
	connect(this, SIGNAL(customContextMenuRequested(QPoint const &)), this, SLOT(onShowContextMenu(QPoint const &)));

	m_plot = new QwtPlot();
	m_bars = new BarPlot();
	m_bars->attach(m_plot);

	m_plot->plotLayout()->setAlignCanvasToScales(true);
	m_plot->plotLayout()->setCanvasMargin(0);
	m_plot->setContentsMargins(QMargins(0, 0, 0, 0));
	m_plot->setMinimumSize(64,64);

	m_plot->setAutoReplot(true);
	//qDebug("%s this=0x%08x", __FUNCTION__, this);

	QwtPlotMagnifier * lookglass = new QwtPlotMagnifier(m_plot->canvas());
	m_plot->canvas()->setFocusPolicy(Qt::WheelFocus);
	lookglass->setAxisEnabled(QwtPlot::yLeft, false);

	XZoomer * zoomer = new XZoomer(m_plot->canvas());
	zoomer->setRubberBandPen( QColor( Qt::black ) );
	zoomer->setTrackerPen( QColor( Qt::black ) );
	zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier );
	zoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton, Qt::ShiftModifier);

	QwtPlotPicker * picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
										QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
										m_plot->canvas());
	//picker->setStateMachine(new QwtPickerDragPointMachine());
	picker->setStateMachine(new QwtPickerClickPointMachine());
	picker->setRubberBandPen(QColor(Qt::green));
	picker->setRubberBand(QwtPicker::CrossRubberBand);
	picker->setTrackerPen(QColor(Qt::white));

	QwtPlotPanner * panner = new QwtPlotPanner(m_plot->canvas());
	panner->setAxisEnabled(QwtPlot::yLeft, false);
	panner->setMouseButton(Qt::MidButton);

    m_plot->setAxisMaxMinor(QwtPlot::xBottom, 3);
    m_plot->setAxisScaleDraw(QwtPlot::xBottom, new FrameScaleDraw(Qt::Horizontal, m_bars->m_strvalues));

	m_plot->setAxisAutoScale(QwtPlot::yLeft, true);
	m_bars->setLayoutPolicy(QwtPlotAbstractBarChart::FixedSampleSize);
	m_bars->setLayoutHint(5);
	m_bars->setSpacing(1);

	QwtSlider * slider = createSlider(1);
    connect(slider, SIGNAL(valueChanged(double)), SLOT(setNum(double)));
    QVBoxLayout * layout = new QVBoxLayout( this );
    layout->addWidget(m_plot);
    //layout->addWidget(slider);
	m_bars->setLegendMode(QwtPlotBarChart::LegendBarTitles);

    connect(picker, SIGNAL(selected(QRectF const &) ), this, SLOT(selected(QRectF const &)));
    connect(picker, SIGNAL(selected(QPointF const &) ), this, SLOT(selected(QPointF const &)));
    connect(picker, SIGNAL(appended(QPointF const &) ), this, SLOT(appended(QPointF const &)));
    connect(picker, SIGNAL(selected(QVector<QPointF> const &) ), this, SLOT(selected(QVector<QPointF> const &)));

    connect(&getSyncWidgets(), SIGNAL( requestSynchronization(E_SyncMode mode, int, unsigned long long, void *) ),
						 this, SLOT( performSynchronization(E_SyncMode mode, int, unsigned long long, void *) ));
    connect(this, SIGNAL( requestSynchronization(E_SyncMode mode, int, unsigned long long, void *) ),
						 &getSyncWidgets(), SLOT( performSynchronization(E_SyncMode mode, int, unsigned long long, void *) ));
}