Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED]QWT plot doesn’t like my array

    3rd Party Software
    5
    9
    7478
    Loading More Posts
    • 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
      toho71 last edited by

      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 Reply Quote 0
      • L
        lgeyer last edited by

        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 Reply Quote 0
        • T
          toho71 last edited by

          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 Reply Quote 0
          • K
            koahnig last edited by

            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 Reply Quote 0
            • T
              toho71 last edited by

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

              1 Reply Last reply Reply Quote 0
              • K
                koahnig last edited by

                qwt comes with examples. Did you try them?

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

                1 Reply Last reply Reply Quote 0
                • T
                  toho71 last edited by

                  yepp and the problem is solved

                  1 Reply Last reply Reply Quote 0
                  • V
                    vezprog last edited by

                    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 Reply Quote 0
                    • A
                      AstroFloyd last edited by

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

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post