QuickGraphLib 0.1.0a0__tar.gz → 0.1.0a2__tar.gz

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.
Files changed (125) hide show
  1. quickgraphlib-0.1.0a2/CMakeLists.txt +19 -0
  2. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/LICENCE +1 -1
  3. quickgraphlib-0.1.0a2/MANIFEST.in +3 -0
  4. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/PKG-INFO +9 -4
  5. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/AntialiasingContainer.qml +1 -1
  6. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/Axis.qml +36 -80
  7. quickgraphlib-0.1.0a2/QuickGraphLib/CMakeLists.txt +27 -0
  8. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphArea.qml +5 -2
  9. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/AxHLine.qml +34 -0
  10. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/AxHSpan.qml +46 -0
  11. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/AxVLine.qml +34 -0
  12. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/AxVSpan.qml +46 -0
  13. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/BasicLegend.qml +3 -1
  14. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/BasicLegendItem.qml +5 -2
  15. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/CMakeLists.txt +27 -0
  16. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/Contour.qml +3 -2
  17. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/GraphItemDragHandler.qml +2 -2
  18. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/Grid.qml +39 -0
  19. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/Histogram.qml +39 -0
  20. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/Line.qml +3 -4
  21. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/GraphItems/Marker.qml +3 -1
  22. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/helpers/GridHelper.cpp +26 -0
  23. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/helpers/GridHelper.hpp +58 -0
  24. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/helpers/HistogramHelper.cpp +45 -0
  25. quickgraphlib-0.1.0a2/QuickGraphLib/GraphItems/helpers/HistogramHelper.hpp +59 -0
  26. quickgraphlib-0.1.0a2/QuickGraphLib/PreFabs/CMakeLists.txt +21 -0
  27. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/PreFabs/XYAxes.qml +20 -18
  28. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/ScalingContainer.qml +1 -1
  29. quickgraphlib-0.1.0a2/QuickGraphLib/ShapeRepeater.qml +22 -0
  30. quickgraphlib-0.1.0a2/QuickGraphLib/TickLabel.qml +52 -0
  31. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib/ZoomPanHandler.qml +1 -1
  32. quickgraphlib-0.1.0a2/QuickGraphLib/doc/AxesGridLayout.svg +3 -0
  33. quickgraphlib-0.1.0a2/QuickGraphLib/doc/export.qdoc +24 -0
  34. quickgraphlib-0.1.0a2/QuickGraphLib/doc/graphitems.qdoc +21 -0
  35. quickgraphlib-0.1.0a2/QuickGraphLib/doc/graphstructure.qdoc +140 -0
  36. quickgraphlib-0.1.0a2/QuickGraphLib/doc/index.qdoc +55 -0
  37. quickgraphlib-0.1.0a2/QuickGraphLib/doc/interaction.qdoc +13 -0
  38. quickgraphlib-0.1.0a2/QuickGraphLib/doc/module.qdoc +29 -0
  39. quickgraphlib-0.1.0a2/QuickGraphLib/doc/prefabs.qdoc +21 -0
  40. quickgraphlib-0.1.0a2/QuickGraphLib/doc/python_helpers.qdoc +46 -0
  41. quickgraphlib-0.1.0a2/QuickGraphLib/helpers/AxisHelper.cpp +122 -0
  42. quickgraphlib-0.1.0a2/QuickGraphLib/helpers/AxisHelper.hpp +103 -0
  43. quickgraphlib-0.1.0a2/QuickGraphLib/helpers/Foreign.hpp +13 -0
  44. quickgraphlib-0.1.0a2/QuickGraphLib/helpers/Helpers.cpp +332 -0
  45. quickgraphlib-0.1.0a2/QuickGraphLib/helpers/Helpers.hpp +21 -0
  46. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib.egg-info/PKG-INFO +9 -4
  47. quickgraphlib-0.1.0a2/QuickGraphLib.egg-info/SOURCES.txt +113 -0
  48. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/README.md +6 -2
  49. quickgraphlib-0.1.0a2/examples/AllTheAxes.png +0 -0
  50. quickgraphlib-0.1.0a2/examples/AllTheAxes.qdoc +13 -0
  51. quickgraphlib-0.1.0a2/examples/AllTheAxes.qml +94 -0
  52. quickgraphlib-0.1.0a2/examples/BasicHistogram.png +0 -0
  53. quickgraphlib-0.1.0a2/examples/BasicHistogram.qdoc +13 -0
  54. quickgraphlib-0.1.0a2/examples/BasicHistogram.qml +67 -0
  55. quickgraphlib-0.1.0a2/examples/BasicSinGraph.png +0 -0
  56. quickgraphlib-0.1.0a2/examples/BasicSinGraph.qdoc +13 -0
  57. quickgraphlib-0.1.0a2/examples/BasicSinGraph.qml +34 -0
  58. quickgraphlib-0.1.0a2/examples/BasicSinGraphNoPrefabs.png +0 -0
  59. quickgraphlib-0.1.0a2/examples/BasicSinGraphNoPrefabs.qdoc +17 -0
  60. quickgraphlib-0.1.0a2/examples/BasicSinGraphNoPrefabs.qml +76 -0
  61. quickgraphlib-0.1.0a2/examples/Complex.png +0 -0
  62. quickgraphlib-0.1.0a2/examples/Complex.qdoc +13 -0
  63. quickgraphlib-0.1.0a2/examples/Complex.qml +219 -0
  64. quickgraphlib-0.1.0a2/examples/Contours.png +0 -0
  65. quickgraphlib-0.1.0a2/examples/Contours.qdoc +13 -0
  66. quickgraphlib-0.1.0a2/examples/Contours.qml +71 -0
  67. quickgraphlib-0.1.0a2/examples/DarkSinGraph.png +0 -0
  68. quickgraphlib-0.1.0a2/examples/DarkSinGraph.qdoc +13 -0
  69. quickgraphlib-0.1.0a2/examples/DarkSinGraph.qml +45 -0
  70. quickgraphlib-0.1.0a2/examples/DraggableRegion.png +0 -0
  71. quickgraphlib-0.1.0a2/examples/DraggableRegion.qdoc +13 -0
  72. quickgraphlib-0.1.0a2/examples/DraggableRegion.qml +88 -0
  73. quickgraphlib-0.1.0a2/examples/ExampleGallery.png +0 -0
  74. quickgraphlib-0.1.0a2/examples/ExampleGallery.qml +150 -0
  75. quickgraphlib-0.1.0a2/examples/InvertedAxes.png +0 -0
  76. quickgraphlib-0.1.0a2/examples/InvertedAxes.qdoc +13 -0
  77. quickgraphlib-0.1.0a2/examples/InvertedAxes.qml +23 -0
  78. quickgraphlib-0.1.0a2/examples/ReadoutLine.png +0 -0
  79. quickgraphlib-0.1.0a2/examples/ReadoutLine.qdoc +13 -0
  80. quickgraphlib-0.1.0a2/examples/ReadoutLine.qml +53 -0
  81. quickgraphlib-0.1.0a2/examples/ScalingGraph.png +0 -0
  82. quickgraphlib-0.1.0a2/examples/ScalingGraph.qdoc +13 -0
  83. quickgraphlib-0.1.0a2/examples/ScalingGraph.qml +84 -0
  84. quickgraphlib-0.1.0a2/examples/Scatter.png +0 -0
  85. quickgraphlib-0.1.0a2/examples/Scatter.qdoc +13 -0
  86. quickgraphlib-0.1.0a2/examples/Scatter.qml +28 -0
  87. quickgraphlib-0.1.0a2/examples/SpansAndLines.png +0 -0
  88. quickgraphlib-0.1.0a2/examples/SpansAndLines.qdoc +13 -0
  89. quickgraphlib-0.1.0a2/examples/SpansAndLines.qml +59 -0
  90. quickgraphlib-0.1.0a2/examples/Subgraphs.png +0 -0
  91. quickgraphlib-0.1.0a2/examples/Subgraphs.qdoc +13 -0
  92. quickgraphlib-0.1.0a2/examples/Subgraphs.qml +83 -0
  93. quickgraphlib-0.1.0a2/examples/TwinX.png +0 -0
  94. quickgraphlib-0.1.0a2/examples/TwinX.qdoc +13 -0
  95. quickgraphlib-0.1.0a2/examples/TwinX.qml +90 -0
  96. quickgraphlib-0.1.0a2/examples/ZoomableAsImage.png +0 -0
  97. quickgraphlib-0.1.0a2/examples/ZoomableAsImage.qdoc +13 -0
  98. quickgraphlib-0.1.0a2/examples/ZoomableAsImage.qml +46 -0
  99. quickgraphlib-0.1.0a2/examples/ZoomableAxes.png +0 -0
  100. quickgraphlib-0.1.0a2/examples/ZoomableAxes.qdoc +13 -0
  101. quickgraphlib-0.1.0a2/examples/ZoomableAxes.qml +119 -0
  102. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/pyproject.toml +7 -4
  103. quickgraphlib-0.1.0a2/quickgraphlib_helpers/__init__.py +8 -0
  104. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/quickgraphlib_helpers/consts.py +1 -1
  105. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/quickgraphlib_helpers/contours.py +8 -8
  106. quickgraphlib-0.1.0a2/setup.py +74 -0
  107. QuickGraphLib-0.1.0a0/MANIFEST.in +0 -1
  108. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/AxHLine.qml +0 -25
  109. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/AxHSpan.qml +0 -28
  110. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/AxVLine.qml +0 -25
  111. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/AxVSpan.qml +0 -28
  112. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/Grid.qml +0 -58
  113. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/Histogram.qml +0 -50
  114. QuickGraphLib-0.1.0a0/QuickGraphLib/GraphItems/qmldir +0 -16
  115. QuickGraphLib-0.1.0a0/QuickGraphLib/Helpers.js +0 -167
  116. QuickGraphLib-0.1.0a0/QuickGraphLib/PreFabs/qmldir +0 -5
  117. QuickGraphLib-0.1.0a0/QuickGraphLib/qmldir +0 -10
  118. QuickGraphLib-0.1.0a0/QuickGraphLib.egg-info/SOURCES.txt +0 -36
  119. QuickGraphLib-0.1.0a0/quickgraphlib_helpers/__init__.py +0 -4
  120. QuickGraphLib-0.1.0a0/quickgraphlib_helpers/export.py +0 -167
  121. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib.egg-info/dependency_links.txt +0 -0
  122. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib.egg-info/requires.txt +0 -0
  123. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/QuickGraphLib.egg-info/top_level.txt +0 -0
  124. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/quickgraphlib_helpers/py.typed +0 -0
  125. {QuickGraphLib-0.1.0a0 → quickgraphlib-0.1.0a2}/setup.cfg +0 -0
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ cmake_minimum_required(VERSION 3.16)
5
+ set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
6
+
7
+ project(qmlmodule VERSION 1.0.0 LANGUAGES CXX)
8
+
9
+ set(CMAKE_CXX_STANDARD 17)
10
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
11
+
12
+ if(NOT INSTALL_SUBPATH)
13
+ set(INSTALL_SUBPATH ${CMAKE_INSTALL_LIBDIR}/qml CACHE STRING "Install subpath (defaults to lib/qml)")
14
+ endif()
15
+
16
+ find_package(Qt6 REQUIRED COMPONENTS Quick Svg)
17
+ qt_standard_project_setup(REQUIRES 6.5)
18
+
19
+ add_subdirectory(QuickGraphLib)
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
3
+ Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,3 @@
1
+ recursive-include . CMakeLists.txt
2
+ recursive-include QuickGraphLib *.qml *.svg *.qdoc *.cpp *.hpp
3
+ recursive-include examples *.qml *.png *.qdoc
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QuickGraphLib
3
- Version: 0.1.0a0
3
+ Version: 0.1.0a2
4
4
  Summary: A scientific graphing library for QtQuick
