Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. 3D scatter how to update new points and remove old one
Forum Update on Monday, May 27th 2025

3D scatter how to update new points and remove old one

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.5k 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
    Vera
    wrote on last edited by Vera
    #1

    Hello,
    I am using the 3D scatter plot to plot 3D points, I can add new points to this plot but then the old ones stay and I want them to be removed when the new points are added. My code looks like this:

    scatter.setFlags(scatter.flags() ^Qt::FramelessWindowHint);
    QScatter3DSeries *series = new QScatter3DSeries;
    //here I add the points to the 3Dscatterarray
    data << QVector3D(o.x, o.y, o.z);
    
    scatter.removeSeries(prevseries);
    series->dataProxy()->addItems(data);
    scatter.addSeries(series);
    data.clear();
    prevseries = series;
    
    

    I tried as seen in the code to remove the previous series but that doesn't work. I also looked at the scatter example but that didn't help/work.
    Hope someone can help me with this problem.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I wonder if you can call
      void QScatterDataProxy::resetArray(QScatterDataArray *newArray)
      with NULL
      and then use additem.
      https://doc.qt.io/qt-5.10/qscatterdataproxy.html#resetArray

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

        Hello,
        Thanks for your response. I tried it out and it didn't work, it still didn't remove the points out of the scatter. The only thing it did was refreshing the window which made it spring a bit around.
        I think it clears the array but not the scatter plot, do you know if there's a way to clear the scatter plot I haven't been able to find it.

        mrjjM 1 Reply Last reply
        0
        • V Vera

          Hello,
          Thanks for your response. I tried it out and it didn't work, it still didn't remove the points out of the scatter. The only thing it did was refreshing the window which made it spring a bit around.
          I think it clears the array but not the scatter plot, do you know if there's a way to clear the scatter plot I haven't been able to find it.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Vera
          Im sure i understand why
          scatter.removeSeries(prevseries); do not remove the data ?

          V 1 Reply Last reply
          0
          • mrjjM mrjj

            @Vera
            Im sure i understand why
            scatter.removeSeries(prevseries); do not remove the data ?

            V Offline
            V Offline
            Vera
            wrote on last edited by
            #5

            @mrjj
            I got it working. So the removeSeries works i did it like this now:

             scatter.removeSeries(prevseries);
             series->dataProxy()->addItems(data);
             scatter.addSeries(series);
             data.clear();
             prevseries = series;
            

            this works now it deletes the previous data, I also set the program to 1fps haven't tried putting it faster but it works now. Thanks for your help

            1 Reply Last reply
            1

            • Login

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