【问题标题】:ChartView how to align with xAxis boundariesChartView 如何与 xAxis 边界对齐
【发布时间】:2019-01-22 23:34:15
【问题描述】:

我想将一个项目与 ChartView 的 X 轴边界对齐。

有可能吗,请给我一个提示如何做到这一点? 当前的解决方案看起来一点也不好看:

         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
}

【问题讨论】:

    标签: qt charts qml


    【解决方案1】:

    解决方案是使用ChartView 的plotArea 属性:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-11
      • 2018-11-14
      • 1970-01-01
      • 2017-07-28
      • 1970-01-01
      • 1970-01-01
      • 2019-07-25
      • 2020-12-29
      相关资源
      最近更新 更多