54 lines
826 B
QML
Raw Normal View History

2018-11-27 21:57:35 +01:00
import QtQuick 2.8
2018-03-02 23:20:57 +01:00
import QtCharts 2.2
2018-03-03 10:31:27 +01:00
import QtQuick.Layouts 1.3
2018-11-27 21:57:35 +01:00
import QtQuick.Controls 2.3
2018-03-02 23:20:57 +01:00
2018-11-27 21:57:35 +01:00
ApplicationWindow {
2018-03-02 23:20:57 +01:00
width: 400
height: 300
title: "Charts"
Component.onCompleted: visible = true
2018-03-03 10:31:27 +01:00
ColumnLayout {
anchors.fill: parent
2018-03-02 23:20:57 +01:00
2018-03-03 10:31:27 +01:00
ChartView {
id: view
2018-03-02 23:20:57 +01:00
2018-03-03 10:31:27 +01:00
Layout.fillHeight: true
Layout.fillWidth: true
2018-03-02 23:20:57 +01:00
2018-03-03 10:31:27 +01:00
VXYModelMapper {
id: mapper
model: myListModel
series: lineSeries
xColumn: 0
yColumn: 1
}
LineSeries {
id: lineSeries
name: "LineSeries"
axisX: ValueAxis {
min: 0
max: myListModel.maxX
}
axisY: ValueAxis {
min: 0
max: myListModel.maxY
}
}
}
RowLayout {
Layout.fillWidth: true
Button {
text: "Add random point"
onClicked: myListModel.addRandomPoint()
}
}
2018-03-02 23:20:57 +01:00
}
}