Qt QML - ChartView的边距

时间:2017-07-24 05:22:37

标签: qt qml qtchart

为什么ChartView对象的边距不是Rectangle对象?如何使它们一样?例如,如果ChartView对象替换为Rectangle,则边距变为相同。

import QtQuick 2.7
import QtQuick.Controls 2.2
import QtCharts 2.2

Rectangle {
    anchors.fill: parent
    color: "#eeeeee"

    Rectangle {
        id: idRectConsole1
        width: 200
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        anchors.margins: 20
        color: "#ffffff"

    }

    ChartView {
        anchors.top: parent.top
        anchors.left: idRectConsole1.right
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.margins: 20
        legend.visible: false

        LineSeries {
            name: "1"
            XYPoint { x: 2; y: 0.73278}
            XYPoint { x: 4; y: 1.2213}
            XYPoint { x: 6; y: -0.73278}

        }
    }    
}

enter image description here

0 个答案:

没有答案