blob: a8f67896534167ae6e3bd6860cb90cde5b2b7343 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
pragma ComponentBehavior: Bound
import QtQuick
import QtGraphs
import qtgraphscsv
Item {
id: legendItem
property BarSeries series
property color labelTextColor
property color titleTextColor
readonly property font titleFont: ({
"family": "Inter",
"weight": 600 * Units.px,
"pixelSize": 12 * Units.px,
"letterSpacing": 0 * Units.px,
"bold": false
})
readonly property font labelFont: ({
"family": "Inter",
"weight": 600 * Units.px,
"pixelSize": 10 * Units.px,
"letterSpacing": 0 * Units.px,
"bold": false
})
Column {
id: topLayout
spacing: 15 * Units.px
Text {
id: title
color: legendItem.titleTextColor
verticalAlignment: Text.AlignVCenter
text: qsTr("Selected")
}
Flickable {
id: selectionFlickable
width: contentWidth
height: 200 * Units.px
contentWidth: selectionLabels.width
contentHeight: selectionLabels.height
clip: true
Flow {
id: selectionLabels
spacing: 12 * Units.px
width: 240 * Units.px
Repeater {
id: labelRepeater
model: legendItem.series ? legendItem.series.legendData.length : 0
Rectangle {
id: legend1
required property int index
height: 20 * Units.px
width: text1.width * Units.px
radius: 4 * Units.px
color: legendItem.series.legendData[index].color
Text {
id: text1
topPadding: 4 * Units.px
bottomPadding: 4 * Units.px
leftPadding: 6 * Units.px
rightPadding: 6 * Units.px
horizontalAlignment: Text.AlignHCenter
color: legendItem.labelTextColor
font: legendItem.labelFont
text: legendItem.series.legendData[legend1.index].label
}
}
}
}
}
}
}
|