Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [SOLVED]QWT plot doesn’t like my array
QtWS25 Last Chance

[SOLVED]QWT plot doesn’t like my array

Scheduled Pinned Locked Moved 3rd Party Software
9 Posts 5 Posters 8.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    toho71
    wrote on last edited by
    #1

    I try to use the QWt plot graph and I tried a little example.
    But it crashes in the

    @curve1->setData(x,y1,100);@

    //Error msg
    error: no matching function for call to ‘QwtPlotCurve::setData(double [100], double [100], int)’

    My code

    @ ui->qwtPlot->setTitle("TWO CURVES");
    ui->qwtPlot->setParent(ui->tab_4);

    double x[100], y1[100];
    
    for (int i = 0; i < 100; i++)
    {
        x[i] = i;
        y1[i] = 10-0.1*i*i;
    }
    

    // add curves
    QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");

    // copy the data into the curves
    curve1->setData(x,y1,100);
    curve1->attach(ui->qwtPlot);

    ui->qwtPlot->replot();
    @

    Anyone

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      Your application doesn't crash, your code raises a compilation error. Most probably because there is no such method setData() which takes two double arrays and an int as a parameter. Take another look at the "documentation":http://qwt.sourceforge.net/class_qwt_plot_series_item.html#adba072515f7c71c923985882129878c4.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toho71
        wrote on last edited by
        #3

        Yes your right its a compilation problem.
        And i tried a setRawData and it worked as I expected.

        I never used this plot widget before.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          As Lukas suggested QwtPlotCurve does not have the method setData with this parameter list. You have to use setRawSamples or setSamples in your case. setRawData is not available either according to the documentation.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • T Offline
            T Offline
            toho71
            wrote on last edited by
            #5

            Yes rawSampel is the thing.
            Is there anyone with a very simpel example

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              qwt comes with examples. Did you try them?

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                toho71
                wrote on last edited by
                #7

                yepp and the problem is solved

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  vezprog
                  wrote on last edited by
                  #8

                  plotcurve->setSamples() works just fine. I have used it multiple times. Create your X and Y QVector<double> 's and just feed them in.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AstroFloyd
                    wrote on last edited by
                    #9

                    "Here":http://programmingexamples.net/wiki/Qt/QWT/Plot is a simple but complete example.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved