QT Charts dragable



  • Hi,
    I have a question regarding QT Qml and QT Charts.
    I want to create a interface, where the User can add Control Elements and choose a time where the Control should be activated.
    It should be possible to drag a point in the chart, for example from the Point 40/0 to the Point 50/0 (see code comments below), is there a way to do this with Qt Charts? In the Chart Example scatterinteractions i found a solution to mark scatter points, but i want also to be able to move the marked Points, and use the x values of the moved point to configure my time control.

    Thank you for your help!

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import QtCharts 2.0
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Diagram")
        ChartView {
            title: "Diag"
            anchors.fill: parent
            antialiasing: true
    
            ValueAxis {
                id: valueAxis
                min: 0
                max: 60
                tickCount: 7
                labelFormat: "%.0f"
            }
            ValueAxis {
                id: axisY
                min: 0
                max: 1.5
                tickCount: 3
                labelFormat: "%.0f"
            }
    
            LineSeries {
                name: "signal 1"
                axisX: valueAxis
                axisY: axisY
                XYPoint { x: 0; y: 0 }
                XYPoint { x: 10; y: 0 }
                XYPoint { x: 10; y: 1 }
                XYPoint { x: 40; y: 1 } //drag this point to 50/1
                XYPoint { x: 40; y: 0 } //drag this point to 50/0
                XYPoint { x: 60; y: 0 }
            }
        }
    }
    
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.