By default, in QML Charts LineSeries all the points are labelled. I need to label only specific points, how to achieve this ?
Here is my qml file (part of big project). I have set corresponding properties for LineSeries to show point labels, but I need only couple of labels displayed instead of complete set of points. Is there a way in Qml to control this ?
import QtQuick 2.7
import QtCharts 2.2
import QtQuick.Layouts 1.3
import aa.ui.backend 1.0
Item {
property DSPBackend backend: analyzer.dsp
property alias titleV: chartV.title
property alias seriesV: lineSeriesV
property alias titleI: chartI.title
property alias seriesI: lineSeriesI
GridLayout {
id: gridSpectrum
anchors.fill: parent
columns: 2
rows: 1
columnSpacing: 0
flow: GridLayout.LeftToRight
ChartView {
id: chartV
Layout.fillWidth: true
Layout.fillHeight: true
/*title: "Spectrum (V-channel)"
titleFont.pixelSize: 10*/
theme: ChartView.ChartThemeBlueCerulean
antialiasing: false
legend.visible: false
legend.font.pointSize: 10
margins.top: 2
margins.left: 2
margins.right: 2
margins.bottom: 4
ValueAxis {
id: axisXV
titleFont.pointSize: 7
labelsFont.pointSize: 7
}
ValueAxis {
id: axisYV
titleFont.pointSize: 7
labelsFont.pointSize: 7
}
LineSeries {
id: lineSeriesV
axisX: axisXV
axisY: axisYV
color: "#66cc00"
name: "V-channel"
pointLabelsFormat: "(@xPoint Hz, @yPoint dB)"
pointLabelsVisible: true
width: 3
useOpenGL: false
}
}
ChartView {
id: chartI
/*title: "Spectrum (I-channel)"
titleFont.pixelSize: 10*/
antialiasing: true
theme: ChartView.ChartThemeBlueCerulean
legend.visible: false
legend.font.pointSize: 10
margins.top: 2
margins.left: 2
margins.right: 2
margins.bottom: 4
Layout.fillWidth: true
Layout.fillHeight: true
ValueAxis {
id: axisXI
titleFont.pointSize: 7
labelsFont.pointSize: 7
}
ValueAxis {
id: axisYI
titleFont.pointSize: 7
labelsFont.pointSize: 7
}
LineSeries {
id: lineSeriesI
axisX: axisXI
axisY: axisYI
color: "#0099ff"
name: "I-channel"
pointLabelsFormat: "(@xPoint Hz, @yPoint dB)"
pointLabelsVisible: true
width: 3
useOpenGL: false
}
}
}
Timer {
id: timerSpectrum
interval: 500
running: true
repeat: true
onTriggered: {
backend.update_spectrum(seriesV, seriesI);
}
}
Component.onCompleted: {
backend.setup_spectrum(axisXV, axisYV, axisXI, axisYI)
}
}