本文整理汇总了C++中QwtPlotMarker::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotMarker::setValue方法的具体用法?C++ QwtPlotMarker::setValue怎么用?C++ QwtPlotMarker::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotMarker
的用法示例。
在下文中一共展示了QwtPlotMarker::setValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableZeroLineY
void Grid::enableZeroLineY(bool enable) {
Plot *d_plot = dynamic_cast<Plot *>(plot());
if (!d_plot)
return;
if (mrkY < 0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkY = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::HLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled(QwtPlot::xBottom) ||
d_plot->axisEnabled(QwtPlot::xTop))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkY >= 0 && !enable) {
d_plot->removeMarker(mrkY);
mrkY = -1;
}
}
示例2: enableZeroLineX
void Grid::enableZeroLineX(bool enable)
{
Plot *d_plot = (Plot *)plot();
if (!d_plot)
return;
if (mrkX<0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkX = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::VLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled (QwtPlot::yLeft) || d_plot->axisEnabled (QwtPlot::yRight))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkX >= 0 && !enable) {
d_plot->removeMarker(mrkX);
mrkX=-1;
}
}
示例3: mouseReleaseEvent
void Variog_plot::mouseReleaseEvent(QMouseEvent * event)
{
std::cerr << "show_pairs_count() called " << std::endl;
if( event->button() != Qt::RightButton ) return;
const float offset=1.02;
QFont font;
font.setPointSize( 7 );
if( !pairs_shown_ ) {
for( unsigned int i=0; i < pairs_.size(); i++ ) {
QString label;
label.setNum( pairs_[i] );
QwtText T(label);
QwtPlotMarker * marker = new QwtPlotMarker();
marker->attach(this);
T.setFont(font);
marker->setValue(pairs_coord_x_[i], pairs_coord_y_[i]*offset);
marker->setLabel(T);
}
pairs_shown_ = true;
}
else {
detachItems(QwtPlotItem::Rtti_PlotMarker);
pairs_shown_ = false;
}
replot();
}
示例4: 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();
}
示例5: setExtraCaption
/**
* Dodaje dodatkowy opis wykresu.
*
* @param caption opis wykresu
* @param x pozycja na wykresie w skali czasu
* @param y pozycja na wykresie w skali pionowej (np. częstotliwości)
*/
void SpectrogramPlot::setExtraCaption(QString caption, double x, double y)
{
QwtPlotMarker* marker = new QwtPlotMarker();
QwtText label(caption);
label.setColor(QColor::fromRgba(0x88FFFFFF));
label.setFont(QFont("Arial", 10, QFont::Bold));
marker->setLabel(label);
marker->setLineStyle(QwtPlotMarker::NoLine);
marker->setValue(x, y);
marker->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
marker->attach(this);
}
示例6: addPlotMarker
void QgsCurveEditorWidget::addPlotMarker( double x, double y, bool isSelected )
{
QColor borderColor( 0, 0, 0 );
QColor brushColor = isSelected ? borderColor : QColor( 255, 255, 255, 0 );
QwtPlotMarker *marker = new QwtPlotMarker();
marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 8, 8 ) ) );
marker->setValue( x, y );
marker->attach( mPlot );
marker->setRenderHint( QwtPlotItem::RenderAntialiased, true );
mMarkers << marker;
}
示例7: addPlotMarker
void QgsGradientColorRampDialog::addPlotMarker( double x, double y, const QColor &color, bool isSelected )
{
QColor borderColor = color.darker( 200 );
borderColor.setAlpha( 255 );
QColor brushColor = color;
brushColor.setAlpha( 255 );
QwtPlotMarker *marker = new QwtPlotMarker();
marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 8, 8 ) ) );
marker->setValue( x, y );
marker->attach( mPlot );
marker->setRenderHint( QwtPlotItem::RenderAntialiased, true );
mMarkers << marker;
}
示例8: addMarker
void Graph::addMarker(double val, const QColor &color, int axis)
{
QwtPlotMarker *m = new QwtPlotMarker();
m->setLineStyle(axis == QwtPlot::xBottom ? QwtPlotMarker::VLine : QwtPlotMarker::HLine);
m->setLinePen(QPen(color));
m->setYAxis(axis);
m->setValue(val, val);
m->attach(this);
m->setLabel(QString::number(val));
if(axis == QwtPlot::xBottom)
m->setLabelAlignment(Qt::AlignLeft | Qt::AlignVCenter);
else
m->setLabelAlignment(Qt::AlignTop | Qt::AlignHCenter);
getMarkers(axis).push_back(m);
}
示例9: QwtPlotMarker
void QgsVectorGradientColorRampV2Dialog::addPlotMarker( double x, double y, const QColor& color, bool isSelected )
{
QColor borderColor = color.darker( 200 );
borderColor.setAlpha( 255 );
QColor brushColor = color;
brushColor.setAlpha( 255 );
QwtPlotMarker *marker = new QwtPlotMarker();
#if defined(QWT_VERSION) && QWT_VERSION>=0x060000
marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 10, 10 ) ) );
#else
marker->setSymbol( QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 10, 10 ) ) );
#endif
marker->setValue( x, y );
marker->attach( mPlot );
marker->setRenderHint( QwtPlotItem::RenderAntialiased, true );
mMarkers << marker;
}
示例10: populate
void Plot::populate()
{
GridItem *gridItem = new GridItem();
#if 0
gridItem->setOrientations( Qt::Horizontal );
#endif
gridItem->attach( this );
const Qt::GlobalColor colors[] =
{
Qt::red,
Qt::blue,
Qt::darkCyan,
Qt::darkMagenta,
Qt::darkYellow
};
const int numColors = sizeof( colors ) / sizeof( colors[0] );
for ( int i = 0; i < QuoteFactory::NumStocks; i++ )
{
QuoteFactory::Stock stock = static_cast<QuoteFactory::Stock>( i );
QwtPlotTradingCurve *curve = new QwtPlotTradingCurve();
curve->setTitle( QuoteFactory::title( stock ) );
curve->setOrientation( Qt::Vertical );
curve->setSamples( QuoteFactory::samples2010( stock ) );
// as we have one sample per day a symbol width of
// 12h avoids overlapping symbols. We also bound
// the width, so that is is not scaled below 3 and
// above 15 pixels.
curve->setSymbolExtent( 12 * 3600 * 1000.0 );
curve->setMinSymbolWidth( 3 );
curve->setMaxSymbolWidth( 15 );
const Qt::GlobalColor color = colors[ i % numColors ];
curve->setSymbolPen( color );
curve->setSymbolBrush( QwtPlotTradingCurve::Decreasing, color );
curve->setSymbolBrush( QwtPlotTradingCurve::Increasing, Qt::white );
curve->attach( this );
showItem( curve, true );
}
for ( int i = 0; i < 2; i++ )
{
QwtPlotMarker *marker = new QwtPlotMarker();
marker->setTitle( QString( "Event %1" ).arg( i + 1 ) );
marker->setLineStyle( QwtPlotMarker::VLine );
marker->setLinePen( colors[ i % numColors ], 0, Qt::DashLine );
marker->setVisible( false );
QDateTime dt( QDate( 2010, 1, 1 ) );
dt = dt.addDays( 77 * ( i + 1 ) );
marker->setValue( QwtDate::toDouble( dt ), 0.0 );
marker->setItemAttribute( QwtPlotItem::Legend, true );
marker->attach( this );
}
// to show how QwtPlotZoneItem works
ZoneItem *zone1 = new ZoneItem( "Zone 1");
zone1->setColor( Qt::darkBlue );
zone1->setInterval( QDate( 2010, 3, 10 ), QDate( 2010, 3, 27 ) );
zone1->setVisible( false );
zone1->attach( this );
ZoneItem *zone2 = new ZoneItem( "Zone 2");
zone2->setColor( Qt::darkMagenta );
zone2->setInterval( QDate( 2010, 8, 1 ), QDate( 2010, 8, 24 ) );
zone2->setVisible( false );
zone2->attach( this );
}
示例11: plotCurves
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::plotCurves(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString pointMarkerLabel, QString plotTitle, QString yAxisTitle)
{
m_qwtPlot->detachItems(QwtPlotItem::Rtti_PlotCurve);
m_qwtPlot->detachItems(QwtPlotItem::Rtti_PlotMarker);
m_qwtCurveArr.clear();
m_pvtCurveArr.clear();
m_trackerPlotMarker = nullptr;
// Construct an auxiliary curve that connects the first point in all the input curves as a visual aid
// This should only be shown when the phase being plotted is oil
// Will not be added to our array of qwt curves since we do not expect the user to interact with it
{
std::vector<double> xVals;
std::vector<double> yVals;
for (size_t i = 0; i < curveArr.size(); i++)
{
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL && curve.pressureVals.size() > 0 && curve.yVals.size() > 0)
{
xVals.push_back(curve.pressureVals[0]);
yVals.push_back(curve.yVals[0]);
}
}
if (xVals.size() > 1)
{
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
qwtCurve->setSamples(xVals.data(), yVals.data(), static_cast<int>(xVals.size()));
qwtCurve->setStyle(QwtPlotCurve::Lines);
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
QColor curveClr = Qt::darkGreen;
const QPen curvePen(curveClr);
qwtCurve->setPen(curvePen);
qwtCurve->attach(m_qwtPlot);
}
}
// Add the primary curves
for (size_t i = 0; i < curveArr.size(); i++)
{
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
CVF_ASSERT(curve.pressureVals.size() == curve.yVals.size());
qwtCurve->setSamples(curve.pressureVals.data(), curve.yVals.data(), static_cast<int>(curve.pressureVals.size()));
qwtCurve->setStyle(QwtPlotCurve::Lines);
QColor curveClr = Qt::magenta;
if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) curveClr = QColor(Qt::red);
else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL) curveClr = QColor(Qt::green);
const QPen curvePen(curveClr);
qwtCurve->setPen(curvePen);
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
QwtSymbol* curveSymbol = new QwtSymbol(QwtSymbol::Ellipse);
curveSymbol->setSize(6, 6);
curveSymbol->setPen(curvePen);
curveSymbol->setBrush(Qt::NoBrush);
qwtCurve->setSymbol(curveSymbol);
qwtCurve->attach(m_qwtPlot);
m_qwtCurveArr.push_back(qwtCurve);
}
m_pvtCurveArr = curveArr;
CVF_ASSERT(m_pvtCurveArr.size() == m_qwtCurveArr.size());
// Add vertical marker line to indicate cell pressure
if (pressure != HUGE_VAL)
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
lineMarker->setXValue(pressure);
lineMarker->setLineStyle(QwtPlotMarker::VLine);
lineMarker->setLinePen(QPen(QColor(128, 128, 255), 1, Qt::DashLine));
lineMarker->setLabel(QString("PRESSURE"));
lineMarker->setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
lineMarker->setLabelOrientation(Qt::Vertical);
lineMarker->attach(m_qwtPlot);
}
// Then point marker
if (pressure != HUGE_VAL && pointMarkerYValue != HUGE_VAL)
{
QwtPlotMarker* pointMarker = new QwtPlotMarker;
pointMarker->setValue(pressure, pointMarkerYValue);
QColor markerClr(128, 0, 255);
QwtSymbol* symbol = new QwtSymbol(QwtSymbol::Ellipse);
//.........这里部分代码省略.........