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

Multiple charts on same QML page



  • Hi, I need to display multiple charts on QML page like picture below

    Sans titre.jpg

    Data is from sqlite table and I want to have code using repeater or like it because I will have 10 to 20 charts to display.

    Do you know how can I do that?

    Kind rgards

    Philippe



  • @filipdns
    Hello, I'm trying what I need with the code below:
    function numberGraph()
    {
    var count= StringList.mecanoList().length
    for(var i=0;i<count;i++)
    {
    var trigramme=StringList.mecanoList()[i]
    console.log(trigramme)
    modelId.append({'mColor': 'blue','names':trigramme})
    }
    }

    ListModel {
        id: modelId
    }
    BarCategoryAxis {id:categoryaxis; categories: ["2007", "2008", "2009", "2010", "2011","2012"] }
    Rectangle {
        id: rectId
        color: "transparent"
        anchors.fill: parent
        
        GridView {
            id: mGridViewId
            //anchors.fill: parent
            width: parent.width;
            height: parent.height
            cellWidth: parent.width;
            cellHeight: 300
            model: modelId
            delegate: Rectangle {
                width: mGridViewId.cellWidth;
                height: mGridViewId.cellHeight
                color: mColor
                
                ChartView {
                    width: parent.width;
                    height: parent.height
                    title:names
                    StackedBarSeries {
                        
                        axisX:categoryaxis                        
                        BarSet {id:free; label: "Free";values:[1,2,1,3]}
                        BarSet {id:duty; label: "Duty";values:[1,2,5,0]}
                        BarSet {id:off; label: "OFF";values:[5,3,1,4];color:"red"}
                    }
                    
                }
            }
        }
    }
    

    StackedBarSeries Charts are build fine but when I'm trying to scroll down, the application crash when I'm passing the seventh charts without any information on the reason, only the console message:

    "Can not find series on the chart."
    Trying to set axisX to null.

    Could you help me please?

    Kind regards


Log in to reply