Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Custom tooltip Tooltip in chartview
Forum Updated to NodeBB v4.3 + New Features

Custom tooltip Tooltip in chartview

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Refi
    wrote on 19 Aug 2018, 16:41 last edited by Refi
    #1

    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

    D 1 Reply Last reply 21 Aug 2018, 04:52
    0
    • R Refi
      19 Aug 2018, 16:41

      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

      D Offline
      D Offline
      Diracsbracket
      wrote on 21 Aug 2018, 04:52 last edited by Diracsbracket
      #2

      @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
                   }
              }
          }
      

      0_1534827119604_149be339-8a48-48e2-9917-36304330e4dd-image.png

      1 Reply Last reply
      1

      1/2

      19 Aug 2018, 16:41

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved