iam trying to plot two cureves from two different files.but it displaying only one.
but individually it is displaying both and from single file also showing both.
please give me suggession to plot both curves from two different files in qwt(windows)
iam trying to plot two cureves from two different files.but it displaying only one.
but individually it is displaying both and from single file also showing both.
please give me suggession to plot both curves from two different files in qwt(windows)
if i understand you right. i think you miss calling QwtPlot::replot();
or better yet show us some sample code
here iam attching my cod
void Analysee::change()
{
int j=0;
j=ui->comboBox->currentIndex();
if(j==1)
{
ui->qwtPlot->clear();
ui->qwtPlot_2->clear();
ui->qwtPlot_3->clear();
QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin->setPen(QPen(Qt::red));
cSin->attach(ui->qwtPlot);
QwtPlotCurve *cSin_2 = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin_2->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin_2->setPen(QPen(Qt::red));
cSin_2->attach(ui->qwtPlot_2);
QwtPlotCurve *cSin_3 = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin_3->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin_3->setPen(QPen(Qt::red));
cSin_3->attach(ui->qwtPlot_3);
QwtPlotCurve *cCos = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cCos->setPen(QPen(Qt::green));
cCos->attach(ui->qwtPlot);
QwtPlotCurve *cCos_2 = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cCos_2->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cCos_2->setPen(QPen(Qt::green));
cCos_2->attach(ui->qwtPlot_2);
QwtPlotCurve *cCos_3 = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cCos_3->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cCos_3->setPen(QPen(Qt::green));
cCos_3->attach(ui->qwtPlot_3);
QFile inputFile("input_m.dat");
if(inputFile.open(QIODevice::ReadOnly|QIODevice::T ext))
{
coastX.clear();
coastY.clear();
coastV.clear();
coastA.clear();
coastB.clear();
coastC.clear();
coastD.clear();
// coastZ.clear();
QTextStream in(&inputFile);
do
{
in >> tempDouble1 >> tempDouble2>> tempDouble3>> tempDouble4>> tempDouble5>> tempDouble6>> tempDouble7;
coastX << tempDouble1;
coastY << tempDouble5;
coastA <<tempDouble6;
coastC <<tempDouble7;
} while(!in.atEnd());
}
cSin->setData(coastY,coastX);
cSin_2->setData(coastA,coastX);
cSin_3->setData(coastC,coastX);
QFile inputFil("OUTPUT.dat");
if(inputFil.open(QIODevice::ReadOnly|QIODevice::Te xt))
{
coastX.clear();
coastY.clear();
coastV.clear();
coastZ.clear();
QTextStream in(&inputFil);
do
{
in >> tempDouble1>> tempDouble2>> tempDouble3>> tempDouble4;//>> tempDouble5>> tempDouble6>> tempDouble7>> tempDouble8>> tempDouble9>> tempDouble10>> tempDouble11>> tempDouble12>> tempDouble13;
coastX << tempDouble1;
coastY << tempDouble2;
coastA << tempDouble3;
coastC << tempDouble4;
} while(!in.atEnd());
}
ui->qwtPlot->replot();
cCos->setData(coastX,coastY);
ui->qwtPlot->show();
ui->qwtPlot_2->replot();
cCos_2->setData(coastX,coastA);
ui->qwtPlot_2->show();
ui->qwtPlot_3->replot();
cCos_3->setData(coastX,coastC);
ui->qwtPlot_3->show();
ui->qwtPlot->setTitle("Roll");
ui->qwtPlot_2->setTitle("Pitch");
ui->qwtPlot_3->setTitle("Heading");
ui->qwtPlot->setAxisTitle(QwtPlot::yLeft, "deg");
ui->qwtPlot_2->setAxisTitle(QwtPlot::yLeft, "deg");
ui->qwtPlot_3->setAxisTitle(QwtPlot::yLeft, "deg");
ui->qwtPlot->setAxisTitle(QwtPlot::xBottom, "sec");
ui->qwtPlot_2->setAxisTitle(QwtPlot::xBottom, "sec");
ui->qwtPlot_3->setAxisTitle(QwtPlot::xBottom, "sec");
use CODE-Tags, please!
you set cosinus-data after calling replot().
thank you, till not working.
can you please mail me the pro file and all those necessary...
suraj@robotics.org,np
You are creating 3 QwtPlot instances. Are you also creating 3 different views to put them in, or are you trying to display everything in 1 view? If you aren't creating 3 views, then probably all of your QwtPlots are on top of each other, and only the top one gets displayed.
Do something like this instead:
Qt Code:
// ... fill curve 1 with data curve1->attach( plot ); // ... fill curve 2 with data curve2->attach( plot ); // ... fill curve 3 with data curve3->attach( plot );To copy to clipboard, switch view to plain text mode
All three curves should now be displayed on the same plot.
Bookmarks