Hi,
I'm Irony, a Frensh student, so sorry for my English.
I have a problem with Qwt.
I have a QwtPlot, with two QwtPlotCurves, but the curves begin at the point [0,0]. How can I remove this ?
void IhmConsulterTest::initGraphique(bool typeTest)
{
//Initialization of the graphic title
ui->myPlot->setTitle(ui->comboBox->currentText());
//Background color of the graphic
ui->myPlot->setCanvasBackground(Qt::white);
//Axes Title
if(!typeTest)
ui
->myPlot
->setAxisTitle
(QwtPlot::yLeft,
QString("Température (°C)"));
else
ui
->myPlot
->setAxisTitle
(QwtPlot::yLeft,
QString("Puissance sonore (dB)"));
if(!typeTest)
else
ui
->myPlot
->setAxisTitle
(QwtPlot::xBottom,
QString("Fréquence (Hz)"));
//New curves
// Attachement
myCurve->attach(ui->myPlot);
myCurve2->attach(ui->myPlot);
QVector<double> x(5);
QVector<double> y(5);
QVector<double> y2(5);
//Color of the curves
monPenCourbe1
= QPen(Qt
::red);
monPenCourbe1.setWidth(1.5);
monPenCourbe2
= QPen(Qt
::blue);
monPenCourbe2.setWidth(1.5);
// Values of the curves
for(int i=0;i<courbe1.size();i++)
{
x.append(courbe1[i].x);
y.append(courbe1[i].capteur_interieur);
y2.append(courbe1[i].capteur_exterieur);
}
//Attachement -> data
myCurve->setSamples(x.data(),y.data(),x.size());
myCurve2->setSamples(x.data(),y2.data(),x.size());
//Attachement -> Pen
myCurve->setPen(monPenCourbe1);
myCurve2->setPen(monPenCourbe2);
//Replot
ui->myPlot->replot();
}
void IhmConsulterTest::initGraphique(bool typeTest)
{
//Initialization of the graphic title
ui->myPlot->setTitle(ui->comboBox->currentText());
//Background color of the graphic
ui->myPlot->setCanvasBackground(Qt::white);
//Axes Title
if(!typeTest)
ui->myPlot->setAxisTitle(QwtPlot::yLeft,QString("Température (°C)"));
else
ui->myPlot->setAxisTitle(QwtPlot::yLeft,QString("Puissance sonore (dB)"));
if(!typeTest)
ui->myPlot->setAxisTitle(QwtPlot::xBottom,QString("Temps (s)"));
else
ui->myPlot->setAxisTitle(QwtPlot::xBottom,QString("Fréquence (Hz)"));
//New curves
QwtPlotCurve * myCurve = new QwtPlotCurve();
QwtPlotCurve * myCurve2 = new QwtPlotCurve();
// Attachement
myCurve->attach(ui->myPlot);
myCurve2->attach(ui->myPlot);
QVector<double> x(5);
QVector<double> y(5);
QVector<double> y2(5);
//Color of the curves
monPenCourbe1 = QPen(Qt::red);
monPenCourbe1.setWidth(1.5);
monPenCourbe2 = QPen(Qt::blue);
monPenCourbe2.setWidth(1.5);
// Values of the curves
for(int i=0;i<courbe1.size();i++)
{
x.append(courbe1[i].x);
y.append(courbe1[i].capteur_interieur);
y2.append(courbe1[i].capteur_exterieur);
}
//Attachement -> data
myCurve->setSamples(x.data(),y.data(),x.size());
myCurve2->setSamples(x.data(),y2.data(),x.size());
//Attachement -> Pen
myCurve->setPen(monPenCourbe1);
myCurve2->setPen(monPenCourbe2);
//Replot
ui->myPlot->replot();
}
To copy to clipboard, switch view to plain text mode
Capture.PNG
Could someone please help me?
Thank you in advance!
Bookmarks