| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only |
| 3 |
|
| 4 |
/*! |
| 5 |
\page qtcharts-qmlf1legends-example.html |
| 6 |
\title Using List Models as Data Sources in QML |
| 7 |
\brief Implements an F1 Legends Chart to demonstrate List Models as Data Sources. |
| 8 |
\include qmlchartsgallery.qdocinc |
| 9 |
|
| 10 |
\image examples_qmlf1legends.png {Screenshot showing driver speeds displayed as |
| 11 |
three line charts from different people stacked on top of each other, |
| 12 |
Fittipaldi is blue, Steward is green, and Hunt is orange} |
| 13 |
|
| 14 |
Let's define an empty ChartView first: |
| 15 |
|
| 16 |
\snippet qmlchartsgallery/qml/f1legends/F1Legends.qml 1 |
| 17 |
|
| 18 |
Our ListModel uses hard-coded test data. In a real application the data |
| 19 |
source would be a timing system. |
| 20 |
|
| 21 |
\snippet qmlchartsgallery/qml/f1legends/SpeedsList.qml 1 |
| 22 |
\dots |
| 23 |
\snippet qmlchartsgallery/qml/f1legends/F1Legends.qml 2 |
| 24 |
|
| 25 |
The data is parsed with a timer. The line series representing each driver |
| 26 |
are created on the fly. |
| 27 |
|
| 28 |
\snippet qmlchartsgallery/qml/f1legends/F1Legends.qml 3 |
| 29 |
*/ |