Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to use labelsPrecision with chartView QML?



  • Hi,

    I'm trying to remove decimals from my left Y axis.

    Do you know how to do?

            Rectangle{
                height: parent.height-fgaln.height
                width:parent.width
                anchors.bottom:parent.bottom
                anchors.left: parent.left
                color:"transparent"
                ChartView {
                    id:barChartView
                    anchors.fill:parent
                    legend.alignment: Qt.AlignBottom
    
                    antialiasing: true
                    backgroundColor:"transparent"
    
                    ValueAxis {
                        id: yAxis
                    }
                    BarSeries {
                        id: mySeries
                        axisX: BarCategoryAxis { categories: StringList.year()}
                        axisY: yAxis
                        labelsVisible :true
                        labelsPosition: AbstractBarSeries.LabelsOutsideEnd
    
                    }
                }
            }
    

    Thank you for you help



  • @filipdns Hi. I couldn't run your code but maybe you can try this in your valueaxis scope

    labelFormat: "%.0f"



  • @Yunus Hello, It's working fine thank you very much but could you explain little bit what "%.0f" is meaning ?

    King regards
    Philippe



  • @filipdns Hi again. it decides the number of digits after point


Log in to reply