Menu

Interative Markers

2017-10-09
2017-11-23
  • gian marco melosu

    Hallo,
    I've some Current Measurement Readings in a CSV file and my idea was , after this data have been displayed , to have 2 markers (vertical lines) that I can interact with and move so that I can select a specified portion of my graph.

    These markers , after I've set them correctly, will serve as starting and ending point to calculate some data (average and area mainly) in a interactive way .. so that if I move one marker the data is calculated again and values showed on the graph.

    is it something possible to achieve? if not which are the alternatives to do the same?

    thanks a lot

     
  • Karl Ratzsch

    Karl Ratzsch - 2017-11-03

    You can set mouse ruler and then use two pause mouse commands in a while () {} loop with the respective commands to do stats over the chosen range, put the calculated average in a label (set label) and then replot .

    Something like this:

    plot dataf using ....
    set mouse ruler
    flag=1
    while (flag) {
      flag=0
      pause mouse keypress,button1 "press x exit, left mouse button for left border"
      if (MOUSE_KEY!=120) {
         x1=MOUSE_X
         pause mouse keypress,button2 "press x exit, right mouse button for right border"
         if (MOUSE_KEY!=120){
           x2=MOUSE_X
           stats [x1:x2] dataf using ...
           set label 1 at 0,0 sprintf('Average = %.2f',STATS_mean)
           replot
           flag=1
         }
      }
    }
    
     

    Last edit: Karl Ratzsch 2017-11-03
  • gian marco melosu

    Hallo Karl
    thank you very much for your inputs.

    We will try and let you know if this solve our needs!

    thanks a lot!

     

Log in to post a comment.