[Interest] Problem with Qt Charts in 5.7

Ian Geiser geiseri at geekcentral.pub
Mon Nov 7 19:58:57 CET 2016


Greetings, I am trying to emulate a sparkline with Qt Charts but for some reason I cannot get the width of the chart to extend to both the right and left margins.   Even when I set them to "0".  Top and Bottom margins seem to have an impact on the height of the chart though.  It almost looks as if the plot area still thinks there are labels associated with the axis even when I have them explicitly disabled.  Below is the snippet of code I am using:

ChartView {
            anchors.fill: parent
            legend.visible: false
            antialiasing: true;
            margins.top: 0
            margins.bottom: 0
            margins.left: 0
            margins.right: 0

            DateTimeAxis {
                id: axisX
                min: minX.value ? minX.value : new Date()
                max: maxX.value ? maxX.value : new Date()
                minorGridVisible: false
                labelsVisible: false
                gridVisible: true
            }

            ValueAxis {
                id: axisY
                min: minY.value ? minY.value : -1
                max: maxY.value ? maxY.value : -1
                labelsVisible: false
                minorGridVisible: false
                gridVisible: true
            }

            LineSeries {
                id: line
                axisX: axisX
                axisY: axisY
                width: 2
                pointsVisible: true
            }

            VXYModelMapper {
                id: modelMapper
                xColumn: 0
                yColumn: 2
               
                series: line
                model: root.sourceModel
            }
        }







More information about the Interest mailing list