Results 1 to 3 of 3

Thread: [Resolved] Qwt - Do not start curves on [0,0]

  1. #1
    Join Date
    Feb 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question [Resolved] Qwt - Do not start curves on [0,0]

    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 ?

    Qt Code:
    1. void IhmConsulterTest::initGraphique(bool typeTest)
    2. {
    3.  
    4. //Initialization of the graphic title
    5.  
    6. ui->myPlot->setTitle(ui->comboBox->currentText());
    7.  
    8. //Background color of the graphic
    9.  
    10. ui->myPlot->setCanvasBackground(Qt::white);
    11.  
    12. //Axes Title
    13. if(!typeTest)
    14. ui->myPlot->setAxisTitle(QwtPlot::yLeft,QString("Température (°C)"));
    15. else
    16. ui->myPlot->setAxisTitle(QwtPlot::yLeft,QString("Puissance sonore (dB)"));
    17. if(!typeTest)
    18. ui->myPlot->setAxisTitle(QwtPlot::xBottom,QString("Temps (s)"));
    19. else
    20. ui->myPlot->setAxisTitle(QwtPlot::xBottom,QString("Fréquence (Hz)"));
    21.  
    22.  
    23. //New curves
    24.  
    25. QwtPlotCurve * myCurve = new QwtPlotCurve();
    26. QwtPlotCurve * myCurve2 = new QwtPlotCurve();
    27.  
    28. // Attachement
    29.  
    30. myCurve->attach(ui->myPlot);
    31. myCurve2->attach(ui->myPlot);
    32. QVector<double> x(5);
    33. QVector<double> y(5);
    34. QVector<double> y2(5);
    35.  
    36. //Color of the curves
    37.  
    38. monPenCourbe1 = QPen(Qt::red);
    39. monPenCourbe1.setWidth(1.5);
    40. monPenCourbe2 = QPen(Qt::blue);
    41. monPenCourbe2.setWidth(1.5);
    42.  
    43.  
    44. // Values of the curves
    45.  
    46. for(int i=0;i<courbe1.size();i++)
    47. {
    48. x.append(courbe1[i].x);
    49. y.append(courbe1[i].capteur_interieur);
    50. y2.append(courbe1[i].capteur_exterieur);
    51. }
    52.  
    53. //Attachement -> data
    54.  
    55. myCurve->setSamples(x.data(),y.data(),x.size());
    56. myCurve2->setSamples(x.data(),y2.data(),x.size());
    57.  
    58. //Attachement -> Pen
    59.  
    60. myCurve->setPen(monPenCourbe1);
    61. myCurve2->setPen(monPenCourbe2);
    62.  
    63. //Replot
    64.  
    65. ui->myPlot->replot();
    66.  
    67.  
    68. }
    To copy to clipboard, switch view to plain text mode 

    Capture.PNG

    Could someone please help me?
    Thank you in advance!
    Last edited by Irony; 20th February 2013 at 09:11.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt - Do not start curves on [0,0]

    Qt Code:
    1. QVector<double> x(5);
    To copy to clipboard, switch view to plain text mode 

    Here you create a vector filled with 5 elements - later you append to this vector leaving the first 5 elements uninitialized.

    Uwe

  3. #3
    Join Date
    Feb 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt - Do not start curves on [0,0]

    Thank you very much !

    Qt Code:
    1. QVector<double> x(0);
    2. QVector<double> y(0);
    3. QVector<double> y2(0);
    To copy to clipboard, switch view to plain text mode 
    It's work !

Similar Threads

  1. Lining up 3 curves of a QwtPlot
    By pihentagy in forum Qwt
    Replies: 2
    Last Post: 18th February 2011, 14:38
  2. qwt several curves at a plot
    By freude3 in forum Qwt
    Replies: 4
    Last Post: 4th January 2011, 07:45
  3. qwt display curves
    By sergio486 in forum Qt Programming
    Replies: 0
    Last Post: 11th December 2010, 21:27
  4. Information about curves
    By den in forum Qwt
    Replies: 1
    Last Post: 27th April 2010, 19:02
  5. Multiple curves on top of each other
    By jmsbc in forum Qwt
    Replies: 2
    Last Post: 15th July 2009, 19:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.