Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to update QML chart during runtime ?
Qt 6.12 LTS is out! See what's new in the release blog

How to update QML chart during runtime ?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 782 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.
  • vishnuV Offline
    vishnuV Offline
    vishnu
    wrote on last edited by vishnu
    #1

    I found this link in this forum. It works fine after integrating into my application. But i am not able to add data during runtime and not able to display it.

    1. In QMLChartData.Js
      How to push data to the variable data.
    var ChartLineData = {
          labels: ["January","February","March","April","May","June","July","January","February","March","April","May","June","July"],
        datasets: [{
            fillColor : "rgba(220,220,220,0.2)",
            strokeColor : "rgba(220,220,220,1)",
            pointColor : "rgba(220,220,220,1)",
            pointStrokeColor : "#fff",
            pointHighlightFill : "#fff",
            pointHighlightStroke : "rgba(220,220,220,1)",
            **data **: [20,20,40,50,4,35,100,200]
        }]
    }
    

    Since i have imported and binded like this
    import "QMLChartData.js" as ChartsData
    property var chartLineData: ChartsData.ChartLineData
    //push new data
    chartLineData.datasets.data.push(100);// It says cannot call method push of undefined.

    But I am able to push data to labels.
    chartLineData.labels.push("december")
    chart_line.requestPaint()
    but not able to display it on the graph even though i called reqeustPaint().Any help please. I just want to draw a line graph based on the data from cpp side.Any example would be really helpful. Thanks

    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
    • Unsolved