2018-03-03 10:31:27 +01:00

55 lines
841 B
QML

import QtQuick 2.7
import QtCharts 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Window 2.3
Window {
width: 400
height: 300
title: "Charts"
Component.onCompleted: visible = true
ColumnLayout {
anchors.fill: parent
ChartView {
id: view
Layout.fillHeight: true
Layout.fillWidth: true
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()
}
}
}
}