Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Return interpolated values from QLineSeries
Forum Updated to NodeBB v4.3 + New Features

Return interpolated values from QLineSeries

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 704 Views
  • 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.
  • K Offline
    K Offline
    Kelenyche
    wrote on last edited by
    #1

    Hi -

    Is there a way to return the interpolated values - i.e. what a QChart actually draws once you feed it a line series? For example, if I feed it the series (1,1) and (4, 4), it will draw a sloped line between the two points, so is there a way to return what it interpolated for the y value at x=2 and x=3? Can I take that further, and go down to the decimal level, so I can control every pixel's width of graph?

    For context, I'm drawing a color gradient across a chart under a graphed line, but I need the drawing to stop vertically at the line - so I need the y value of the line at every pixel value along the x-axis.

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      First, you need to know there are different ways to interpolate among a data set. It is totally up to you how to do it. Linear or higher order? It is not hard to find where 2 or 3 is located and write a small function to get what you need.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kelenyche
        wrote on last edited by
        #3

        That's true, I definitely can do the interpolation, I'm just avoiding it both because Qt has already done it somewhere in the backend, and because it's going to be messy - as I mentioned I need to draw a vertical line for every pixel's width of the QChart, so it'll be a slope between every point, and then draw up to whatever height it needs. It would be nice to get the smoothness of a spline series as well, but I guess that's just higher order interpolation. I guess what I'm looking for is a way to return a vector of points that describe where, in pixel values, the QChart has drawn the line, but that might be too much to ask. ;)

        Thanks for your response - I'll probably do the interpolation myself unless someone else knows the magic function call!

        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