我正在使用这个示例而不是 customtablemodel.cpp 我将其名称更改为 ScopeDataModel 并在我的 qml 代码中使用它。但是当我运行这段代码时,它不会更新图表上的数据。
ScopeDataModel{
id:scopeModel
}
ChartView
{
id: chartView
title: " Scope "
anchors.fill: parent
legend.visible: false
antialiasing: true
backgroundColor: "white"
plotAreaColor: "white"
titleColor: "white"
ValueAxis {
id: axisX
titleText:componentData.readXAxisName
min: componentData.changeXMin
max: componentData.changeXMax
tickCount: 1
}
ValueAxis {
id: axisY
titleText:componentData.readYAxisName
min: componentData.changeYMin
max: componentData.changeYMax
tickCount: 1
}
LineSeries {
id: lineSeries
name: "Data Output"
axisX: axisX
axisY: axisY
useOpenGL: true
VXYModelMapper{
model:scopeModel
xColumn:0
yColumn:1
series:lineSeries
}
}
}