Custom tooltip Tooltip in chartview
Solved
QML and Qt Quick
-
I have set a custom tooltip using the code
ChartView { id: chart anchors.fill: parent antialiasing: true ValueAxis { id: axisY tickCount: 3 } DateTimeAxis{ id: xTime gridVisible: false } ToolTip { id: id_toolTip contentItem: Text{ color: "#21be2b" } background: Rectangle { border.color: "#21be2b" } } SplineSeries{ id: chartseries pointsVisible: true pointLabelsVisible: false useOpenGL: true axisX: xTime axisY: axisY onClicked: { id_toolTip.show("dd") } } }
It gives an error "TypeError: Property 'show' of object QQuickToolTip(0x37275d0) is not a function" when I click on the graph ..
But below mentioned code snippets work.chart.ToolTip.show("dd")
But I need custom tooltip
-
@Refi
Try this:ChartView { id: chart ... ToolTip { id: tip contentItem: Text{ color: "#21be2b" text: tip.text } background: Rectangle { color: "yellow" border.color: "red" } } LineSeries { ... onClicked: { tip.text = "dd" tip.visible = true } } }