Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Adding points to Charts dynamically will eat up all memory?
Qt 6.11 is out! See what's new in the release blog

Adding points to Charts dynamically will eat up all memory?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 628 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.
  • Egn1n3E Offline
    Egn1n3E Offline
    Egn1n3
    wrote on last edited by
    #1

    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.

    DiracsbracketD 1 Reply Last reply
    0
    • Egn1n3E Egn1n3

      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.

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      2

      • Login

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