Size Problem , It get reduced after some time



  • The right side border of chartview shift's little towards left side after completion of one wave, what i am doing wrong ?
    @J-Hilk @LeLev @Yunus @dheerendra

    Rectangle
    {
        id: top
        color: "black"
        visible: true
        width: 400
        height: 250
        focus: true
        clip: true
    
        function graph_1_scaling()
        {
            console.log("Graph1")
            x_axis.min=x_axis.max-80
        }
    
        //Variables and Array
        property double x_axis_variable_for_wave_1:52
        property double y_axis_variable_for_wave1
        property double y_axis_variable_for_wave2
        property variant items: []
        property int  i:0
    
        // ChartView 1
        ChartView
        {
            id:chrt
            height: parent.height
            width: parent.width+51
            x:-31
            antialiasing: true
            legend.visible: false
            backgroundRoundness: 0
            margins.top: 17
            margins.bottom: 0
            margins.left: 1
            margins.right: 1
            backgroundColor: "black"
    
            ValueAxis
            {
                id:x_axis
                min: 0
                max: 50
                tickCount: 5
                labelsVisible: false
                gridLineColor: "#969FB2"
                color: "#969FB2"
            }
    
            ValueAxis
            {
                id:y_axis
                min: 0
                max: 5
                tickCount: 4
                labelsVisible: false
                gridLineColor: "#969FB2"
                color: "#969FB2"
    
            }
    
            ValueAxis
            {
                id:y_axis_right
                min: 0
                max: 5
                tickCount: 6
                labelsVisible: false
                gridLineColor: "#969FB2"
                color: "#969FB2"
            }
    
            LineSeries
            {
                id:l1
                axisX: x_axis
                axisY: y_axis
                color: "yellow"
            }
    
            LineSeries
            {
                id:l2
                axisX: x_axis
                axisY: y_axis
                color: "Yellow"
                style: Qt.DotLine
            }
    
            Timer
            {
                interval: 1000; repeat: true; running: true
                onTriggered:
                {
                    //Creating Random Y-axis variable for wave 1
                    y_axis_variable_for_wave1= Math.floor(Math.random()*(2-(6)+1)+(6));
                    y_axis_variable_for_wave2= Math.floor(Math.random()*(0-(3)+1)+(3));
    
                    //Increment X-axis for showing in reverse order wave
                    x_axis.min=x_axis.min+2
                    x_axis.max=x_axis.max+2
    
                    //Join Two points at Runtime
                    l1.append(x_axis_variable_for_wave_1,y_axis_variable_for_wave1)
                    l2.append(x_axis_variable_for_wave_1,y_axis_variable_for_wave2)
    
                    //Increment variable for plotting on next x axis point
                    x_axis_variable_for_wave_1=x_axis_variable_for_wave_1+2
                }
            }
        }
    }
    


  • @LeLev @J-Hilk @dheerendra

    0_1550472980883_Capture1.PNG

    0_1550472983737_Capture2.PNG

    As you can see, at right border it got shifted after some time.



  • hi
    @Bhushan_Sure said

    completion

    you have a infinite timer, how you stop it ?



  • @LeLev It is infinite loop, it should run continously and should take value and plot it in graph.



  • @Bhushan_Sure yes, but you said : "after completion of one wave" this means you will manually stop the timer right ?



  • @LeLev after completion of one wave means, as the wave starts from right border and ends at left border, as it reaches to left border the position changed only once, then it will remain at that position.



  • @LeLev the wave is not completing, actually i want to say that once the wave comes close to left border of chartview then the right border of chartview shift's by little !



  • yes i tested it.. that is wierd i have no idea why this is happening sorry



  • @LeLev it's okay, i will try some other way :), Thank you for your help



  • @LeLev
    Chartview's grid reposition itself everytime whenever min or max of Valueaxis changes. Whenever Valueaxis min or max changes in order of log10 then it reposition it's grid.


Log in to reply
 

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