| 1 |
// Copyright (C) 2023 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
import QtQuick |
| 5 |
import QtCharts |
| 6 |
|
| 7 |
//![1] |
| 8 |
ChartView { |
| 9 |
title: "Two Series, Common Axes" |
| 10 |
anchors.fill: parent |
| 11 |
legend.visible: false |
| 12 |
antialiasing: true |
| 13 |
|
| 14 |
ValueAxis { |
| 15 |
id: axisX |
| 16 |
min: 0 |
| 17 |
max: 10 |
| 18 |
tickCount: 5 |
| 19 |
} |
| 20 |
|
| 21 |
ValueAxis { |
| 22 |
id: axisY |
| 23 |
min: -0.5 |
| 24 |
max: 1.5 |
| 25 |
} |
| 26 |
|
| 27 |
LineSeries { |
| 28 |
id: series1 |
| 29 |
axisX: axisX |
| 30 |
axisY: axisY |
| 31 |
} |
| 32 |
|
| 33 |
ScatterSeries { |
| 34 |
id: series2 |
| 35 |
axisX: axisX |
| 36 |
axisY: axisY |
| 37 |
} |
| 38 |
|
| 39 |
// Add data dynamically to the series |
| 40 |
Component.onCompleted: { |
| 41 |
for (var i = 0; i <= 10; i++) { |
| 42 |
series1.append(i, Math.random()); |
| 43 |
series2.append(i, Math.random()); |
| 44 |
} |
| 45 |
} |
| 46 |
} |
| 47 |
//![1] |