Android Question Graphing

DT1111

Member
Licensed User
Longtime User
Hello Erel

First of all thanks for the code in your graphs example (esp. the line graph). In fact I have had some good use.

I have tried to understand the codes where the graphs and grids are actually created and I am no wiser. I want to display my "dynamic & real time" curve similar to Klaus' oscilloscope example.

I could do it with your approach except that there is always a "tailing line" that links the end of the plotted curve to the the x-axis (ie y = 0 when there is no data yet). Please refer to my attachment.

Is there something in the code that can be tweaked to make the "tailing-line" transparent?

Thank you.
 

Attachments

  • TAILLINE.jpg
    TAILLINE.jpg
    5.6 KB · Views: 221

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code in Sub DrawLineChart draws the line:
B4X:
'Single line
     Dim py As Float
     py = point.Y
     For i = 1 To LD.Points.Size - 1
       point = LD.Points.Get(i)
       LD.Canvas.DrawLine(G.GI.originX + G.GI.intervalX * (i - 1), calcPointToPixel(py, G) _
         , G.GI.originX + G.GI.intervalX * i, calcPointToPixel(point.Y, G), LD.LinesColors.Get(0), 2dip)
       py = point.Y
     Next
You can add a check to test if point.Y = 0. In that case you should avoid drawing the line.
 
Upvote 0

DT1111

Member
Licensed User
Longtime User
Hi Erel

I want to place a few markers on the graph curve (small diamond shape or solid circle or square legends) using your graph codes.

What is the best approach to doing that?

Thanks.
 
Last edited:
Upvote 0
Top