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. Getting data from ChartView after plotting it
Qt 6.11 is out! See what's new in the release blog

Getting data from ChartView after plotting it

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.8k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I see I can get the plotted data from the chart after plotting it using this Method:

    QPointF at(int index)
    

    https://doc.qt.io/archives/qt-5.10/qml-qtcharts-xyseries.html#append-method

    , which :Returns the point at the position specified by index. Returns (0, 0) if the index is not valid.

    but I don't know how to use it?

    1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by 6thC
      #2

      XYSeries is the class you are using inquiring about, it's a base class.
      XYSeries is inherited By:
      LineSeries, ScatterSeries, and SplineSeries

      So your instance of [LineSeries | ScatterSeries | SplineSeries]

      ChartView { 
      ...
      LineSeries {
      id: series 
      ...
      
      onSomethingHasToHappen: { var values = series.at(indexToValue); }
      
      ? 1 Reply Last reply
      2
      • 6thC6 6thC

        XYSeries is the class you are using inquiring about, it's a base class.
        XYSeries is inherited By:
        LineSeries, ScatterSeries, and SplineSeries

        So your instance of [LineSeries | ScatterSeries | SplineSeries]

        ChartView { 
        ...
        LineSeries {
        id: series 
        ...
        
        onSomethingHasToHappen: { var values = series.at(indexToValue); }
        
        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @6thC Thanks it works

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @6thC said in Getting data from ChartView after plotting it:

          series.at(indexToValue)

          How to get the y element from this array!

          1 Reply Last reply
          0
          • 6thC6 Offline
            6thC6 Offline
            6thC
            wrote on last edited by 6thC
            #5

            @6thC said in Getting data from ChartView after plotting it:

            series.at(indexToValue)

            var values = series.at(indexToValue);
            

            values object should give you x,y - I assume in a JS array or object with 2 real values? I don't read back only push to charts and I don't use qml to do it as its too slow for me.

            This should help, a Qt.point apparently: http://doc.qt.io/qt-5/qml-point.html

            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