5
5
  Author-email: Matthew Joyce <matthew.joyce@refeyn.com>
6
6
  License: MIT License
7
7
 
8
- Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
8
+ Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
9
9
 
10
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
11
  of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@ License: MIT License
26
26
  SOFTWARE.
27
27
  Project-URL: Homepage, https://github.com/refeyn/QuickGraphLib
28
28
  Project-URL: Issues, https://github.com/refeyn/QuickGraphLib/issues
29
+ Project-URL: Documentation, https://refeyn.github.io/QuickGraphLib
29
30
  Project-URL: Source, https://github.com/refeyn/QuickGraphLib
30
31
  Classifier: Development Status :: 3 - Alpha
31
32
  Classifier: Environment :: X11 Applications :: Qt
@@ -54,9 +55,13 @@ Requires-Dist: pytest-cov; extra == "analyse"
54
55
 
55
56
  A scientific graphing library for [QtQuick](https://doc.qt.io/qt-6/qtquick-index.html) using Qt6.
56
57
 
58
+ Links:
59
+ - [Online documentation](https://refeyn.github.io/QuickGraphLib)
60
+ - [PyPI page](https://pypi.org/project/QuickGraphLib/)
61
+
57
62
  Key advantages:
58
63
 
59
- - Written in pure QML (with some optional Python helpers), so it can be used in both C++ and Python projects
64
+ - Written in C++ and QML (with some optional Python helpers), so it can be used in both C++ and Python projects
60
65
  - QtQuick's hardware-based rendering makes this library render very fast
61
66
  - Support for line graphs, histograms, contour plots and more
62
67
  - Interactivity supported natively though declarative bindings and QtQuick
@@ -70,4 +75,4 @@ The example gallery can be run using (provided the Python environment has [PySid
70
75
  python examples\gallery.py
71
76
  ```
72
77
 
73
- <p align="center"><img src="./examples/ExampleGallery.png" width="80%"></p>
78
+ <p align="center"><img src="https://github.com/refeyn/QuickGraphLib/assets/103422031/56fdff62-ef77-4184-9f43-59a76b92d728" width="80%"></p>
@@ -1,4 +1,4 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
@@ -1,9 +1,10 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  pragma ComponentBehavior: Bound
5
5
  import QtQuick
6
6
  import QtQuick.Shapes as QQS
7
+ import QuickGraphLib as QuickGraphLib
7
8
 
8
9
  /*!
9
10
  \qmltype Axis
@@ -22,13 +23,11 @@ Item {
22
23
  Bottom
23
24
  }
24
25
 
25
- property list<point> _path: _calculateTickPath(ticks, direction, width, height, dataTransform)
26
- property list<int> _tickPositions
27
26
  /*!
28
27
  TODO
29
28
  \sa {GraphArea::dataTransform}
30
29
  */
31
- required property matrix4x4 dataTransform
30
+ property alias dataTransform: helper.dataTransform
32
31
  /*! TODO */
33
32
  property int decimalPoints: 2
34
33
  /*! TODO
@@ -39,49 +38,36 @@ Item {
39
38
  \value Axis.Direction.Top Axis above of the GraphArea
40
39
  \value Axis.Direction.Bottom Axis below of the GraphArea
41
40
  */
42
- required property int direction
41
+ property alias direction: helper.direction
43
42
  /*! TODO */
44
43
  property alias label: labelText.text
45
44
  /*! TODO */
45
+ property alias labelColor: labelText.color
46
+ /*! TODO */
47
+ property alias labelFont: labelText.font
48
+ /*! TODO */
46
49
  property bool showTickLabels: true
47
50
  /*! TODO */
48
51
  property double spacing: 4
49
52
  /*! TODO */
50
- property double tickLength: 10
53
+ property alias strokeColor: myPath.strokeColor
51
54
  /*! TODO */
52
- required property list<double> ticks
53
-
54
- function _calculateTickPath(ticks, direction: int, width: double, height: double, dataTransform) {
55
- const longAxis = direction == Axis.Direction.Top || direction == Axis.Direction.Bottom ? width : height;
56
- let transformedTicks = ticks.map(t => dataTransform.map(Qt.point(t, t))[direction == Axis.Direction.Top || direction == Axis.Direction.Bottom ? "x" : "y"]);
57
-
58
- // Calculate everything as if we were a bottom axis
59
- let points = [Qt.point(0, 0)], tickPositions = [];
60
- transformedTicks.forEach(t => {
61
- if (t >= -0.5 && t <= longAxis + 0.5) {
62
- points.push(Qt.point(t, 0));
63
- points.push(Qt.point(t, root.tickLength));
64
- points.push(Qt.point(t, 0));
65
- tickPositions.push(points.length - 2);
66
- } else {
67
- tickPositions.push(-1);
68
- }
69
- });
70
- points.push(Qt.point(longAxis, 0));
71
- _tickPositions = tickPositions;
72
-
73
- // Transform into the correct positions
74
- switch (root.direction) {
75
- case Axis.Direction.Left:
76
- return points.map(p => Qt.point(width - p.y, p.x));
77
- case Axis.Direction.Right:
78
- return points.map(p => Qt.point(p.y, p.x));
79
- case Axis.Direction.Top:
80
- return points.map(p => Qt.point(p.x, height - p.y));
81
- case Axis.Direction.Bottom:
82
- return points;
83
- }
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
84
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
85
71
 
86
72
  implicitHeight: {
87
73
  switch (root.direction) {
@@ -94,7 +80,7 @@ Item {
94
80
  if (ticks.length > 0) {
95
81
  height += root.tickLength + Math.max(0, ...[...Array(tickLabels.count).keys()].map(i => tickLabels.itemAt(i)?.height));
96
82
  }
97
- if (label != "") {
83
+ if (label !== "") {
98
84
  height += labelText.height + root.spacing;
99
85
  }
100
86
  return height;
@@ -108,7 +94,7 @@ Item {
108
94
  if (ticks.length > 0) {
109
95
  width += root.tickLength + Math.max(0, ...[...Array(tickLabels.count).keys()].map(i => tickLabels.itemAt(i)?.width));
110
96
  }
111
- if (label != "") {
97
+ if (label !== "") {
112
98
  width += labelText.height + root.spacing;
113
99
  }
114
100
  return width;
@@ -119,6 +105,13 @@ Item {
119
105
  }
120
106
  z: 1
121
107
 
108
+ QuickGraphLib.AxisHelper {
109
+ id: helper
110
+
111
+ height: root.height
112
+ tickLength: 10
113
+ width: root.width
114
+ }
122
115
  QQS.Shape {
123
116
  id: shape
124
117
 
@@ -127,56 +120,19 @@ Item {
127
120
  QQS.ShapePath {
128
121
  id: myPath
129
122
 
130
- startX: root._path[0].x
131
- startY: root._path[0].y
132
123
  strokeColor: "black"
133
124
  strokeWidth: 1
134
125
 
135
126
  PathPolyline {
136
- path: root._path
127
+ path: helper.path
137
128
  }
138
129
  }
139
130
  }
140
131
  Repeater {
141
132
  id: tickLabels
142
133
 
143
- model: root.showTickLabels ? root.ticks : []
144
-
145
- Text {
146
- required property int index
147
- required property double modelData
148
-
149
- leftPadding: 2
150
- rightPadding: 2
151
- text: Number(modelData).toFixed(root.decimalPoints)
152
- visible: root._tickPositions[index] >= 0
153
- x: {
154
- let baseX = root._path[root._tickPositions[index]]?.x ?? 0;
155
- switch (root.direction) {
156
- case Axis.Direction.Left:
157
- return baseX - width;
158
- case Axis.Direction.Right:
159
- return baseX;
160
- case Axis.Direction.Top:
161
- return baseX - width / 2;
162
- case Axis.Direction.Bottom:
163
- return baseX - width / 2;
164
- }
165
- }
166
- y: {
167
- let baseY = root._path[root._tickPositions[index]]?.y ?? 0;
168
- switch (root.direction) {
169
- case Axis.Direction.Left:
170
- return baseY - height / 2;
171
- case Axis.Direction.Right:
172
- return baseY - height / 2;
173
- case Axis.Direction.Top:
174
- return baseY - height;
175
- case Axis.Direction.Bottom:
176
- return baseY;
177
- }
178
- }
179
- }
134
+ delegate: root.tickDelegate
135
+ model: root.showTickLabels ? helper.tickModel : null
180
136
  }
181
137
  Text {
182
138
  id: labelText
@@ -0,0 +1,27 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ set(QGL_QML_FILES AntialiasingContainer.qml Axis.qml GraphArea.qml ScalingContainer.qml ZoomPanHandler.qml TickLabel.qml ShapeRepeater.qml)
5
+ qt_add_qml_module(QuickGraphLib
6
+ URI QuickGraphLib
7
+ SHARED
8
+ VERSION 1.0
9
+ QML_FILES ${QGL_QML_FILES}
10
+ SOURCES helpers/Helpers.cpp helpers/Helpers.hpp helpers/AxisHelper.hpp helpers/AxisHelper.cpp helpers/Foreign.hpp
11
+ PLUGIN_TARGET QuickGraphLib
12
+ DEPENDENCIES QtQuick
13
+ )
14
+
15
+ target_compile_definitions(QuickGraphLib PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
16
+ target_link_libraries(QuickGraphLib PRIVATE Qt6::Quick Qt6::Svg)
17
+ target_include_directories(QuickGraphLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/helpers)
18
+
19
+ install(TARGETS QuickGraphLib DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib)
20
+ install(FILES ${QGL_QML_FILES} DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib)
21
+ install(
22
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/QuickGraphLib.qmltypes
23
+ DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib
24
+ )
25
+
26
+ add_subdirectory(PreFabs)
27
+ add_subdirectory(GraphItems)
@@ -1,4 +1,4 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
@@ -23,7 +23,10 @@ QQS.Shape {
23
23
  */
24
24
  readonly property rect effectiveViewRect: {
25
25
  let mat = rawDataTransform.inverted().times(viewTransform.inverted().times(rawDataTransform));
26
- return mat.mapRect(viewRect);
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);
27
30
  }
28
31
  /*!
29
32
  Transform from data coordinates to pixel coordinates inside the GraphArea
@@ -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
+ }
@@ -1,4 +1,4 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
@@ -8,6 +8,8 @@ import QtQuick
8
8
  \inqmlmodule QuickGraphLib.GraphItems
9
9
  \inherits QtQuick::Rectangle
10
10
  \brief Displays a simple legend.
11
+
12
+ \note This graph item does not inherit from ShapePath, unlike other graph items.
11
13
  */
12
14
 
13
15
  Rectangle {
@@ -1,4 +1,4 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
@@ -17,13 +17,16 @@ Row {
17
17
  property color fillColor: "transparent"
18
18
  /*! TODO */
19
19
  property Gradient fillGradient: null
20
-
21
20
  /*! TODO */
22
21
  property color strokeColor: "black"
23
22
  /*! TODO */
24
23
  property real strokeWidth: 1
25
24
  /*! TODO */
26
25
  property alias text: label.text
26
+ /*! TODO */
27
+ property alias textColor: label.color
28
+ /*! TODO */
29
+ property alias textFont: label.font
27
30
 
28
31
  spacing: 2
29
32
 
@@ -0,0 +1,27 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ set(QGL_GI_QML_FILES
5
+ AxHLine.qml AxVLine.qml BasicLegend.qml GraphItemDragHandler.qml Histogram.qml Marker.qml
6
+ AxHSpan.qml AxVSpan.qml BasicLegendItem.qml Contour.qml Grid.qml Line.qml
7
+ )
8
+ qt_add_qml_module(QuickGraphLibGraphItems
9
+ URI QuickGraphLib.GraphItems
10
+ SHARED
11
+ VERSION 1.0
12
+ QML_FILES ${QGL_GI_QML_FILES}
13
+ SOURCES helpers/HistogramHelper.cpp helpers/HistogramHelper.hpp helpers/GridHelper.hpp helpers/GridHelper.cpp
14
+ PLUGIN_TARGET QuickGraphLibGraphItems
15
+ DEPENDENCIES QtQuick QuickGraphLib
16
+ )
17
+
18
+ target_compile_definitions(QuickGraphLibGraphItems PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
19
+ target_link_libraries(QuickGraphLibGraphItems PRIVATE Qt6::Quick)
20
+ target_include_directories(QuickGraphLibGraphItems PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/helpers)
21
+
22
+ install(TARGETS QuickGraphLibGraphItems DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib/GraphItems)
23
+ install(FILES ${QGL_GI_QML_FILES} DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib/GraphItems)
24
+ install(
25
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/QuickGraphLibGraphItems.qmltypes
26
+ DESTINATION ${INSTALL_SUBPATH}/QuickGraphLib/GraphItems
27
+ )
@@ -1,8 +1,9 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
5
5
  import QtQuick.Shapes as QQS
6
+ import QuickGraphLib as QuickGraphLib
6
7
 
7
8
  /*!
8
9
  \qmltype Contours
@@ -28,6 +29,6 @@ QQS.ShapePath {
28
29
  joinStyle: QQS.ShapePath.RoundJoin
29
30
 
30
31
  PathMultiline {
31
- paths: root.paths.map(ps => ps.map(p => root.dataTransform.map(p)))
32
+ paths: root.paths.map(ps => QuickGraphLib.Helpers.mapPoints(ps, root.dataTransform))
32
33
  }
33
34
  }
@@ -1,4 +1,4 @@
1
- // SPDX-FileCopyrightText: Copyright (c) 2024 Matthew Joyce and other QuickGraphLib contributors
1
+ // SPDX-FileCopyrightText: Copyright (c) 2024 Refeyn Ltd and other QuickGraphLib contributors
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import QtQuick
@@ -26,7 +26,7 @@ MouseArea {
26
26
 
27
27
  onPositionChanged: event => {
28
28
  if (dragging) {
29
- moved(dataTransform.inverted().mapRect(Qt.rect(parent.x + event.x - _startDragPos.x, parent.y + event.y - _startDragPos.y, _startDragPos.width, _startDragPos.height)));
29
+ moved(dataTransform.inverted().mapRect(Qt.rect(root.x + event.x - _startDragPos.x, parent.y + root.y - _startDragPos.y, _startDragPos.width, _startDragPos.height)));
30
30
  }
31
31
  }
32
32
  onPressed: event => {
@@ -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
+ }