Android Question Graphhics Help

MrKim

Well-Known Member
Licensed User
Longtime User
We have a Windows MS Access program - works fine - that I am going to port to Android that involves a graph (See below).
It seems like every time I write something in B4A I later find a far more elegant solution to whatever brute force attempt I made So I thought I would ask in advance and get advice from the pros.

What are your suggestions for the best way to draw the graph in B4A?
The important points are:
Points are added manually via keyboard
Red and yellow upper and lower limits are basically constant. The mean (Black Line may be skewed up or down if the upper and lower limits are not are not the same distance from the
The Green band and Blue line are recalculated each time a new point is entered.
Maximum display is 100 points but the user can select to display 10/20/50/100.

MY BIGGEST CONCERN: I need to be able to touch select any of the points and edit it. What I did in Access was ugly but worked. Since Access doesn't allow adding controls (views) at run time i put 100 hidden rectangle controls on the form and added an on click event for each one. I stored the database record ID in the tag property of each one when it was added to the graph. The upside of this was when redrawing I always known the order. Rect1, Rect2, etc. The downside, every time I redraw it involves re-getting the point information from the table (for speed I keep the active chart info in a local table). Each Point has 6 important pieces of data to be stored that are needed to modify it.

Should I store this in a local SQL table? OR create a data type with the information and store it in a list?

I welcome your thoughts and ideas!

upload_2017-9-13_9-51-59.png


upload_2017-9-13_10-6-7.png
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Me too, I would do it with Canvas.
For the graphs you show, I don't think that you really need abExtDrawing.
You could use different layers, with Panels, for the different drawings.
You could also draw the small rectangles with Canvas and use the Touch event to check if the coordinates of one square is equal to the touch coordinates to detect if one square was touched and which one.

You might have a look at chapter 16 Graphics / Drawings in the B4A Beginner's Guide.

I would store the data in a SQLite database.
 
Upvote 0
Top