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. Dynamic ChartView updating
Forum Updated to NodeBB v4.3 + New Features

Dynamic ChartView updating

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

    In my program data for chart are producing in c++ and the QML function is called like this

    QMetaObject::invokeMethod(view.rootObject(), "readValues", Qt::DirectConnection,
                Q_ARG(QVariant, QVariant::fromValue(list)));
    
    

    then data series are appended in readValues function

    Item{
        id: chart
        ChartView {
            id: chartView
            width: parent.width
            height: parent.height
            theme: ChartView.ChartThemeLight
            antialiasing: true
            legend.visible: false
    
            ValueAxis {
                id: axisX
                titleText: "D   N   I"
                labelsFont: Qt.font({pointSize: 12, bold: true})
                min: 0
                max: 200
                tickCount: 21
                labelFormat: "%.0f"
            }
    
            ValueAxis {
                id: axisY
                labelsFont: Qt.font({pointSize: 12, bold: true})
                min: 0
                max: 14000
                tickCount: 8
                labelFormat: "%.0f"
            }
    
            LineSeries {
                id: infectedSeries
                axisX: axisX
                axisY: axisY
                color: "blue"
                width: 4
            }
        }
    
        function readValues(collection)
        {
            for (var i = 0; i < collection.length; i++)
            {
                infectedSeries.append(i, collection[i]);
                console.log("Array item:   " + i + "   val  " + collection[i]);
            }
            // chartView.update();
        }
    }
    
    

    There is no effect on chart. It is strange because on the console logs are printed properly

    Thank you in advance

    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