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. How to reduce Space in ChartView

How to reduce Space in ChartView

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 2.0k Views 2 Watching
  • 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.
  • Bhushan_SureB Offline
    Bhushan_SureB Offline
    Bhushan_Sure
    wrote on last edited by Bhushan_Sure
    #1

    I want to reduce the space between chartview and inside Grid, like i want only grid to occupy whole screen and not chart and inside that all axis.

    0_1549001524814_Capture.PNG

    import QtQuick 2.9
    import QtQuick.Window 2.3
    import QtCharts 2.3
    
    // Completed
    
    Window
    {
        visible: true
        width: 600
        height: 300
        title: qsTr("Date and Time Reference Line")
    
        ChartView
        {
            anchors.fill: parent
            height: parent.height/2.5
            width: parent.width
            antialiasing: true
            theme: ChartView.ChartThemeDark
            legend.visible: false
            backgroundRoundness: 0
    
            ValueAxis
            {
                id:x_axis
                min: 0
                max: 50
                tickCount: 6
                //labelsVisible: false
            }
    
            ValueAxis
            {
                id:y_axis
                min: 0
                max: 5
                tickCount: 6
                //labelsVisible: false
            }
    
            LineSeries
            {
                id:l1
                axisX: x_axis
                axisY: y_axis
                color: "yellow"
            }
        }
    }
    
    
    1 Reply Last reply
    0
    • V Offline
      V Offline
      vladstelmahovsky
      wrote on last edited by
      #2

      you can try to play with negative margins, but you need to remove width and height in ChartView

      Bhushan_SureB 1 Reply Last reply
      0
      • V vladstelmahovsky

        you can try to play with negative margins, but you need to remove width and height in ChartView

        Bhushan_SureB Offline
        Bhushan_SureB Offline
        Bhushan_Sure
        wrote on last edited by
        #3

        @vladstelmahovsky Hey it's not taking negative margin.
        it is showing like this,when i am setting -1 :-

        Cannot set top margin to a negative value: -1
        
        V 1 Reply Last reply
        0
        • YunusY Offline
          YunusY Offline
          Yunus
          wrote on last edited by
          #4

          @Bhushan_Sure Hi. If you need to reduce the space between grids you need to change chartview's width and height. If you considered their spaces are reduced, chartview's width aand height will change in anyway. Therefore anchors.fill should be removed and assign height and width value.

          1 Reply Last reply
          1
          • Bhushan_SureB Bhushan_Sure

            @vladstelmahovsky Hey it's not taking negative margin.
            it is showing like this,when i am setting -1 :-

            Cannot set top margin to a negative value: -1
            
            V Offline
            V Offline
            vladstelmahovsky
            wrote on last edited by
            #5

            @Bhushan_Sure hmm. what about negative x,y then?

            Bhushan_SureB 1 Reply Last reply
            1
            • V vladstelmahovsky

              @Bhushan_Sure hmm. what about negative x,y then?

              Bhushan_SureB Offline
              Bhushan_SureB Offline
              Bhushan_Sure
              wrote on last edited by
              #6

              @vladstelmahovsky @Yunus
              Space got reduced using negative "x,y" axis and by increasing width of chartview.
              Thankyou :)

              1 Reply Last reply
              0

              • Login

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