Android Question android chart-module slower than iOS chart-module ?

D

Deleted member 103

Guest
Hi,

I use the chart module of Android and iOS, respectively in an Android app and iOS app.

The procedur "DrawSpeedPoint" is started by a timer. With iOS is listed without delay, on the other hand appear very slowly at Android.

I think the fault lies on the function "pnlDiagramm.Invalidate", what do you think?

Question: why is there in Android not "canvas.Refresh" ?

Android-Sub:
B4X:
Sub DrawSpeedPoint(time As Float, speed As Float)
   Dim x1 As Int = GI.originX + (lastSpeed.time * 1dip * GI.intervalX) / 60
   Dim x2 As Int = GI.originX + (time * 1dip * GI.intervalX) / 60

   If time > lastSpeed.minute * 60 Then
     Dim DestRecht As Rect
     Dim bmp As Bitmap
     bmp.Initialize3(cvXY.Bitmap)
     DestRecht.Initialize(0,0,bmp.Width,bmp.Height)
     cvXY.DrawRect(DestRecht, Colors.Transparent,True,1)
     lastSpeed.minute=lastSpeed.minute + 1
     pnlDiagramm.Width=scvChart.Width + GI.intervalX * (lastSpeed.minute -10)
     scvChart.Panel.Width=pnlDiagramm.Width
     'scvChart.Width=pnlCharts.Width - 80dip
     cvXY.Initialize(pnlDiagramm)
     cvXY.DrawBitmap(bmp,Null,DestRecht)
     pnlDiagramm.Invalidate
     DoEvents
     scvChart.FullScroll(0,True,False)
     GI.gw = pnlDiagramm.Width
     DrawGridLine(lastSpeed.minute)
   End If
   
   'Imposed avarege speed
   cvXY.DrawLine(x1, Charts.calcPointToPixel(lastSpeed.oldAvarageSpeed,Gr), _
         x2, Charts.calcPointToPixel(AvarageSpeed,Gr), Colors.Green, 2dip)

   'Current avarege speed
   cvXY.DrawLine(x1, Charts.calcPointToPixel(lastSpeed.speed,Gr), _
         x2, Charts.calcPointToPixel(speed,Gr), Colors.Magenta, 2dip)
   
   pnlDiagramm.Invalidate
   lastSpeed.time=time
   lastSpeed.speed=speed
   lastSpeed.oldAvarageSpeed=AvarageSpeed
End Sub


iOS-Sub:
B4X:
Sub DrawSpeedPoint(time As Float, speed As Float)
   Dim x1 As Int = GI.originX + (lastSpeed.time * 1dip * GI.intervalX) / 60
   Dim x2 As Int = GI.originX + (time * 1dip * GI.intervalX) / 60

   If time > lastSpeed.minute * 60 Then
     Dim DestRecht As Rect
     Dim bmp As Bitmap
     bmp = cvXY.CreateBitmap
     DestRecht.Initialize(0,0,imgDiagramm.Width,imgDiagramm.Height)
     cvXY.DrawRect(DestRecht, Colors.Transparent,True,1)
     cvXY.Refresh
     lastSpeed.minute=lastSpeed.minute + 1
     imgDiagramm.Width = scvChart.Width + GI.intervalX * (lastSpeed.minute -10)
     scvChart.Panel.Width = imgDiagramm.Width
     scvChart.ContentWidth = imgDiagramm.Width
     cvXY.Initialize(imgDiagramm)
'     cvXY.DrawBitmap(bmp,DestRecht)
'     cvXY.Refresh
     scvChart.ScrollOffsetX = scvChart.ContentWidth - scvChart.Width
     GI.gw = imgDiagramm.Width
     DrawGridLine(lastSpeed.minute)
     cvXY.DrawBitmap(bmp,DestRecht)
     cvXY.Refresh
   End If
   
   'Imposed avarege speed
   cvXY.DrawLine(x1, Charts.calcPointToPixel(lastSpeed.oldAvarageSpeed,Gr), _
         x2, Charts.calcPointToPixel(AvarageSpeed,Gr), Colors.Green, 2dip)

   'Current avarege speed
   cvXY.DrawLine(x1, Charts.calcPointToPixel(lastSpeed.speed,Gr), _
         x2, Charts.calcPointToPixel(speed,Gr), Colors.Magenta, 2dip)
   
   cvXY.Refresh
   lastSpeed.time=time
   lastSpeed.speed=speed
   lastSpeed.oldAvarageSpeed=AvarageSpeed
End Sub
 
D

Deleted member 103

Guest
Hi Erel, thank you for your trouble.

I found the brake.:)
I use a few label as AutoTextSizeLabel and they slow down the whole process. :mad:

It has nothing to do with my function "DrawSpeedPoint". ;)
 
Upvote 0
Top