Debian Codegraph @

examples/charts/qmlchartsgallery/doc/src/examples-qmlcustomlegend.qdoc

raw
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-qmlcustomlegend-example.html
6 \title Customizing Legends
7 \brief Shows you how to create your own custom legend.
8 \include qmlchartsgallery.qdocinc
9
10 Here we show you how to create your own custom legend instead of using the
11 built-in legend of ChartView API.
12
13 The main view of the application shows a stacked area chart. This is how one of
14 the stacked areas is created. See ChartViewStacked.qml and AnimatedAreaSeries.qml.
15
16 \image examples_qmlcustomlegend1.png {Screenshot displaying the government taxes
17 as multiple area charts stacked on top of each other, the orange chart being
18 the social security, green being the municipal, and the blue being the state}
19
20 \snippet qmlchartsgallery/qml/customlegend/ChartViewStacked.qml 1
21
22 Hovering with mouse on top of the legend will highlight the hovered series.
23 (see CustomLegend.qml).
24
25 \image examples_qmlcustomlegend2.png {Screenshot showing if the mouse hovers above
26 one of the three legends (state, municipal, social security), the associated
27 area will be highlighted}
28 \snippet qmlchartsgallery/qml/customlegend/CustomLegend.qml 1
29 \snippet qmlchartsgallery/qml/customlegend/CustomLegend.qml 2
30 \dots
31 \snippet qmlchartsgallery/qml/customlegend/CustomLegend.qml 3
32
33 You can also select one of the stacked areas for a closer look as a line series by
34 a mouse click (see ChartViewHighlighted.qml).
35
36 \image examples_qmlcustomlegend3.png {Screenshot showing if one area chart of the
37 three is being pressed, the course of the area will be shown}
38 \snippet qmlchartsgallery/qml/customlegend/ChartViewHighlighted.qml 1
39 */