PDA

View Full Version : [Qt/Qwt] disconnect first and last point on a curve



didji31
28th April 2011, 08:16
Hello every one,

First sorry for my bad english but i'll try to be explicit... :)

I developed an application that creates a graph composed of curves.
I have a series of points that I associate with curves and I read them through


curve->setStyle(QwtPlotCurve::Lines);

I'm using this code


QwtPlotCurve *curve;
QwtSymbol sym;

sym.setStyle(QwtSymbol::Cross);
sym.setPen(couleurCourbe(i));
sym.setSize(5);



curve = new QwtPlotCurve();
curve->setTitle(liste.at(i));
curve->setSymbol(sym);
curve->setPen(couleurCourbe(i));
curve->setStyle(QwtPlotCurve::Lines);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);


All pooints are connecting and the last point is connect with the first too.... (as a polygon).:(

Someone has a trick to disconnect firts and last point ??? :confused:

Thanks a lot.

FelixB
28th April 2011, 08:22
show the code where you set the data to the curve, please. this has nothing to do with curve settings...

btw: this forum has a subforum especially for qwt, I suggest to put your qwt-related questions there next time ;)

didji31
28th April 2011, 08:42
The code where I set the data to the cruve is :


liste_courbe->append(curve);


myPlot = new QwtPlot("XXXXX",this);
mainLayout->addWidget(myPlot);
this->setLayout(mainLayout);




for(int k=0; k<nbParam; k++)
{
QList<QByteArray> liste_SL2;
QList<QByteArray> liste_val;

....

nbValeur = liste_SL2.size()-1;

QVector<double> x;
QVector<double> y;

for (int i=0; i<nbValeur; i++)
{
double newX = liste_SL2.at(i).toDouble();
double newY = liste_val.at(i).toDouble();

if(x.contains(newX))
{
if(!y.contains(newY))
{
x.append(newX);
y.append(newY);
}
}
else
{
x.append(newX);
y.append(newY);
}

liste_courbe->at(k)->setData(x.data(), y.date(), x.size());

liste_courbe->at(k)->attach(myPlot);

}





btw: this forum has a subforum especially for qwt, I suggest to put your qwt-related questions there next time

Ok sorry, I'll post to the subforum next :)