Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Graph plotting issue in QML
Forum Updated to NodeBB v4.3 + New Features

Graph plotting issue in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 221 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mnhg
    wrote on last edited by
    #1

    I need to plot a Spline series chart. Below is the code

    ChartView {
                                              id:graph
                                              //title: "Graph"
                                              anchors.fill: rect1
                                               antialiasing: true
    
                                               ValueAxis {            /*-----Graph X axis range-----*/
                                                   id: axisx
                                                    min: 0
                                                    max: 100
                                                    tickCount: 11
                                                    labelFormat: "%.0f"
                                               }
                                               ValueAxis {            /*-----Graph Y axis range-----*/
                                                   id: axisy
                                                    min: 0
                                                    max: 200
                                                    tickCount: 11
                                                    labelFormat: "%.0f"
                                               }
    
                                               SplineSeries {         /*-----Graph 1 values-----*/
                                                   id: grp1
                                                   axisX: axisx
                                                   axisY: axisy
                                                 
                                                   XYPoint { y: 200; x: 0 }
                                                  XYPoint { y: 180; x: 55 }
                                                   
                                               }
                                          }
    

    I have defined an array, property var ary: [0,90,65,50,75,80,25,50,70,0].

    Here in array, index is y-axis and value is the x-axis.
    Please any one help me to use "for" loop or any other solution in the code in the place of XYPoint { y: 200; x: 0 }, to plot all the array elements instead of using multiple XYPoint { y: 200; x: 0 } lines.

    ODБOïO 1 Reply Last reply
    0
    • M mnhg

      I need to plot a Spline series chart. Below is the code

      ChartView {
                                                id:graph
                                                //title: "Graph"
                                                anchors.fill: rect1
                                                 antialiasing: true
      
                                                 ValueAxis {            /*-----Graph X axis range-----*/
                                                     id: axisx
                                                      min: 0
                                                      max: 100
                                                      tickCount: 11
                                                      labelFormat: "%.0f"
                                                 }
                                                 ValueAxis {            /*-----Graph Y axis range-----*/
                                                     id: axisy
                                                      min: 0
                                                      max: 200
                                                      tickCount: 11
                                                      labelFormat: "%.0f"
                                                 }
      
                                                 SplineSeries {         /*-----Graph 1 values-----*/
                                                     id: grp1
                                                     axisX: axisx
                                                     axisY: axisy
                                                   
                                                     XYPoint { y: 200; x: 0 }
                                                    XYPoint { y: 180; x: 55 }
                                                     
                                                 }
                                            }
      

      I have defined an array, property var ary: [0,90,65,50,75,80,25,50,70,0].

      Here in array, index is y-axis and value is the x-axis.
      Please any one help me to use "for" loop or any other solution in the code in the place of XYPoint { y: 200; x: 0 }, to plot all the array elements instead of using multiple XYPoint { y: 200; x: 0 } lines.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @mnhg hi

      for(var i in ary)
         grp1.append(ary[i],i)
            
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved