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. QwtPlot sending runtime exception when trying to show a curve with 8000 points
QtWS25 Last Chance

QwtPlot sending runtime exception when trying to show a curve with 8000 points

Scheduled Pinned Locked Moved 3rd Party Software
6 Posts 2 Posters 1.9k 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.
  • V Offline
    V Offline
    vahidnateghi
    wrote on last edited by
    #1

    I'm trying to show two curves in a QwtPlot and replot each 20 miliseconds. But when I run my program it throws a runtime exception.

    Here are my variables:
    @QwtPlot * spectrum = new QwtPlot();
    QwtPlotCurve * Tcurve = new QwtPlotCurve();
    QwtPlotCurve * Scurve = new QwtPlotCurve();
    QpolygonF Tpoints;
    QpolygonF Spoints;
    const int count = 1;@

    And here is the code for every time I replot spectrum :
    @for(i=0;i<4006;i+=count)
    {
    Tpoints << QPointF(i,intArray[i]);
    }
    for(;i<8012;i+=count)
    {
    Spoints << QPointF(i-4005,intArray[i]);
    }

    Tcurve->setSamples(Tpoints);
    Scurve->setSamples(Spoints);

    Tcurve->attach(spectrum);
    Scurve->attach(spectrum);

    spectrum->replot();@

    The intArray array is updated every millisecond through a UDP socket connection but the spectrum is updated each 20 milliseconds.

    Farther info: The size of the QwtPlot is 1000x280

    Thank you in advance for your help,

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

      welcome to devnet

      Did you try to set a lower update rate (e.g. 1 second or even more)?
      Which version of Qwt are you using?
      Also OS, compiler?

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

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vahidnateghi
        wrote on last edited by
        #3

        Thank You :)

        Yes, I set it to 100 milliseconds, 1 second and 2 seconds, still the same.
        I'm using qwt 6.1.0, with Qt 5.1.1 MinGW 32bit compiler and in Windows.

        When I reduce the number of points the exception does not occur but unfortunately I need all of the points shown.
        I have also set a QwtPlotZoomer for the plot, when I set count to 2 and zoom in just after the program starts the exception does not appear but when I zoom out the exception is instantly thrown. It's like the plot can't show all the 8000 points together...

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

          I am using the same configuration, but still Qt 5.1.0. I have much more points. Therefore, I guess it should not be an issue in your case either.
          I looks more that something might not be initialized. debug and release versions do show the same problem?
          Can you start it in debugger? This gives you generally quite a good guess where to search.

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

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vahidnateghi
            wrote on last edited by
            #5

            I used both the debug and release versions and in got the exception in both.
            I also ran the debugger which gave me a signal with : "Signal meaning: Segmentation fault"

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vahidnateghi
              wrote on last edited by
              #6

              I did a little search around segmentation fault in this case, gonna change my Qt version to see if that will make a difference.

              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