本文整理汇总了C++中QwtPlotMarker::setAxes方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotMarker::setAxes方法的具体用法?C++ QwtPlotMarker::setAxes怎么用?C++ QwtPlotMarker::setAxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotMarker
的用法示例。
在下文中一共展示了QwtPlotMarker::setAxes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSweep
void SweepInspector::loadSweep(int index) {
//load in new sweep values from data
if (data == NULL) return;
if ( (index < 0) || (index >= data->getNumSweeps())) return;
//remove old data and get new
if (d_curve) d_curve->attach(NULL);
detachItems();
fsweep sweep = data->getSweep(index);
d_curve = new QwtPlotCurve( data->timestampFromIndex(index) ); //Qwt will delete() this when its done with it
d_curve->setRenderHint( QwtPlotItem::RenderAntialiased );
d_curve->setStyle( QwtPlotCurve::Lines );
d_curve->setPen( QColor( Qt::yellow ), 2, Qt::SolidLine );
d_curve->setSamples( sweep );
d_curve->attach(this);
QwtInterval frange = data->limits(FREQ);
//setAxisScale(QwtPlot::xBottom, frange.minValue(), frange.maxValue(), (frange.maxValue() - frange.minValue())/ 5.0);
//setAxisScale(QwtPlot::yLeft, -135, 20, 10.0);
setTitle( QString("RF Sweep @ %1").arg(data->timestampFromIndex(index)) );
//set maximum zoom out
zoomer->setZoomBase(QRectF(QPointF(frange.minValue(), 40), QPointF(frange.maxValue(), -135)));
zoomer->zoomBase();
//find max, min, and average values and drop it on plot as well
double max = sweep.first().y(), min = sweep.first().y(), avg=0;
for(int i=0; i < sweep.size(); i++) {
max = std::max(max, sweep.at(i).y());
min = std::min(min, sweep.at(i).y());
avg += sweep.at(i).y();
} avg /= sweep.size();
//add markers onto the plot
QwtPlotMarker *one = new QwtPlotMarker(), *two = new QwtPlotMarker();
one->attach(this); one->setAxes(QwtPlot::xTop, QwtPlot::yRight);
two->attach(this); two->setAxes(QwtPlot::xTop, QwtPlot::yRight);
QwtText tone = QwtText(QString("Max: %1 dBm\nMin: %2 dBm\nAvg: %3 dBm").arg(max).arg(min).arg(avg));
tone.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
tone.setColor( Qt::green );
tone.setRenderFlags(Qt::AlignTop | Qt::AlignLeft);
one->setLabel(tone);
one->setValue(0, 10);
one->setLabelAlignment(Qt::AlignBottom | Qt::AlignRight);
QwtText ttwo(data->plotText());
ttwo.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
ttwo.setColor( Qt::white );
ttwo.setRenderFlags(Qt::AlignBottom | Qt::AlignRight);
two->setLabel(ttwo);
two->setValue(10, 10);
two->setLabelAlignment(Qt::AlignBottom | Qt::AlignLeft);
replot();
repaint();
}