1

My chartview's right border is shifting towards left by some pixels after some time, don't know why, i tried everything !! I have attached Images to get the better idea, also i have added code, i have not done anything wrong, don't know why it is happening !!!

Rectangle
{
    id: top
    color: "black"
    visible: true
    width: 400
    height: 250
    focus: true
    clip: true

    //Variables and Array
    property double x_axis_variable_for_wave_1:52
    property double y_axis_variable_for_wave1

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

        }

        LineSeries
        {
            id:l1
            axisX: x_axis
            axisY: y_axis
            color: "yellow"
        }

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

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

                //Increment variable for plotting on next x axis point
                x_axis_variable_for_wave_1=x_axis_variable_for_wave_1+2
            }
        }
    }
}

Below are the images which will show my doubt as you can see, there is gap in second image at right border as compare to first image. What is wrong ? can someone suggest ?

Image 1

Image 2 with some gap at right border

  • 1
    Why not to use `Layout`? You set absolute size, position, then anchoring .. negative values ... for what all these games? – folibis Feb 21 '19 at 13:36
  • @folibis Actually I have requirement to make a same UI as we have currently and we all know that if we draw chartview directly without giving negative "x" axis and all then it will create chartview but there will be some gap between inside "Grid" and outside chartview,I want grid's left,right,top,bottom border should touch window's left,right,top,bottom respectively !! – BHUSHAN SURE Feb 22 '19 at 05:33
  • @folibis You got any idea, why it is happening ? – BHUSHAN SURE Feb 25 '19 at 07:18

0 Answers0