QML 图表视图获取 Lineseries.onPointAdded 的 X、Y

QML chartview get X,Y of Lineseries.onPointAdded

如何获取在Lineseries中添加的点的X和Y?
这段代码放在一个简单的ChartView里面。

如果我有以下情况:

LineSeries {
        id: data
        name: "name"
        axisX: axisX
        axisY: axisY
        onPointAdded: {
            //retrieve x and y
    }
}

onPointAdded里面的注释应该用什么替换?
谢谢。

pointAdded signal passes as a parameter the index of the added element, this index must be used next to the method at()获取点数:

onPointAdded: {
    var point = data.at(index);
    console.log(point.x, point.y)
}