Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Adding points to Charts dynamically will eat up all memory?



  • Hi all,

    I am adding points to the spline chart using the append method like this:

    series1.append(xindex, message);
    xindex++;

    I also update the x-axis accordingly so the spline chart "scrolls" from right to left:

    if(xindex > axisX.max){
    axisX.min++;
    axisX.max++;
    }

    My question: by keep appending points to the spline graph I would assume you run out of memory at some time?
    I can remove the first point when I hit the max on the X-axis but still my xindex counter would go up indefinitely:

    if (xindex > axisX.max) {
    series1.remove(0);
    }

    Any thoughts about his? Is there a better way?

    Thanks.



  • @Egn1n3
    Have a look at this post:
    https://forum.qt.io/topic/93398/sliding-grid-for-chart
    It shows how you can implement a "moving" graph.


Log in to reply