How to reduce Space in ChartView
-
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.
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" } } }
-
you can try to play with negative margins, but you need to remove width and height in ChartView
-
@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
-
@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.
-
@Bhushan_Sure hmm. what about negative x,y then?
-
@vladstelmahovsky @Yunus
Space got reduced using negative "x,y" axis and by increasing width of chartview.
Thankyou :)