File: plotter.qml

package info (click to toggle)
kdeclarative 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,072 kB
  • sloc: cpp: 8,161; sh: 21; makefile: 11
file content (68 lines) | stat: -rw-r--r-- 1,473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
    SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
    SPDX-FileCopyrightText: 2015 David Edmundson <davidedmundson@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

import QtQuick 2.0
import QtQuick.Controls 2.15

import org.kde.kquickcontrolsaddons 2.0

Item {
    width: 500
    height: 200

    Plotter {
        id: renderer
        anchors.fill: parent
        anchors.margins: 0
        stacked: stackedButton.checked
        autoRange: autoRangeButton.checked
        horizontalGridLineCount: linesSpinner.value

        dataSets: [
            PlotData {
                color: "#4cb2ff"
            },
            PlotData {
                color: "#00b200"
            }
        ]

    }
    Row {
        Button {
            text: "Add values"
            checkable: true
            Timer {
                interval: 100
                running: parent.checked
                repeat: true
                onTriggered: {
                    renderer.addSample([Math.random() * 40, Math.random() * 40])
                }
            }
        }

        Button {
            id: stackedButton
            text: "Stacked"
            checkable: true
            checked: true
        }
        Button {
            id: autoRangeButton
            text: "Auto Range"
            checkable: true
            checked: true
        }

        SpinBox {
            id: linesSpinner
            value: 5
            from: 0
        }
    }
}