ChartView, как выровнять с границами xAxis - PullRequest
0 голосов
/ 22 января 2019

Я бы хотел выровнять элемент по границе оси X ChartView.enter image description here

Возможно ли это, и, пожалуйста, дайте мне совет, как это сделать?Текущее решение выглядит не очень хорошо:

         Rectangle {
            color : "darkgrey"
            anchors.top : parent.top
            x : itemPlot.x + 50
            width : parent.width - 50 - 20
            height : parent.height*0.6
         }

         ChartView {
            id : itemPlot

            anchors.bottom: parent.bottom
            anchors.left: parent.left
            width : parent.width
            height : parent.height*0.4


            legend.visible: false
            antialiasing: true
            margins.bottom : 0
            margins.top : 0
            margins.left : 0
            margins.right : 0
}

1 Ответ

0 голосов
/ 22 января 2019

Решение состоит в использовании plotArea свойства ChartView:

 Rectangle {
    color : "darkgrey"
    anchors.top : parent.top
    x : itemSpectrumPlot.plotArea.x
    width : itemSpectrumPlot.plotArea.width
    height : parent.height*0.6
 }
...