-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBarchartPanel.qml
More file actions
75 lines (68 loc) · 1.99 KB
/
BarchartPanel.qml
File metadata and controls
75 lines (68 loc) · 1.99 KB
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
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtCharts 2.15
BasePanel {
property alias barchart: barchart
property int maxhei: 0
ChartView {
id: barchart
objectName: "barchart"
title: "barcode"
anchors.fill: parent
// anchors.bottom: buts.top
antialiasing: true
animationOptions: ChartView.NoAnimation
dropShadowEnabled: false
ValueAxis {
id: number
max: maxhei + 1
}
ValueAxis {
id: period
min: 0
max: 255
tickCount: 50
// tickInterval: 5
// tickType: ValueAxis.TicksFixed
}
// LineSeries {
// name: "line1"
// }
Row {
id: buts
Button {
text: "Отсортировать"
onClicked: backend.reloadBarcode(true)
anchors.bottom: parent.bottom
}
}
}
function addBarcode(bar) {
for (var i = 0; i < bar.length; i += 2)
addLine(i + 1, bar[i], bar[i + 1])
}
function addLine(ind, x, len) {
var ser = barchart.createSeries(ChartView.SeriesTypeLine,
"Line" + ind.toString(), period, number)
ser.append(x, ind)
ser.append(x + len, ind)
ser.color = Qt.rgba(0, 0, 1, 1)
ser.useOpenGL = true
maxhei = Math.max(maxhei, ind)
// barchar.add
}
function setActive(oldInd, newInd) {
barchart.series(oldInd).width = 2.0
barchart.series(oldInd).color = Qt.rgba(0, 0, 1, 1)
barchart.series(newInd).width = 4.0
barchart.series(newInd).color = Qt.rgba(1, 0, 0, 1)
}
// function addBarcode(lines) {
// for (line in lines) {
// addLine(line.x, line.len)
// }
// }
function clearAll() {
barchart.removeAllSeries()
}
}