diff --git a/QuickGraphLib/Axis.qml b/QuickGraphLib/Axis.qml index c7fb59e..df99445 100644 --- a/QuickGraphLib/Axis.qml +++ b/QuickGraphLib/Axis.qml @@ -11,6 +11,8 @@ import QuickGraphLib as QuickGraphLib \inqmlmodule QuickGraphLib \inherits QtQuick::Item \brief Displays an Axis. + + \sa {Basic sin graph (without prefabs)}, {Graph with all four axes} */ Item { diff --git a/QuickGraphLib/ColorMaps.cpp b/QuickGraphLib/ColorMaps.cpp index bab6eb5..4a2ec97 100644 --- a/QuickGraphLib/ColorMaps.cpp +++ b/QuickGraphLib/ColorMaps.cpp @@ -11,6 +11,8 @@ \inqmlmodule QuickGraphLib \inherits QObject \brief Utility functions for color maps. + + \sa {ImageView}, {Builtin color maps}, {Color mapped images} */ extern const std::map> DEFAULT_COLORMAPS; diff --git a/QuickGraphLib/GraphArea.qml b/QuickGraphLib/GraphArea.qml index 4a5de04..ab16f3f 100644 --- a/QuickGraphLib/GraphArea.qml +++ b/QuickGraphLib/GraphArea.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib \inherits QtQuick::Shapes::Shape \brief An area that graphs can be added to. + + \sa {Basic sin graph (without prefabs)}, {Inverted axes} */ QQS.Shape { diff --git a/QuickGraphLib/GraphItems/AxHLine.qml b/QuickGraphLib/GraphItems/AxHLine.qml index 49b61c6..8e5d73b 100644 --- a/QuickGraphLib/GraphItems/AxHLine.qml +++ b/QuickGraphLib/GraphItems/AxHLine.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Displays a horizontal line. + + \sa {Spans and lines} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/AxHSpan.qml b/QuickGraphLib/GraphItems/AxHSpan.qml index 7cdcb28..d9cbc54 100644 --- a/QuickGraphLib/GraphItems/AxHSpan.qml +++ b/QuickGraphLib/GraphItems/AxHSpan.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Displays a horizontal span. + + \sa {Spans and lines} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/AxVLine.qml b/QuickGraphLib/GraphItems/AxVLine.qml index 82b368b..0391155 100644 --- a/QuickGraphLib/GraphItems/AxVLine.qml +++ b/QuickGraphLib/GraphItems/AxVLine.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Rectangle \brief Displays an vertical line. + + \sa {Spans and lines}, {Draggable region} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/AxVSpan.qml b/QuickGraphLib/GraphItems/AxVSpan.qml index dfae24b..c0292f2 100644 --- a/QuickGraphLib/GraphItems/AxVSpan.qml +++ b/QuickGraphLib/GraphItems/AxVSpan.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Displays an vertical span. + + \sa {Spans and lines}, {Basic histogram}, {Draggable region} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/BasicLegend.qml b/QuickGraphLib/GraphItems/BasicLegend.qml index 7b2adc8..51af536 100644 --- a/QuickGraphLib/GraphItems/BasicLegend.qml +++ b/QuickGraphLib/GraphItems/BasicLegend.qml @@ -10,6 +10,8 @@ import QtQuick \brief Displays a simple legend. \note This graph item does not inherit from ShapePath, unlike other graph items. + + \sa {Basic sin graph} */ Rectangle { diff --git a/QuickGraphLib/GraphItems/BasicLegendItem.qml b/QuickGraphLib/GraphItems/BasicLegendItem.qml index 88fd4f6..0657cc7 100644 --- a/QuickGraphLib/GraphItems/BasicLegendItem.qml +++ b/QuickGraphLib/GraphItems/BasicLegendItem.qml @@ -8,6 +8,8 @@ import QtQuick \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Row \brief An single entry in a simple legend. + + \sa {Basic sin graph} */ Row { diff --git a/QuickGraphLib/GraphItems/ColorMesh.qml b/QuickGraphLib/GraphItems/ColorMesh.qml index 276d479..5aebe62 100644 --- a/QuickGraphLib/GraphItems/ColorMesh.qml +++ b/QuickGraphLib/GraphItems/ColorMesh.qml @@ -11,6 +11,8 @@ import QuickGraphLib as QuickGraphLib \brief Display a colorized image from a 2D array. \note This graph item does not inherit from ShapePath, unlike other graph items. + + \sa {Color mesh}, {Color mapped images} */ QuickGraphLib.ImageView { diff --git a/QuickGraphLib/GraphItems/Contour.qml b/QuickGraphLib/GraphItems/Contour.qml index 47594ac..b4d7fbf 100644 --- a/QuickGraphLib/GraphItems/Contour.qml +++ b/QuickGraphLib/GraphItems/Contour.qml @@ -10,6 +10,8 @@ import QuickGraphLib as QuickGraphLib \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Draw a contour line or fill. + + \sa {Contours} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/GraphItemDragHandler.qml b/QuickGraphLib/GraphItems/GraphItemDragHandler.qml index d851932..f6b45d5 100644 --- a/QuickGraphLib/GraphItems/GraphItemDragHandler.qml +++ b/QuickGraphLib/GraphItems/GraphItemDragHandler.qml @@ -8,6 +8,8 @@ import QtQuick \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::MouseArea \brief Assists converting mouse drags into data positions. + + \sa {Draggable region} */ MouseArea { diff --git a/QuickGraphLib/GraphItems/Grid.qml b/QuickGraphLib/GraphItems/Grid.qml index 8d97df5..6b5388b 100644 --- a/QuickGraphLib/GraphItems/Grid.qml +++ b/QuickGraphLib/GraphItems/Grid.qml @@ -10,6 +10,8 @@ import QuickGraphLib.GraphItems as QGLGraphItems \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Displays a grid in the background of a graph. + + \sa {Basic sin graph (without prefabs)} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/Histogram.qml b/QuickGraphLib/GraphItems/Histogram.qml index 92b7be7..bf0f24d 100644 --- a/QuickGraphLib/GraphItems/Histogram.qml +++ b/QuickGraphLib/GraphItems/Histogram.qml @@ -10,6 +10,8 @@ import QuickGraphLib.GraphItems as QGLGraphItems \inqmlmodule QuickGraphLib.GraphItems \inherits QtQuick::Shapes::ShapePath \brief Displays a histogram. + + \sa {Basic histogram} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/Line.qml b/QuickGraphLib/GraphItems/Line.qml index a4983fe..ee13feb 100644 --- a/QuickGraphLib/GraphItems/Line.qml +++ b/QuickGraphLib/GraphItems/Line.qml @@ -13,19 +13,7 @@ import QuickGraphLib as QuickGraphLib Graph a line using a list of X,Y points. The style of the line can be adjusted using the \l {ShapePath::strokeColor} {strokeColor} and \l {ShapePath::strokeWidth} {strokeWidth} properties. - \qml - GraphArea { - id: grapharea - viewRect: Qt.rect(-20, -1.1, 760, 2.2) - - Line { - dataTransform: grapharea.dataTransform - path: Helpers.linspace(0, 720, 100).map(x => Qt.point(x, Math.sin(x / 180 * Math.PI))) - strokeColor: "red" - strokeWidth: 2 - } - } - \endqml + \sa {Basic sin graph} */ QQS.ShapePath { diff --git a/QuickGraphLib/GraphItems/Marker.qml b/QuickGraphLib/GraphItems/Marker.qml index 0d8136e..2df9443 100644 --- a/QuickGraphLib/GraphItems/Marker.qml +++ b/QuickGraphLib/GraphItems/Marker.qml @@ -10,6 +10,8 @@ import QtQuick \brief Displays a circular marker. \note This graph item does not inherit from ShapePath, unlike other graph items. This is for performance reasons. + + \sa {Scatter graph} */ Rectangle { diff --git a/QuickGraphLib/ImageView.cpp b/QuickGraphLib/ImageView.cpp index 71ce45d..1d780b8 100644 --- a/QuickGraphLib/ImageView.cpp +++ b/QuickGraphLib/ImageView.cpp @@ -13,6 +13,8 @@ \inqmlmodule QuickGraphLib \inherits QtQuick::Item \brief Display a colorized image from a 2D array. + + \sa {Builtin color maps}, {Color mapped images}, {Image alignment} */ /*! diff --git a/QuickGraphLib/PreFabs/ImageAxes.qml b/QuickGraphLib/PreFabs/ImageAxes.qml index 54131de..17cfe3d 100644 --- a/QuickGraphLib/PreFabs/ImageAxes.qml +++ b/QuickGraphLib/PreFabs/ImageAxes.qml @@ -11,6 +11,8 @@ import QuickGraphLib.GraphItems as QGLGraphItems \inqmlmodule QuickGraphLib.PreFabs \inherits QuickGraphLib::AntialiasingContainer \brief Displays an image with axes and a colorbar. + + \sa {Color mesh} */ QuickGraphLib.AntialiasingContainer { diff --git a/QuickGraphLib/PreFabs/XYAxes.qml b/QuickGraphLib/PreFabs/XYAxes.qml index f71f18f..fdf7e46 100644 --- a/QuickGraphLib/PreFabs/XYAxes.qml +++ b/QuickGraphLib/PreFabs/XYAxes.qml @@ -11,6 +11,8 @@ import QuickGraphLib.GraphItems as QGLGraphItems \inqmlmodule QuickGraphLib.PreFabs \inherits QuickGraphLib::AntialiasingContainer \brief Displays an XY axis with a grid. + + \sa {Basic sin graph}, {Dark theme sin graph}, {Subgraphs} */ QuickGraphLib.AntialiasingContainer { diff --git a/QuickGraphLib/ScalingContainer.qml b/QuickGraphLib/ScalingContainer.qml index a39d151..b301b98 100644 --- a/QuickGraphLib/ScalingContainer.qml +++ b/QuickGraphLib/ScalingContainer.qml @@ -10,6 +10,8 @@ import QtQuick \brief Scales its contents while preserving the aspect ratio. This container applies a scaling factor to its content item that preserves its aspect ratio. + + \sa {Scaled graph} */ AntialiasingContainer { diff --git a/QuickGraphLib/ShapeRepeater.qml b/QuickGraphLib/ShapeRepeater.qml index d3b5eb4..7a0b443 100644 --- a/QuickGraphLib/ShapeRepeater.qml +++ b/QuickGraphLib/ShapeRepeater.qml @@ -9,6 +9,8 @@ import QtQuick.Shapes as QQS \inqmlmodule QuickGraphLib \inherits QtQml::Models::Instantiator \brief A \l{Repeater}-like component that works with \l{ShapePath}s. + + \sa {Scatter graph} */ QQM.Instantiator { diff --git a/QuickGraphLib/TickLabel.qml b/QuickGraphLib/TickLabel.qml index 0a72a31..54e2d2d 100644 --- a/QuickGraphLib/TickLabel.qml +++ b/QuickGraphLib/TickLabel.qml @@ -11,6 +11,8 @@ import QtQuick This is the default implementation of a tick label. To customise how labels are shown, you can subclass this and override the \l Text::text property. + + \sa {Axis} */ Text { diff --git a/QuickGraphLib/ZoomPanHandler.qml b/QuickGraphLib/ZoomPanHandler.qml index 4fa0b63..5551c09 100644 --- a/QuickGraphLib/ZoomPanHandler.qml +++ b/QuickGraphLib/ZoomPanHandler.qml @@ -8,13 +8,15 @@ import QtQuick \inqmlmodule QuickGraphLib \inherits QtQuick::PinchArea \brief Pinch/drag handling for graph or image zoom/pan interactions. + + \sa {Zoomable as image}, {Zoomable axes} */ PinchArea { id: root /*! - The view transform, but in a pixel-independant form. + The view transform, but in a pixel-independent form. \sa GraphArea::baseTransformFromRect */ diff --git a/QuickGraphLib/contours.py b/QuickGraphLib/contours.py index 53952d4..33683f0 100644 --- a/QuickGraphLib/contours.py +++ b/QuickGraphLib/contours.py @@ -27,6 +27,10 @@ def contour_line( z: Sequence[Sequence[float]], height: float, ) -> Sequence[QGLPolygonF]: + if not CONTOURPY_AVAILABLE: + print("contourpy is not installed, contourLine will not work") + return [] + gen = contourpy.contour_generator( x=x, y=y, z=z, line_type=contourpy.LineType.Separate ) @@ -43,6 +47,10 @@ def contour_fill( z: Sequence[Sequence[float]], heights: tuple[float, float], ) -> Sequence[QGLPolygonF]: + if not CONTOURPY_AVAILABLE: + print("contourpy is not installed, contourFill will not work") + return [] + gen = contourpy.contour_generator( x=x, y=y, z=z, fill_type=contourpy.FillType.OuterOffset ) diff --git a/QuickGraphLib/doc/graphstructure.qdoc b/QuickGraphLib/doc/graphstructure.qdoc index 986031c..d59d293 100644 --- a/QuickGraphLib/doc/graphstructure.qdoc +++ b/QuickGraphLib/doc/graphstructure.qdoc @@ -129,12 +129,93 @@ Tick positions are also important for grids, normally you can just feed in the t \section1 Drawing a line +To draw a line between two points, use a \l Line: + +\qml +QGLGraphItems.Line { + dataTransform: grapharea.dataTransform + path: [Qt.point(0, 0), Qt.point(10, 10)] +} +\endqml + +This code snippet will draw a line between the point (0, 0) and (10, 10). The \l Line item will convert these data coordinates into pixel coordinates for you. To change the color of the line, set the \l {ShapePath::strokeColor}{strokeColor} property: + +\qml +QGLGraphItems.Line { + // ... + strokeColor: "red" +} +\endqml + +\l Line inherits from ShapePath, so any of the properties of ShapePath can be used. This includes line thickness, dashing, line end styles, etc. + +The recommended way to generate data for a \l Line or other graph items is to generate it in C++ or Python, since it is much more efficient. However, JavaScript arrays also work, so data can be constructed in the QML code using helper functions like \l {Helpers::linspace}{linspace} and \c map: + +\qml +QGLGraphItems.Line { + dataTransform: grapharea.dataTransform + path: QuickGraphLib.Helpers.linspace(0, 720, 100).map(x => Qt.point(x, Math.sin(x / 180 * Math.PI))) + strokeColor: "red" + strokeWidth: 2 +} +\endqml + \section1 A simple legend +QuickGraphLib provides a basic legend type, which can be used to label the different data sets in use in a graph. Since legends come in many styles, it is quite basic. If you have specific needs, the best option is to implement your own using standard QML types, as you will have maximum flexibility. However, if you need something simple, you can use BasicLegend and BasicLegendItem: + +\qml +QGLGraphItems.BasicLegend { + anchors.margins: 10 + anchors.right: parent.right + anchors.top: parent.top + + QGLGraphItems.BasicLegendItem { + strokeColor: "red" + text: "Sin(θ)" + } +} +\endqml + +Anchors are used to position the legend (since this is purely a UI component, we don't need to care about data coordinates - the legend is not representing any data). BasicLegendItem can be used to add rows to the legend, and it's properties can be used to set the name and indicator color. + \section1 Full example The full code for this example can be seen in the \l {Basic sin graph (without prefabs)} example. \section1 Prefabs +QuickGraphLib comes with a set of prefab components, so make common tasks like simple X/Y axes simpler. XYAxes sets up a graph area with two axes, one on the left and one on the bottom. When using XYAxes, you only need to add the graph items, the axes, grid and graph area are already created: + +\qml +QGLPreFabs.XYAxes { + id: axes + + viewRect: Qt.rect(-20, -1.1, 760, 2.2) + xLabel: "Angle (°)" + yLabel: "Value" + + QGLGraphItems.Line { + id: sinLine + + dataTransform: axes.dataTransform + path: QuickGraphLib.Helpers.linspace(0, 720, 100).map(x => Qt.point(x, Math.sin(x / 180 * Math.PI))) + strokeColor: "red" + strokeWidth: 2 + } + QGLGraphItems.BasicLegend { + anchors.margins: 10 + anchors.right: parent.right + anchors.top: parent.top + + QGLGraphItems.BasicLegendItem { + strokeColor: sinLine.strokeColor + text: "Sin(θ)" + } + } +} +\endqml + +XYAxes can be customized to some extent (see \l {Dark theme sin graph} for a theming example), the components of the graph are exposed though properties. However, if a more flexibly layout is needed, then prefabs should not be used. + */ \ No newline at end of file diff --git a/QuickGraphLib/doc/interaction.qdoc b/QuickGraphLib/doc/interaction.qdoc index bb1046d..e45b20a 100644 --- a/QuickGraphLib/doc/interaction.qdoc +++ b/QuickGraphLib/doc/interaction.qdoc @@ -8,6 +8,36 @@ \section1 Zooming and panning +Zooming and panning can be handled using a ZoomPanHandler, which combines a PinchHandler and a MouseArea into one type that translates touch and mouse inputs into a transformation. The ZoomPanHandler has two outputs: + +\list + \li \l{ZoomPanHandler::viewTransform}{viewTransform}, which can be provided to a Matrix4x4 transform, and used on any \l Item, or passed to \l {GraphArea::viewTransform} to scale a graph + \li \l{ZoomPanHandler::baseTransform}{baseTransform}, which is a more size-independent version of viewTransform which can be translated into a view rect using ZoomPanHandler's utility methods +\endlist + +With these properties, two sorts of interaction can be implemented: + +\list + \li Zooming into a graph as if it's an image. This can be useful for large or complex figures, where the user may not be able to see the details. This can be achieved by applying the viewTransform to the \l Item which contains the graph (e.g. the GridLayout or XYAxes). See the \l {Zoomable as image} example for more details. + \li Using zooming and panning to change the axes limits. This can be used when the data itself is has complex detail that is not visible when all of the data is shown. This can be achieved by passing the viewTransform to the GraphArea, and optionally providing a set of spin boxes for precise control of the limits. See the \l {Zoomable axes} example for more details. +\endlist + \section1 Interactive graph items +There is a huge amount of interaction possible in a graph, so here we'll stick to the basics. Things you might want to add to your graph include: + +\list + \li Draggable regions + \li Hover text / tooltips + \li Read out of where the cursor is + \li Buttons over particular data points +\endlist + +All of this can be implemented using MouseArea, or using a control, and using the \l{Item::x}{x} and \l{Item::y}{y} properties to position the \l Item (this is because graph items usually inherit from ShapePath, which is not an Item, and so anchors do not work). + +The \l {Readout line} example demonstrates using a MouseArea to monitor the position of the mouse and translate it into data coordinates, a similar arrangement can be used for tooltips. + +The \l {Draggable region} example uses a GraphItemDragHandler (another MouseArea helper) to implement a draggable and resizable region. + +In general, because QML already provides so many interactive items, adding interactivity to a graph is easy and just uses standard QML items, with a bit of extra maths to do positioning since it often needs to be done in data coordinates instead of purely using pixel coordinates. */ \ No newline at end of file diff --git a/QuickGraphLib/doc/python_helpers.qdoc b/QuickGraphLib/doc/python_helpers.qdoc index d3908c4..fa74115 100644 --- a/QuickGraphLib/doc/python_helpers.qdoc +++ b/QuickGraphLib/doc/python_helpers.qdoc @@ -31,6 +31,8 @@ Visit the \l {QuickGraphLib} module documentation and examples (in particular th \inqmlmodule QuickGraphLib.PythonHelpers \inherits QObject \brief Produces contour lines and fills from XYZ data. + + The contourpy package must be installed to use these methods. See \l {https://contourpy.readthedocs.io/} for installation instructions and algorithm details. */ /*! diff --git a/docs/config.qdocconf b/docs/config.qdocconf index 86a5b5e..d74e831 100644 --- a/docs/config.qdocconf +++ b/docs/config.qdocconf @@ -18,7 +18,7 @@ outputformats = HTML macro.qglversion = "$QGL_VERSION" -depends = qtdoc qtcore qtgui qtqml qtqmlmodels qtquick +depends = qtdoc qtcore qtgui qtqml qtqmlmodels qtquick qtquickcontrols include($QT_INSTALL_DOCS\global\qt-html-templates-offline.qdocconf) HTML.stylesheets += style.css HTML.headerstyles = "" \ diff --git a/docs/style.css b/docs/style.css index 3eec87d..4522fae 100644 --- a/docs/style.css +++ b/docs/style.css @@ -68,10 +68,8 @@ pre { background-color: #222; padding: 1em; color: white; -} - -pre a { - color: #ACCEED; + overflow-x: auto; + font-size: 0.9em; } li::marker { @@ -183,4 +181,23 @@ h3#toc { .note { background-color: #0B5C9311; border-left: 3px solid #0B5C93; +} + +/* Syntax highlighting */ + +pre .type, pre .type a { + color: #81B4E0; + font-weight: bold; +} + +pre .name { + color: #ACCEED; +} + +pre .string, pre .number { + color: #F6921E; +} + +pre .comment { + color: #aaa; } \ No newline at end of file diff --git a/examples/AllTheAxes.qdoc b/examples/AllTheAxes.qdoc index b58e3fb..c992713 100644 --- a/examples/AllTheAxes.qdoc +++ b/examples/AllTheAxes.qdoc @@ -9,5 +9,7 @@ \image examples/AllTheAxes.png + This example demonstrates using axes on all sides of a graph. Since all of the positioning is done using a GridLayout, axis arrangement is very flexible. If four axes are not enough for your use case, you can stack axes by just extending GridLayout. + \quotefile examples/AllTheAxes.qml */ \ No newline at end of file diff --git a/examples/BasicHistogram.qdoc b/examples/BasicHistogram.qdoc index cb28189..87086a1 100644 --- a/examples/BasicHistogram.qdoc +++ b/examples/BasicHistogram.qdoc @@ -9,5 +9,7 @@ \image examples/BasicHistogram.png + This example demonstrates using Histogram to display a normal distribution, along with some vertical spans. The spans are shown above the histogram as they are defined later on in the file. The \l Text items are not integrated into the rendering of the graph (as they are \l {Item}s, not \l {ShapePath}s), and therefore are above everything. This is also the reason the Text items are positioned using the x and y properties, since anchors cannot be used in this case. + \quotefile examples/BasicHistogram.qml */ \ No newline at end of file diff --git a/examples/BasicSinGraph.qdoc b/examples/BasicSinGraph.qdoc index a99c162..facc748 100644 --- a/examples/BasicSinGraph.qdoc +++ b/examples/BasicSinGraph.qdoc @@ -9,5 +9,7 @@ \image examples/BasicSinGraph.png + This example demonstrates how to create the most basic sort of graph, a line graph. A legend has been added as well, using anchors to position it based on the pixel size of the graph. + \quotefile examples/BasicSinGraph.qml */ \ No newline at end of file diff --git a/examples/BasicSinGraphNoPrefabs.qdoc b/examples/BasicSinGraphNoPrefabs.qdoc index c2bba4d..efeb0ae 100644 --- a/examples/BasicSinGraphNoPrefabs.qdoc +++ b/examples/BasicSinGraphNoPrefabs.qdoc @@ -7,11 +7,11 @@ \brief A simple graph of a sin function (without prefabs). \example basicsingraphnoprefabs + \image examples/BasicSinGraphNoPrefabs.png + This example is the same as \l {Basic sin graph}, except that it does not use XYAxes (and it takes advantage of that by changing the number of decimal points in the X axis). - This is a good base for starting your own customisations. - - \image examples/BasicSinGraphNoPrefabs.png + This is a good base for starting your own customisations, such as multiple axes or subplots. \quotefile examples/BasicSinGraphNoPrefabs.qml */ \ No newline at end of file diff --git a/examples/BuiltinColormaps.qdoc b/examples/BuiltinColormaps.qdoc index 84b1218..4f3af31 100644 --- a/examples/BuiltinColormaps.qdoc +++ b/examples/BuiltinColormaps.qdoc @@ -9,5 +9,7 @@ \image examples/BuiltinColormaps.png + This example demonstrates using the colormaps for uses other than an ImageView. This code could be used to display colormaps to the user, so that they can select one to apply to a ImageView. + \quotefile examples/BuiltinColormaps.qml */ \ No newline at end of file diff --git a/examples/ColorMappedImages.qdoc b/examples/ColorMappedImages.qdoc index e5d6405..24af3ab 100644 --- a/examples/ColorMappedImages.qdoc +++ b/examples/ColorMappedImages.qdoc @@ -9,5 +9,7 @@ \image examples/ColorMappedImages.png + This example demonstrates a neat feature of bitwise and, generating a Sierpinski triangle. An ImageView is used to display this with four different colormaps. + \quotefile examples/ColorMappedImages.qml */ \ No newline at end of file diff --git a/examples/ColorMappedImages.qml b/examples/ColorMappedImages.qml index 1afd812..e286339 100644 --- a/examples/ColorMappedImages.qml +++ b/examples/ColorMappedImages.qml @@ -5,8 +5,6 @@ import QtQuick import QtQuick.Controls as QQC import QtQuick.Layouts as QQL import QuickGraphLib as QuickGraphLib -import QuickGraphLib.GraphItems as QGLGraphItems -import QuickGraphLib.PreFabs as QGLPreFabs QQL.GridLayout { id: root diff --git a/examples/ColorMesh.png b/examples/ColorMesh.png index 58f6134..9a15d81 100644 Binary files a/examples/ColorMesh.png and b/examples/ColorMesh.png differ diff --git a/examples/ColorMesh.qdoc b/examples/ColorMesh.qdoc index e092d8a..f50fa0d 100644 --- a/examples/ColorMesh.qdoc +++ b/examples/ColorMesh.qdoc @@ -9,5 +9,7 @@ \image examples/ColorMesh.png + This example demonstrates using an ImageAxes, which is essentially a ColorMesh with a colorbar and some automatic setting of axes limits. + \quotefile examples/ColorMesh.qml */ \ No newline at end of file diff --git a/examples/Complex.qdoc b/examples/Complex.qdoc index 38696fd..803540f 100644 --- a/examples/Complex.qdoc +++ b/examples/Complex.qdoc @@ -9,5 +9,7 @@ \image examples/Complex.png + This example is a spaghetti mess of various plots on the same axes. It can be used as an example of how to structure graphs, or as an example of what to avoid. Your choice. + \quotefile examples/Complex.qml */ \ No newline at end of file diff --git a/examples/Contours.qdoc b/examples/Contours.qdoc index da91a61..10910c6 100644 --- a/examples/Contours.qdoc +++ b/examples/Contours.qdoc @@ -9,5 +9,9 @@ \image examples/Contours.png + This example demonstrates using the Python helpers to generate some contour lines (green and blue) and a contour fill (red area), which are then plotted using \l Contour. + + The contourpy package must be installed to view this example. See \l {https://contourpy.readthedocs.io/} for installation instructions and algorithm details. + \quotefile examples/Contours.qml */ \ No newline at end of file diff --git a/examples/Conway.qdoc b/examples/Conway.qdoc index 33ad05e..51cc41e 100644 --- a/examples/Conway.qdoc +++ b/examples/Conway.qdoc @@ -7,10 +7,12 @@ \brief A implementation of Conway's Game of Life cellular automaton (and variants). \example conway - Files to load into this simulator can be found online, e.g. going to \l {https://conwaylife.com/wiki/Gosper_glider_gun} and downloading the "RLE" file under "Pattern files" in the right sidebar. - \image examples/Conway.png + This example demonstrates providing live 2D data efficiently from Python to QML. + + Files to load into this simulator can be found online, e.g. going to \l {https://conwaylife.com/wiki/Gosper_glider_gun} and downloading the "RLE" file under "Pattern files" in the right sidebar. + \quotefile examples/Conway.qml \quotefile examples/conway.py */ \ No newline at end of file diff --git a/examples/DarkSinGraph.png b/examples/DarkSinGraph.png index 9a6ba58..9e5a993 100644 Binary files a/examples/DarkSinGraph.png and b/examples/DarkSinGraph.png differ diff --git a/examples/DarkSinGraph.qdoc b/examples/DarkSinGraph.qdoc index 9b6790d..83e7e77 100644 --- a/examples/DarkSinGraph.qdoc +++ b/examples/DarkSinGraph.qdoc @@ -9,5 +9,13 @@ \image examples/DarkSinGraph.png + This example is the same as \l {Basic sin graph}, except that the theme has been extensively customised. Changes include: + + \list + \li Dark background and light axes + \li Light text, with adjusted font weights and styles + \li Light legend + \endlist + \quotefile examples/DarkSinGraph.qml */ \ No newline at end of file diff --git a/examples/DraggableRegion.qdoc b/examples/DraggableRegion.qdoc index e5840c6..3de4509 100644 --- a/examples/DraggableRegion.qdoc +++ b/examples/DraggableRegion.qdoc @@ -9,5 +9,7 @@ \image examples/DraggableRegion.png + This example demonstrates using GraphItemDragHandler (which is essentially a MouseArea with some utility methods) to convert user interaction from a position in pixels to a position in data coordinates. The example displays two vertical lines and a vertical span, which can be dragged around the graph. + \quotefile examples/DraggableRegion.qml */ \ No newline at end of file diff --git a/examples/ImageAlignment.qdoc b/examples/ImageAlignment.qdoc index 1f7a4c0..65bde4e 100644 --- a/examples/ImageAlignment.qdoc +++ b/examples/ImageAlignment.qdoc @@ -9,5 +9,7 @@ \image examples/ImageAlignment.png + This example demonstrates using the various alignments and fill modes of ImageView. It also shows the effect of mirroring and transposing the image - these properties can be used to correct data that uses different indexing styles. And finally, this example also shows the effect smoothing has. + \quotefile examples/ImageAlignment.qml */ \ No newline at end of file diff --git a/examples/InvertedAxes.qdoc b/examples/InvertedAxes.qdoc index 83b13b7..2052a2b 100644 --- a/examples/InvertedAxes.qdoc +++ b/examples/InvertedAxes.qdoc @@ -9,5 +9,7 @@ \image examples/InvertedAxes.png + This example demonstrates using a negative width and height in the viewRect to invert the direction of the axes. + \quotefile examples/InvertedAxes.qml */ \ No newline at end of file diff --git a/examples/ReadoutLine.qdoc b/examples/ReadoutLine.qdoc index 23c0e87..ebcdaeb 100644 --- a/examples/ReadoutLine.qdoc +++ b/examples/ReadoutLine.qdoc @@ -9,5 +9,7 @@ \image examples/ReadoutLine.png + This example demonstrates using a MouseArea to track the user's mouse, and using the dataTransform to covert that into data coordinates. Since QML is declarative, parts of the graph can be easily updated to react to mouse movements. + \quotefile examples/ReadoutLine.qml */ \ No newline at end of file diff --git a/examples/ScalingGraph.qdoc b/examples/ScalingGraph.qdoc index 3e76f2c..74b066c 100644 --- a/examples/ScalingGraph.qdoc +++ b/examples/ScalingGraph.qdoc @@ -9,5 +9,7 @@ \image examples/ScalingGraph.png + This example demonstrates using a ScalingContainer to keep a graph at a specific aspect ratio. This can be useful if the graph is going to be exported to a particular paper size. + \quotefile examples/ScalingGraph.qml */ \ No newline at end of file diff --git a/examples/Scatter.qdoc b/examples/Scatter.qdoc index eabbd29..b898058 100644 --- a/examples/Scatter.qdoc +++ b/examples/Scatter.qdoc @@ -9,5 +9,7 @@ \image examples/Scatter.png + This example demonstrates using a Repeater to display points in a scatter graph. Since repeaters can take models, you can easily incorporate extra data and give each point a different color or style. + \quotefile examples/Scatter.qml */ \ No newline at end of file diff --git a/examples/SpansAndLines.qdoc b/examples/SpansAndLines.qdoc index 55bdbf7..7310b06 100644 --- a/examples/SpansAndLines.qdoc +++ b/examples/SpansAndLines.qdoc @@ -9,5 +9,7 @@ \image examples/SpansAndLines.png + This example demonstrates using vertical and horizontal lines and spans, including the various options for dashing and filling provided by ShapePath. + \quotefile examples/SpansAndLines.qml */ \ No newline at end of file diff --git a/examples/Subgraphs.qdoc b/examples/Subgraphs.qdoc index c4dd35a..1d10d84 100644 --- a/examples/Subgraphs.qdoc +++ b/examples/Subgraphs.qdoc @@ -9,5 +9,7 @@ \image examples/Subgraphs.png + This example demonstrates using multiple XYAxes to form a 2x2 grid of subplots. This is the easier way to achieve this, but if more control over spacing is needed, then prefabs should not be used. + \quotefile examples/Subgraphs.qml */ \ No newline at end of file diff --git a/examples/TwinX.qdoc b/examples/TwinX.qdoc index 8e03209..0788bc2 100644 --- a/examples/TwinX.qdoc +++ b/examples/TwinX.qdoc @@ -9,5 +9,7 @@ \image examples/TwinX.png + This example demonstrates using multiple \l {GraphArea}s to display two Y axes with the same X axis. Each Y axis has it's own GraphArea, as the view rect for each is different. Since GraphAreas are transparent, this does not cause any occlusion problems. + \quotefile examples/TwinX.qml */ \ No newline at end of file diff --git a/examples/ZoomableAsImage.qdoc b/examples/ZoomableAsImage.qdoc index c8b3454..e3f3f45 100644 --- a/examples/ZoomableAsImage.qdoc +++ b/examples/ZoomableAsImage.qdoc @@ -9,5 +9,7 @@ \image examples/ZoomableAsImage.png + This example demonstrates using a ZoomPanHandler to handle conversion of user inputs to a transformation. The transformation is then applied to the XYAxes's GridLayout, which will cause the entire graph to scale/translate, just like an image. To change the axes limits instead, see the \l{Zoomable axes} example. + \quotefile examples/ZoomableAsImage.qml */ \ No newline at end of file diff --git a/examples/ZoomableAxes.qdoc b/examples/ZoomableAxes.qdoc index 66080ed..a44d435 100644 --- a/examples/ZoomableAxes.qdoc +++ b/examples/ZoomableAxes.qdoc @@ -9,5 +9,11 @@ \image examples/ZoomableAxes.png + This example demonstrates using a ZoomPanHandler to handle conversion of user inputs to a transformation. This transformation is then applied to the view rect of the graph, so that the axes limits changed based on user input. + + In addition, the limits are displayed in a set of \l{SpinBox}es, and any changes to the spin box values are fed back into the ZoomPanHandler using the baseTransformFromRect method to convert the limits back into a transformation. + + To zoom into the entire graph instead, see the \l{Zoomable as image} example. + \quotefile examples/ZoomableAxes.qml */ \ No newline at end of file