Announcement

Collapse
No announcement yet.

Create a plot with dynamic scale

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create a plot with dynamic scale

    Hi everyone,

    I want to draw a plot from two series of data, but the user needs to enter the range of the X and Y axes in a previous query. Is it possible?

    Thanks

  • #2
    Hello

    Do you need to do this with the scope widget or are you creating your own in the designer environment ? Also how is the value for X and Y entered ?

    Best regards

    Paul

    Comment


    • #3
      Hi Paul,

      My initial idea is to create a first window in the display, with two objects where the user can enter the maximum values for X and Y (e.g. 2 slider bars or options menu). Then these values will be use to build the axes of the graph to display in the next window. The data to fill the graph are collected as 2 series of data intially storage in the SD card (previously saved from an external microcontroller which takes them from analog sensors).

      Comment


      • #4
        Hello,

        The simplest way to do it would be to use PutPixel as a plot eg.

        gfx_PutPixel(x, y, color);

        You would have to calculate the x and y cordinates relative to the position n the scale and also the range. I don't think we have any examples for this for you to get ideas from.

        I hope this helps

        Best regards

        Paul

        Comment


        • #5
          He pauleilio,

          I got to plot a XY graph from a data series. As you said I use the gfx_PutPixel (x,y, color). It is easy but requires a lot of precalculations for scaling properly the axes and translate data to pixels.
          Now, I see two problems to have better quality of the plotting:

          1. interpolation: when I have a series of data of 40 points, but they run from pixel 0,0 to pixel 800,480 (as example with the uLCD-50DT), Do you have any pre-implemented function for interpolation? (linear, binomial....)...

          2. Make the line thicker: the line made with only 1 pixel per point, specially in large screen, is too thin. I have a couple of ideas to implement a close-neighbour/proximity algorithm to fill the neighbour-pixels of the point itself. Do you have any function for doing it?

          I feel that these problems must be very usual among 4D users... Do you have any library of plotting functions?

          Best regards

          Comment


          • #6
            Hello,

            If you have a look at page 169 on the internal functions datasheet http://www.4dsystems.com.au/productp...ions_R_2_0.pdf there are many setting's you can change to way lines and dots are drawn on the display. Dots can be drawn larger by changing it to a gfx_CircleFilled.

            Also, on page 146 & 147 you will find gfx_LineTo and gfx_LineRel which may be helpful

            I hope this helps

            Best regards

            Paul

            Comment

            Working...
            X