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. How to add XYPoint elements to LineSeries dynamically?

How to add XYPoint elements to LineSeries dynamically?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.0k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by
    #1

    I have:
    @
    Rectangle {
    width: parent.width;
    height: root.height;

    ChartView {
    id: chartView;
    width: parent.width;
    height: parent.height;

    ValueAxis {
    id: lightIntensity;
    min: 1.2000;
    max: 2.0000;
    tickCount: 1;
    }

    DateTimeAxis {
    id: time;
    format: "mm ss";
    tickCount: 1;
    }

    LineSeries {
    id: series1;
    name: "Lumine/Sec";
    axisX: time;
    axisY: lightIntensity;
    }
    }

    Component.onCompleted: {
    for (var i = 1; i <= 301; i++) {
    series1.append(i*1000+getTimestamp(), getRandom());
    }
    }
    }
    @

    It isn't working. Why? What's wrong?
    If I add it manually it's working:
    @
    Rectangle {
    width: parent.width;
    height: root.height;

    ChartView {
    id: chartView;
    width: parent.width;
    height: parent.height;

    ValueAxis {
    id: lightIntensity;
    min: 1.2000;
    max: 2.0000;
    tickCount: 1;
    }

    DateTimeAxis {
    id: time;
    format: "mm ss";
    tickCount: 1;
    }

    LineSeries {
    id: series1;
    name: "Lumine/Sec";
    axisX: time;
    axisY: lightIntensity;
    }

    XYPoint {x: getTimestamp()+21000; y:getRandom();}
    XYPoint {x: getTimestamp()+3
    1000; y:getRandom();}
    XYPoint {x: getTimestamp()+41000; y:getRandom();}
    XYPoint {x: getTimestamp()+5
    1000; y:getRandom();}
    XYPoint {x: getTimestamp()+61000; y:getRandom();}
    XYPoint {x: getTimestamp()+7
    1000; y:getRandom();}
    XYPoint {x: getTimestamp()+81000; y:getRandom();}
    XYPoint {x: getTimestamp()+9
    1000; y:getRandom();}
    }
    }
    @
    Question is:

    1. How to add dynamically XYPoint?
    2. Could I periodically delete the first element and add to end of it next one element within new value? (I need to make realtime visualisation only via QML/JS)
    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