Chart scroll



  • Hi, i have this chartView

     ChartView {
            id:mchart
              width: parent.width / 2
            height: parent.height
            LineSeries{
                id:vals
            }
        }
    

    Im adding appending points to it whan a signal 'onMessageChanged' is emitted

      onMessageChanged: {
            var messageFields = inspector.logMsg.split(";")
             vals.append(tick , messageFields[1] );
             tick+=0.2 // this is the time x axis
                if(tick>1)
                    mchart.scrollRight(/**/)
        }
    

    My question is : How much i have to scroll right to ensure that last added point is visible ?

    mchart.scrollRight(/* x ?*/)
    

    or is there a methode like positionViewAtEnd() that i can directly use ?

    Thx in advance



  • @LeLev
    I have never used scrollRight (wasn't even aware there was such a method), but wouldn't it be easier to just adapt the range of your XAxis such that its max main tick value is greater than or equal to the x-coordinate of the new point?



  • @Diracsbracket thank you for the suggestion i will try today.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.