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

QChart Time Series



  • Hi All,

    I am very new to qml programming and I have a problem with using datatimeaxis in qChart. I defined my axis like below :

    DateTimeAxis {
                       id:axisX
                       format: "hh:mm:ss"
                       tickCount: 5
                   }
    
                   ValueAxis {
                       id: axisY
                       min: -0.5
                       max: 1.5
                   }
    
                   LineSeries {
                       id: series1
                       name: "signal 1"
                       axisX: axisX
                       axisY: axisY
                   }
    

    I try to create a time series with timer. But I could not plot the x axis in the time domain. I could not find the right way to use Date() and convert it to hour:minute:second

    onTriggered: {
                read_ready = !read_read
                    var date = new Date()
                    *******series1.append(new Date()..howtodo?????, Math.random());*******
                    console.log("r1 :",date.toLocaleTimeString(Qt.locale("en_US"), "hh:mm:ss"))
                    console.log("r2 :",new Date().getTime())
    }
    

    Thank yo so much for your help and sorry for my poor english


Log in to reply