本文整理汇总了C++中QwtPlotCurve::setItemAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setItemAttribute方法的具体用法?C++ QwtPlotCurve::setItemAttribute怎么用?C++ QwtPlotCurve::setItemAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::setItemAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void Plot::add() {
Q_ASSERT(plotWidget && x && y && x->size()==y->size());
setIntervals();
for (int i = 0; i < intervals.size(); ++i) {
QwtPlotCurve *curve = new QwtPlotCurve(yLegend);
curve->setItemAttribute(QwtPlotItem::Legend, showLegend && i==0);
plotWidget->addCurve(curve);
if (type == Trace::Symbols) {
curve->setStyle(QwtPlotCurve::NoCurve);
}
if (type == Trace::Symbols || type == Trace::Both) {
Q_ASSERT(symbol);
curve->setSymbol(symbol);
}
if (type == Trace::Line || type == Trace::Both) {
curve->setPen(pen);
}
Interval iv = intervals[i];
int numPoints = iv.second - iv.first + 1;
if (numPoints <=0 )
Q_ASSERT(numPoints > 0);
curve->setSamples(x->data() + iv.first, y->data() + iv.first, numPoints);
}
}
示例2: drawDots
void Plot::drawDots(QVector< QVector<struct numCluster> > data, double n, double k, int index, int size, int number)
{
int j, l;
QPolygonF points;
QwtPlotCurve *curve;
QwtSymbol *symbol;
points.clear();
curve = new QwtPlotCurve();//QString("y = norm%1(x)").arg(index));
curve->setItemAttribute(QwtPlotItem::Legend, false);
curve->setStyle( QwtPlotCurve::Dots );
for (l = 0; l < data.size(); l++){
if (data[l][number].cluster == index){
// ПЕРЕДЕЛАТЬ если возможно!!! Нужно, чтобы он печатал сразу для всех кластеров одной л.п.
if (index == 0 && data[l][number].number < n){
points << QPointF(data[l][number].number, 1);
}else if (index == size - 1 && data[l][number].number > n){
points << QPointF(data[l][number].number, 1);
}else{
points << QPointF(data[l][number].number, func_normal(data[l][number].number,n,k));
}
//std::cout << index << "data = " << data[l][i].number << std::endl;
}
}
curve->setSamples(points);
switch (index % 5){
case 0:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 1:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::green ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 2:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::cyan ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 3:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::magenta ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 4:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::gray ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
default:
break;
}
curve->attach(this);
this->replot();
}