QuickGraphLib 0.1.0a2__cp37-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- QuickGraphLib/AntialiasingContainer.qml +18 -0
- QuickGraphLib/Axis.qml +183 -0
- QuickGraphLib/GraphArea.qml +57 -0
- QuickGraphLib/GraphItems/AxHLine.qml +34 -0
- QuickGraphLib/GraphItems/AxHSpan.qml +46 -0
- QuickGraphLib/GraphItems/AxVLine.qml +34 -0
- QuickGraphLib/GraphItems/AxVSpan.qml +46 -0
- QuickGraphLib/GraphItems/BasicLegend.qml +31 -0
- QuickGraphLib/GraphItems/BasicLegendItem.qml +57 -0
- QuickGraphLib/GraphItems/Contour.qml +34 -0
- QuickGraphLib/GraphItems/GraphItemDragHandler.qml +39 -0
- QuickGraphLib/GraphItems/Grid.qml +39 -0
- QuickGraphLib/GraphItems/Histogram.qml +39 -0
- QuickGraphLib/GraphItems/Line.qml +57 -0
- QuickGraphLib/GraphItems/Marker.qml +30 -0
- QuickGraphLib/GraphItems/QuickGraphLibGraphItems.dll +0 -0
- QuickGraphLib/GraphItems/QuickGraphLibGraphItems.qmltypes +137 -0
- QuickGraphLib/GraphItems/qmldir +21 -0
- QuickGraphLib/PreFabs/QuickGraphLibPreFabs.dll +0 -0
- QuickGraphLib/PreFabs/QuickGraphLibPreFabs.qmltypes +8 -0
- QuickGraphLib/PreFabs/XYAxes.qml +105 -0
- QuickGraphLib/PreFabs/qmldir +8 -0
- QuickGraphLib/QuickGraphLib.dll +0 -0
- QuickGraphLib/QuickGraphLib.qmltypes +179 -0
- QuickGraphLib/ScalingContainer.qml +38 -0
- QuickGraphLib/ShapeRepeater.qml +22 -0
- QuickGraphLib/TickLabel.qml +52 -0
- QuickGraphLib/ZoomPanHandler.qml +78 -0
- QuickGraphLib/qmldir +15 -0
- QuickGraphLib-0.1.0a2.dist-info/LICENCE +21 -0
- QuickGraphLib-0.1.0a2.dist-info/METADATA +78 -0
- QuickGraphLib-0.1.0a2.dist-info/RECORD +38 -0
- QuickGraphLib-0.1.0a2.dist-info/WHEEL +5 -0
- QuickGraphLib-0.1.0a2.dist-info/top_level.txt +2 -0
- quickgraphlib_helpers/__init__.py +8 -0
- quickgraphlib_helpers/consts.py +6 -0
- quickgraphlib_helpers/contours.py +79 -0
- quickgraphlib_helpers/py.typed +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
\qmltype AntialiasingContainer
|
|
8
|
+
\inqmlmodule QuickGraphLib
|
|
9
|
+
\inherits QtQuick::Item
|
|
10
|
+
\brief Enables antialiasing for it's contents.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
Item {
|
|
14
|
+
implicitHeight: 100
|
|
15
|
+
implicitWidth: 100
|
|
16
|
+
layer.enabled: true // Improves rendering of fractional DPIs
|
|
17
|
+
layer.samples: 2
|
|
18
|
+
}
|
QuickGraphLib/Axis.qml
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
pragma ComponentBehavior: Bound
|
|
5
|
+
import QtQuick
|
|
6
|
+
import QtQuick.Shapes as QQS
|
|
7
|
+
import QuickGraphLib as QuickGraphLib
|
|
8
|
+
|
|
9
|
+
/*!
|
|
10
|
+
\qmltype Axis
|
|
11
|
+
\inqmlmodule QuickGraphLib
|
|
12
|
+
\inherits QtQuick::Item
|
|
13
|
+
\brief Displays an Axis.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
Item {
|
|
17
|
+
id: root
|
|
18
|
+
|
|
19
|
+
enum Direction {
|
|
20
|
+
Left,
|
|
21
|
+
Right,
|
|
22
|
+
Top,
|
|
23
|
+
Bottom
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/*!
|
|
27
|
+
TODO
|
|
28
|
+
\sa {GraphArea::dataTransform}
|
|
29
|
+
*/
|
|
30
|
+
property alias dataTransform: helper.dataTransform
|
|
31
|
+
/*! TODO */
|
|
32
|
+
property int decimalPoints: 2
|
|
33
|
+
/*! TODO
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
\value Axis.Direction.Left Axis to the left of the GraphArea
|
|
37
|
+
\value Axis.Direction.Right Axis to the right of the GraphArea
|
|
38
|
+
\value Axis.Direction.Top Axis above of the GraphArea
|
|
39
|
+
\value Axis.Direction.Bottom Axis below of the GraphArea
|
|
40
|
+
*/
|
|
41
|
+
property alias direction: helper.direction
|
|
42
|
+
/*! TODO */
|
|
43
|
+
property alias label: labelText.text
|
|
44
|
+
/*! TODO */
|
|
45
|
+
property alias labelColor: labelText.color
|
|
46
|
+
/*! TODO */
|
|
47
|
+
property alias labelFont: labelText.font
|
|
48
|
+
/*! TODO */
|
|
49
|
+
property bool showTickLabels: true
|
|
50
|
+
/*! TODO */
|
|
51
|
+
property double spacing: 4
|
|
52
|
+
/*! TODO */
|
|
53
|
+
property alias strokeColor: myPath.strokeColor
|
|
54
|
+
/*! TODO */
|
|
55
|
+
property alias strokeWidth: myPath.strokeWidth
|
|
56
|
+
/*! TODO */
|
|
57
|
+
property Component tickDelegate: TickLabel {
|
|
58
|
+
color: root.labelColor
|
|
59
|
+
decimalPoints: root.decimalPoints
|
|
60
|
+
direction: root.direction
|
|
61
|
+
font: root.labelFont
|
|
62
|
+
}
|
|
63
|
+
/*! TODO */
|
|
64
|
+
property color tickLabelColor: labelColor
|
|
65
|
+
/*! TODO */
|
|
66
|
+
property font tickLabelFont: labelFont
|
|
67
|
+
/*! TODO */
|
|
68
|
+
property alias tickLength: helper.tickLength
|
|
69
|
+
/*! TODO */
|
|
70
|
+
property alias ticks: helper.ticks
|
|
71
|
+
|
|
72
|
+
implicitHeight: {
|
|
73
|
+
switch (root.direction) {
|
|
74
|
+
case Axis.Direction.Left:
|
|
75
|
+
case Axis.Direction.Right:
|
|
76
|
+
return 100;
|
|
77
|
+
case Axis.Direction.Top:
|
|
78
|
+
case Axis.Direction.Bottom:
|
|
79
|
+
let height = 0;
|
|
80
|
+
if (ticks.length > 0) {
|
|
81
|
+
height += root.tickLength + Math.max(0, ...[...Array(tickLabels.count).keys()].map(i => tickLabels.itemAt(i)?.height));
|
|
82
|
+
}
|
|
83
|
+
if (label !== "") {
|
|
84
|
+
height += labelText.height + root.spacing;
|
|
85
|
+
}
|
|
86
|
+
return height;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
implicitWidth: {
|
|
90
|
+
switch (root.direction) {
|
|
91
|
+
case Axis.Direction.Left:
|
|
92
|
+
case Axis.Direction.Right:
|
|
93
|
+
let width = 0;
|
|
94
|
+
if (ticks.length > 0) {
|
|
95
|
+
width += root.tickLength + Math.max(0, ...[...Array(tickLabels.count).keys()].map(i => tickLabels.itemAt(i)?.width));
|
|
96
|
+
}
|
|
97
|
+
if (label !== "") {
|
|
98
|
+
width += labelText.height + root.spacing;
|
|
99
|
+
}
|
|
100
|
+
return width;
|
|
101
|
+
case Axis.Direction.Top:
|
|
102
|
+
case Axis.Direction.Bottom:
|
|
103
|
+
return 100;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
z: 1
|
|
107
|
+
|
|
108
|
+
QuickGraphLib.AxisHelper {
|
|
109
|
+
id: helper
|
|
110
|
+
|
|
111
|
+
height: root.height
|
|
112
|
+
tickLength: 10
|
|
113
|
+
width: root.width
|
|
114
|
+
}
|
|
115
|
+
QQS.Shape {
|
|
116
|
+
id: shape
|
|
117
|
+
|
|
118
|
+
anchors.fill: parent
|
|
119
|
+
|
|
120
|
+
QQS.ShapePath {
|
|
121
|
+
id: myPath
|
|
122
|
+
|
|
123
|
+
strokeColor: "black"
|
|
124
|
+
strokeWidth: 1
|
|
125
|
+
|
|
126
|
+
PathPolyline {
|
|
127
|
+
path: helper.path
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
Repeater {
|
|
132
|
+
id: tickLabels
|
|
133
|
+
|
|
134
|
+
delegate: root.tickDelegate
|
|
135
|
+
model: root.showTickLabels ? helper.tickModel : null
|
|
136
|
+
}
|
|
137
|
+
Text {
|
|
138
|
+
id: labelText
|
|
139
|
+
|
|
140
|
+
x: {
|
|
141
|
+
switch (root.direction) {
|
|
142
|
+
case Axis.Direction.Left:
|
|
143
|
+
return height / 2;
|
|
144
|
+
case Axis.Direction.Right:
|
|
145
|
+
return root.width - height / 2;
|
|
146
|
+
case Axis.Direction.Top:
|
|
147
|
+
case Axis.Direction.Bottom:
|
|
148
|
+
return root.width / 2;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
y: {
|
|
152
|
+
switch (root.direction) {
|
|
153
|
+
case Axis.Direction.Left:
|
|
154
|
+
case Axis.Direction.Right:
|
|
155
|
+
return root.height / 2;
|
|
156
|
+
case Axis.Direction.Top:
|
|
157
|
+
return height / 2;
|
|
158
|
+
case Axis.Direction.Bottom:
|
|
159
|
+
return root.height - height / 2;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
transform: [
|
|
164
|
+
Translate {
|
|
165
|
+
x: -labelText.width / 2
|
|
166
|
+
y: -labelText.height / 2
|
|
167
|
+
},
|
|
168
|
+
Rotation {
|
|
169
|
+
angle: {
|
|
170
|
+
switch (root.direction) {
|
|
171
|
+
case Axis.Direction.Left:
|
|
172
|
+
return -90;
|
|
173
|
+
case Axis.Direction.Right:
|
|
174
|
+
return 90;
|
|
175
|
+
case Axis.Direction.Top:
|
|
176
|
+
case Axis.Direction.Bottom:
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
\qmltype Histogram
|
|
9
|
+
\inqmlmodule QuickGraphLib
|
|
10
|
+
\inherits QtQuick::Shapes::Shape
|
|
11
|
+
\brief An area that graphs can be added to.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
QQS.Shape {
|
|
15
|
+
id: root
|
|
16
|
+
|
|
17
|
+
/*!
|
|
18
|
+
Transform from data coordinates to pixel coordinates inside the GraphArea with the viewTransform applied
|
|
19
|
+
*/
|
|
20
|
+
readonly property matrix4x4 dataTransform: viewTransform.times(rawDataTransform)
|
|
21
|
+
/*!
|
|
22
|
+
The view rect the view is actually showing based on viewTransform
|
|
23
|
+
*/
|
|
24
|
+
readonly property rect effectiveViewRect: {
|
|
25
|
+
let mat = rawDataTransform.inverted().times(viewTransform.inverted().times(rawDataTransform));
|
|
26
|
+
// Map corners instead of the whole rect to preserve the invertedness of each axis
|
|
27
|
+
let blCorner = mat.map(Qt.point(viewRect.x, viewRect.y));
|
|
28
|
+
let trCorner = mat.map(Qt.point(viewRect.right, viewRect.bottom));
|
|
29
|
+
return Qt.rect(blCorner.x, blCorner.y, trCorner.x - blCorner.x, trCorner.y - blCorner.y);
|
|
30
|
+
}
|
|
31
|
+
/*!
|
|
32
|
+
Transform from data coordinates to pixel coordinates inside the GraphArea
|
|
33
|
+
*/
|
|
34
|
+
readonly property matrix4x4 rawDataTransform: {
|
|
35
|
+
let mat = Qt.matrix4x4();
|
|
36
|
+
// Flip coordinate system so that Y points upwards
|
|
37
|
+
mat.translate(Qt.vector3d(0, root.height, 0));
|
|
38
|
+
mat.scale(root.width / viewRect.width, -root.height / viewRect.height, 1);
|
|
39
|
+
mat.translate(Qt.vector3d(-viewRect.x, -viewRect.y, 0));
|
|
40
|
+
return mat;
|
|
41
|
+
}
|
|
42
|
+
/*! TODO */
|
|
43
|
+
required property rect viewRect
|
|
44
|
+
/*! TODO */
|
|
45
|
+
property matrix4x4 viewTransform
|
|
46
|
+
|
|
47
|
+
function baseTransformFromRect(r: rect): matrix4x4 {
|
|
48
|
+
let mat = Qt.matrix4x4();
|
|
49
|
+
mat.scale(viewRect.width / r.width, viewRect.height / r.height, 1);
|
|
50
|
+
mat.translate(Qt.vector3d((viewRect.x - r.x) / viewRect.width, (r.y + r.height - viewRect.y - viewRect.height) / viewRect.height, 0));
|
|
51
|
+
return mat;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
clip: true
|
|
55
|
+
implicitHeight: 100
|
|
56
|
+
implicitWidth: 100
|
|
57
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
\qmltype AxHLine
|
|
9
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
10
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
11
|
+
\brief Displays a horizontal line.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
QQS.ShapePath {
|
|
15
|
+
id: root
|
|
16
|
+
|
|
17
|
+
readonly property point bottomRightPoint: dataTransform.map(Qt.point(viewRect.right, position))
|
|
18
|
+
|
|
19
|
+
/*! TODO */
|
|
20
|
+
required property matrix4x4 dataTransform
|
|
21
|
+
/*! TODO */
|
|
22
|
+
required property double position
|
|
23
|
+
readonly property point topLeftPoint: dataTransform.map(Qt.point(viewRect.left, position))
|
|
24
|
+
/*! TODO */
|
|
25
|
+
required property rect viewRect
|
|
26
|
+
|
|
27
|
+
startX: topLeftPoint.x
|
|
28
|
+
startY: topLeftPoint.y
|
|
29
|
+
|
|
30
|
+
PathLine {
|
|
31
|
+
x: root.bottomRightPoint.x
|
|
32
|
+
y: root.topLeftPoint.y
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
\qmltype AxHSpan
|
|
9
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
10
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
11
|
+
\brief Displays a horizontal span.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
QQS.ShapePath {
|
|
15
|
+
id: root
|
|
16
|
+
|
|
17
|
+
readonly property point bottomRightPoint: dataTransform.map(Qt.point(viewRect.right, yMin))
|
|
18
|
+
|
|
19
|
+
/*! TODO */
|
|
20
|
+
required property matrix4x4 dataTransform
|
|
21
|
+
readonly property point topLeftPoint: dataTransform.map(Qt.point(viewRect.left, yMax))
|
|
22
|
+
/*! TODO */
|
|
23
|
+
required property rect viewRect
|
|
24
|
+
/*! TODO */
|
|
25
|
+
required property double yMax
|
|
26
|
+
/*! TODO */
|
|
27
|
+
required property double yMin
|
|
28
|
+
|
|
29
|
+
startX: topLeftPoint.x
|
|
30
|
+
startY: topLeftPoint.y
|
|
31
|
+
strokeColor: "transparent"
|
|
32
|
+
|
|
33
|
+
PathLine {
|
|
34
|
+
x: root.bottomRightPoint.x + root.strokeWidth
|
|
35
|
+
y: root.topLeftPoint.y
|
|
36
|
+
}
|
|
37
|
+
// Would be much nicer to use PathMove, but then the whole rect is not filled
|
|
38
|
+
PathLine {
|
|
39
|
+
x: root.bottomRightPoint.x + root.strokeWidth
|
|
40
|
+
y: root.bottomRightPoint.y
|
|
41
|
+
}
|
|
42
|
+
PathLine {
|
|
43
|
+
x: root.topLeftPoint.x
|
|
44
|
+
y: root.bottomRightPoint.y
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
\qmltype AxVLine
|
|
9
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
10
|
+
\inherits QtQuick::Rectangle
|
|
11
|
+
\brief Displays an vertical line.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
QQS.ShapePath {
|
|
15
|
+
id: root
|
|
16
|
+
|
|
17
|
+
readonly property point bottomRightPoint: dataTransform.map(Qt.point(position, viewRect.top))
|
|
18
|
+
|
|
19
|
+
/*! TODO */
|
|
20
|
+
required property matrix4x4 dataTransform
|
|
21
|
+
/*! TODO */
|
|
22
|
+
required property double position
|
|
23
|
+
readonly property point topLeftPoint: dataTransform.map(Qt.point(position, viewRect.bottom))
|
|
24
|
+
/*! TODO */
|
|
25
|
+
required property rect viewRect
|
|
26
|
+
|
|
27
|
+
startX: topLeftPoint.x
|
|
28
|
+
startY: topLeftPoint.y
|
|
29
|
+
|
|
30
|
+
PathLine {
|
|
31
|
+
x: root.topLeftPoint.x
|
|
32
|
+
y: root.bottomRightPoint.y + root.strokeWidth
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
\qmltype AxVSpan
|
|
9
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
10
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
11
|
+
\brief Displays an vertical span.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
QQS.ShapePath {
|
|
15
|
+
id: root
|
|
16
|
+
|
|
17
|
+
readonly property point bottomRightPoint: dataTransform.map(Qt.point(xMax, viewRect.top))
|
|
18
|
+
|
|
19
|
+
/*! TODO */
|
|
20
|
+
required property matrix4x4 dataTransform
|
|
21
|
+
readonly property point topLeftPoint: dataTransform.map(Qt.point(xMin, viewRect.bottom))
|
|
22
|
+
/*! TODO */
|
|
23
|
+
required property rect viewRect
|
|
24
|
+
/*! TODO */
|
|
25
|
+
required property double xMax
|
|
26
|
+
/*! TODO */
|
|
27
|
+
required property double xMin
|
|
28
|
+
|
|
29
|
+
startX: topLeftPoint.x
|
|
30
|
+
startY: topLeftPoint.y
|
|
31
|
+
strokeColor: "transparent"
|
|
32
|
+
|
|
33
|
+
PathLine {
|
|
34
|
+
x: root.topLeftPoint.x
|
|
35
|
+
y: root.bottomRightPoint.y + root.strokeWidth
|
|
36
|
+
}
|
|
37
|
+
// Would be much nicer to use PathMove, but then the whole rect is not filled
|
|
38
|
+
PathLine {
|
|
39
|
+
x: root.bottomRightPoint.x
|
|
40
|
+
y: root.bottomRightPoint.y + root.strokeWidth
|
|
41
|
+
}
|
|
42
|
+
PathLine {
|
|
43
|
+
x: root.bottomRightPoint.x
|
|
44
|
+
y: root.topLeftPoint.y
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
\qmltype BasicLegend
|
|
8
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
9
|
+
\inherits QtQuick::Rectangle
|
|
10
|
+
\brief Displays a simple legend.
|
|
11
|
+
|
|
12
|
+
\note This graph item does not inherit from ShapePath, unlike other graph items.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
Rectangle {
|
|
16
|
+
/*! TODO */
|
|
17
|
+
default property alias contentChildren: legend.children
|
|
18
|
+
/*! TODO */
|
|
19
|
+
property alias verticalSpacing: legend.spacing
|
|
20
|
+
|
|
21
|
+
border.color: "black"
|
|
22
|
+
color: "#aaffffff"
|
|
23
|
+
height: legend.height + 10
|
|
24
|
+
width: legend.width + 10
|
|
25
|
+
|
|
26
|
+
Column {
|
|
27
|
+
id: legend
|
|
28
|
+
|
|
29
|
+
anchors.centerIn: parent
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
\qmltype BasicLegendItem
|
|
8
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
9
|
+
\inherits QtQuick::Row
|
|
10
|
+
\brief An single entry in a simple legend.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
Row {
|
|
14
|
+
id: root
|
|
15
|
+
|
|
16
|
+
/*! TODO */
|
|
17
|
+
property color fillColor: "transparent"
|
|
18
|
+
/*! TODO */
|
|
19
|
+
property Gradient fillGradient: null
|
|
20
|
+
/*! TODO */
|
|
21
|
+
property color strokeColor: "black"
|
|
22
|
+
/*! TODO */
|
|
23
|
+
property real strokeWidth: 1
|
|
24
|
+
/*! TODO */
|
|
25
|
+
property alias text: label.text
|
|
26
|
+
/*! TODO */
|
|
27
|
+
property alias textColor: label.color
|
|
28
|
+
/*! TODO */
|
|
29
|
+
property alias textFont: label.font
|
|
30
|
+
|
|
31
|
+
spacing: 2
|
|
32
|
+
|
|
33
|
+
Item {
|
|
34
|
+
id: clipper
|
|
35
|
+
|
|
36
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
37
|
+
clip: true
|
|
38
|
+
height: root.height - 2
|
|
39
|
+
width: root.height - 2
|
|
40
|
+
|
|
41
|
+
Rectangle {
|
|
42
|
+
border.color: root.strokeColor
|
|
43
|
+
border.width: root.strokeWidth
|
|
44
|
+
color: root.fillColor
|
|
45
|
+
gradient: root.fillGradient
|
|
46
|
+
height: clipper.height / 2 + root.strokeWidth * 2
|
|
47
|
+
width: clipper.width + root.strokeWidth * 4
|
|
48
|
+
x: -root.strokeWidth * 2
|
|
49
|
+
y: clipper.height / 2
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
Text {
|
|
53
|
+
id: label
|
|
54
|
+
|
|
55
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
import QuickGraphLib as QuickGraphLib
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
\qmltype Contours
|
|
10
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
11
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
12
|
+
\brief Draw a contour line or fill.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
QQS.ShapePath {
|
|
16
|
+
id: root
|
|
17
|
+
|
|
18
|
+
/*!
|
|
19
|
+
TODO
|
|
20
|
+
*/
|
|
21
|
+
required property matrix4x4 dataTransform
|
|
22
|
+
/*!
|
|
23
|
+
TODO
|
|
24
|
+
*/
|
|
25
|
+
required property var paths
|
|
26
|
+
|
|
27
|
+
capStyle: QQS.ShapePath.RoundCap
|
|
28
|
+
fillColor: "transparent"
|
|
29
|
+
joinStyle: QQS.ShapePath.RoundJoin
|
|
30
|
+
|
|
31
|
+
PathMultiline {
|
|
32
|
+
paths: root.paths.map(ps => QuickGraphLib.Helpers.mapPoints(ps, root.dataTransform))
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
\qmltype GraphItemDragHandler
|
|
8
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
9
|
+
\inherits QtQuick::MouseArea
|
|
10
|
+
\brief Assists converting mouse drags into data positions.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
MouseArea {
|
|
14
|
+
id: root
|
|
15
|
+
|
|
16
|
+
property rect _startDragPos
|
|
17
|
+
|
|
18
|
+
/*! TODO */
|
|
19
|
+
required property matrix4x4 dataTransform
|
|
20
|
+
/*! TODO */
|
|
21
|
+
property bool dragging
|
|
22
|
+
|
|
23
|
+
signal moved(rect position)
|
|
24
|
+
|
|
25
|
+
hoverEnabled: true
|
|
26
|
+
|
|
27
|
+
onPositionChanged: event => {
|
|
28
|
+
if (dragging) {
|
|
29
|
+
moved(dataTransform.inverted().mapRect(Qt.rect(root.x + event.x - _startDragPos.x, parent.y + root.y - _startDragPos.y, _startDragPos.width, _startDragPos.height)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
onPressed: event => {
|
|
33
|
+
_startDragPos = Qt.rect(mouseX, mouseY, width, height);
|
|
34
|
+
dragging = true;
|
|
35
|
+
}
|
|
36
|
+
onReleased: event => {
|
|
37
|
+
dragging = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
import QuickGraphLib.GraphItems as QGLGraphItems
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
\qmltype Grid
|
|
10
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
11
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
12
|
+
\brief Displays a grid in the background of a graph.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
QQS.ShapePath {
|
|
16
|
+
id: root
|
|
17
|
+
|
|
18
|
+
property QGLGraphItems.GridHelper _helper: QGLGraphItems.GridHelper {
|
|
19
|
+
id: helper
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*! TODO */
|
|
24
|
+
property alias dataTransform: helper.dataTransform
|
|
25
|
+
/*! TODO */
|
|
26
|
+
property alias viewRect: helper.viewRect
|
|
27
|
+
/*! TODO */
|
|
28
|
+
property alias xTicks: helper.xTicks
|
|
29
|
+
/*! TODO */
|
|
30
|
+
property alias yTicks: helper.yTicks
|
|
31
|
+
|
|
32
|
+
capStyle: QQS.ShapePath.RoundCap
|
|
33
|
+
fillColor: "transparent"
|
|
34
|
+
joinStyle: QQS.ShapePath.RoundJoin
|
|
35
|
+
|
|
36
|
+
PathMultiline {
|
|
37
|
+
paths: helper.paths
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import QtQuick
|
|
5
|
+
import QtQuick.Shapes as QQS
|
|
6
|
+
import QuickGraphLib.GraphItems as QGLGraphItems
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
\qmltype Histogram
|
|
10
|
+
\inqmlmodule QuickGraphLib.GraphItems
|
|
11
|
+
\inherits QtQuick::Shapes::ShapePath
|
|
12
|
+
\brief Displays a histogram.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
QQS.ShapePath {
|
|
16
|
+
id: root
|
|
17
|
+
|
|
18
|
+
property QGLGraphItems.HistogramHelper _helper: QGLGraphItems.HistogramHelper {
|
|
19
|
+
id: helper
|
|
20
|
+
|
|
21
|
+
vertical: false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*! TODO */
|
|
25
|
+
property alias bins: helper.bins
|
|
26
|
+
/*! TODO */
|
|
27
|
+
property alias dataTransform: helper.dataTransform
|
|
28
|
+
/*! TODO */
|
|
29
|
+
property alias heights: helper.heights
|
|
30
|
+
/*! TODO */
|
|
31
|
+
property alias vertical: helper.vertical
|
|
32
|
+
|
|
33
|
+
capStyle: QQS.ShapePath.RoundCap
|
|
34
|
+
joinStyle: QQS.ShapePath.RoundJoin
|
|
35
|
+
|
|
36
|
+
PathPolyline {
|
|
37
|
+
path: root._helper.path
|
|
38
|
+
}
|
|
39
|
+
}
|