Debian Codegraph @

examples/charts/qmlchartsgallery/qml/customlegend/Main.qml

raw
1 // Copyright (C) 2023 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4 import QtQuick
5
6 Item {
7 id: main
8
9 Column {
10 id: column
11 anchors.fill: parent
12 anchors.bottomMargin: 10
13 spacing: 0
14
15 ChartViewSelector {
16 id: chartViewSelector
17 width: parent.width
18 height: parent.height - customLegend.height - anchors.bottomMargin
19 onSeriesAdded: (seriesName, seriesColor) => customLegend.addSeries(seriesName, seriesColor);
20 }
21
22 CustomLegend {
23 id: customLegend
24 width: parent.width
25 height: 50
26 anchors.horizontalCenter: parent.horizontalCenter
27 onEntered: seriesName => chartViewSelector.highlightSeries(seriesName);
28 onExited: chartViewSelector.highlightSeries("");
29 onSelected: seriesName => chartViewSelector.selectSeries(seriesName);
30 }
31 }
32
33 states: State {
34 name: "highlighted"
35 PropertyChanges {
36 target: chartViewHighlighted
37 width: column.width
38 height: (column.height - column.anchors.margins * 2 - customLegend.height)
39 }
40 PropertyChanges {
41 target: chartViewStacked
42 width: 1
43 height: 1
44 }
45 }
46 }