<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can&#x27;t retroactively add points to ScatterSeries]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I recently looked forward to the addition QtGraphs to QML and have been trying to create 2D scatter graph that updates during the runtime of my program. To test this, I simply wanted to see if I could add new points to my ScatterSeries by pressing a button as seen in the following code:</p>
<pre><code>import QtQuick
import QtQuick.Controls 6.7
import QtQuick3D 6.7
import QtGraphs 6.7
import QtQuick.Window
import QtQuick.Layouts


Window {
    width: 1024
    height: 768
    visible: true

    Rectangle {
        id: rectangle
        anchors.fill: parent

        Rectangle {
            id: rectangle1
            x: 520
            y: 0
            width: 504
            height: 768
            color: "#000000"

            GraphsView {

                id: graphView
                visible: true
                anchors.fill: parent

                theme: GraphTheme {
                    readonly property color c1: "#DBEB00"
                    readonly property color c2: "#373F26"
                    readonly property color c3: Qt.lighter(c2, 1.5)
                    colorTheme: GraphTheme.ColorThemeDark
                    gridMajorBarsColor: c3
                    gridMinorBarsColor: c2
                    axisXMajorColor: c3
                    axisYMajorColor: c3
                    axisXMinorColor: c2
                    axisYMinorColor: c2
                    axisXLabelsColor: c1
                    axisYLabelsColor: c1
                }
                component Marker: Rectangle {
                    id: marker
                    width: 16
                    height: 16
                    color:"#ffffff"

                    radius: width * 0.5
                    border.width: 4
                    border.color: "#000000"

                }

                ScatterSeries {
                    id: scatterSeries
                    axisX: ValueAxis {
                        max: 5
                        tickInterval: 1
                        minorTickCount: 9
                        labelDecimals: 1
                    }
                    axisY: ValueAxis {
                        max: 10
                        tickInterval: 1
                        minorTickCount: 4
                        labelDecimals: 1
                    }
                    // width: 4
                    // selectable:true
                    // hoverable:true
                    pointMarker: Marker {}


                    XYPoint {
                        x: 0
                        y: 2
                    }

                    XYPoint {
                        x: 1
                        y: 1.2
                    }

                    XYPoint {
                        x: 2
                        y: 3.3

                    }

                    XYPoint {
                        x: 5
                        y: 2.1
                    }

                }
            }

        }

        Button {
            id: pointSpawn
            x: 212
            y: 312
            text: qsTr("Add Point")
            checked: false
            checkable: false
            highlighted: false
            flat: false
            Connections {
                target : pointSpawn
                onClicked: {
                    scatterSeries.append(5,6)
                }

            }
        }
    }

}

</code></pre>
<p dir="auto">I thought I could this by just appending two real values to the QScatterSeries because it is an Q_invokable function according to the documentation. When I try to run however I get the following error:</p>
<pre><code>TypeError: Property 'append' of object QScatterSeries(0x2354355f5f0) is not a function
</code></pre>
<p dir="auto">I am not sure how to fix this. Am I somehow being connected to the wrong QScatterSeries or am I just doing something wrong in my code. Would really appreciate some advice on this.</p>
<p dir="auto">Kind regards<br />
Olivier</p>
]]></description><link>https://forum.qt.io/topic/158864/can-t-retroactively-add-points-to-scatterseries</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 19:32:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/158864.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Sep 2024 07:46:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t retroactively add points to ScatterSeries on Tue, 24 Sep 2024 13:30:04 GMT]]></title><description><![CDATA[<p dir="auto">I'm still using Qt 5 but I had a look at the doc and it seems to me that the API exposed to QML is more limited in QtGraphs than it was in QtCharts. The <code>append</code> method is available in the <code>QXYSeries</code> C++ implementation class but not in QML as far as I can see. You might need to write a function in some backend C++ code that you expose to QML. This function would accept a <code>QXYSeries*</code> and you will be able to access <code>append</code> in the function's C++ implementation. You will be able to pass your <code>scatterSeries</code> object to this function from QML and it will be received as a <code>QXYSeries*</code>.</p>
]]></description><link>https://forum.qt.io/post/810492</link><guid isPermaLink="true">https://forum.qt.io/post/810492</guid><dc:creator><![CDATA[Bob64]]></dc:creator><pubDate>Tue, 24 Sep 2024 13:30:04 GMT</pubDate></item></channel></rss>