Android Question Vertical Cursor

DT1111

Member
Licensed User
Longtime User
Hi Erel

I am trying to show a vertical cursor over the graph when I touch it. The attached example works Ok but I am not sure what is the better way of doing it so that the vertical cursor remains within the confine of the graph boundary. Also the method used here will not work well in another device with different screen size.

Appreciate your help.
 

Attachments

What kind of diagrams do you want to display ?
If the diagrams are Y - time or Y - X diagrams I would do the drawing on my own like shown in the User's Guide chapters 9.3.1 and 9.3.2.
These examples don't have the cursor but it's not that difficult to add one, I could help you.
But what do you want to do with the cursor ?
Just show a cursor is not looking useful to me, at least you should show the values of the curves at the given cursor positions.
The advantage is you are managing everything yourself.
 
Upvote 0
Hi Klaus

I want to display a simple Y vs Time graph. Thanks for the reference which is helpful. Both the Graph framework as well as this one are good - just that I have started my project with the former. I find with the Graph framework approach, I could send the raw data to the AddLinePoint and it will do the conversion from raw to pixel info.

I have tried the new approach as suggested by you and I have no progress in as far as displaying the raw data. I might have missed something trivial here.

In the attached sample, I have used a timer to simulate a periodical data input (per second). Firstly the intention is to display the data plot, then secondly to read off the plot using the vertical cursor as mentioned in my above post. I have copied and renamed some subs with suffix "2" for the purpose of this exercise.

Appreciate your help.
 

Attachments

Last edited:
Upvote 0
Do you want to make a kind of oscilloscope ?
You might have a look at Oscilloscope, it has a cursor.
Do you need automatic scaling ?

The next days I have my grandkids at home so not so much time for B4A.
But I will have a look at your code.
 
Upvote 0
Hi Klaus

Thanks for your help and really no great rush.

In fact, I have looked at the Oscilloscope example and there was where I learned the cursor trick. Neat.

The automatic scaling would be a nice feature but I think that will make the code more complicated than they already are. ;)

Have fun.
 
Upvote 0
Attached you find your modified project with the cursor and value display, I added a panel for this.
I modified some parts of the program but I haven't added the automatic scale.
 

Attachments

Upvote 0
Hi Klaus

Welcome back and I trust you had great times with your grandkids.

The attached example is very good. I will pore through the codes and will ask questions if and when I am stuck. Phenomenal. Thank you.
 
Upvote 0
Back
Top