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
QtWS25 Last Chance

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

    DiracsbracketD 1 Reply Last reply
    0
    • R Refi

      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

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on 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

      • Login

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