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

"swipe" navigation through ChartView



  • Hi
    I want to navigate through data shown in a ChartView. On swipe left or tap on the left half of the View I want to show the data from the pre2vious day.
    And ideas?

    Sebastian



  • If you lift the requirement of tapping, you can simply nest the ChartView inside a ScrollView.
    If you want also tapping, you should also instantiate a TapHandler and hook into onSingleTapped.



  • Hi
    I think I haven't explained it properly.
    I've got two buttons "back" and "continue" to change the date of data shown in the chart.
    For better usability I also want to swipe left or right on the Chart to change the Date.
    I don't think the ScrollView is the right Widget.

    This is part of my code:

        Rectangle {
            id: rectangle
            anchors.fill: parent
            color: "black"
                GridLayout {
                    id: gridLayout
                    anchors.fill: parent
                    columns: 3
    
                    Button {
                        id: butBack
                        icon.source: "images/back.png"
                    }
    
                    Button {
                        id: butDate
                        text: qsTr("Date")
                        Layout.fillWidth: true
                        transformOrigin: Item.Center
                    }
    
                    Button {
                        id: butContinue
                        display: AbstractButton.IconOnly
                        icon.source: "media/Continue.png"
                    }
                    ChartView {
                        id: chartView
                        Layout.columnSpan: 3
                        Layout.fillHeight: true
                        Layout.fillWidth: true
                        antialiasing: true
                        theme: ChartView.ChartThemeDark
                    }
            }
        }
    
    

Log in to reply