Congratulations to our 2022 Qt Champions!

Chart scroll

  • Hi, i have this chartView

     ChartView {
              width: parent.width / 2
            height: parent.height

    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

    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