B4J Question xChart: DynamicLines1 - how to set X-range big, but of small ReadingsToShow ?

peacemaker

Expert
Licensed User
Longtime User
HI, All

How to scale the X-axes ?
Question is about the normal situation, when data points DB is huge, but it needs to show long X-area by some minimal points qty without any freezing during drawing.
 

peacemaker

Expert
Licensed User
Longtime User
If we have a DB with points X,Y info that are added very quickly - the chart is working slowly and slowly, according to the need to get points from growing DB.
So.... i also do not understand what to do, but charting is freezing the longer the harder.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
What is the sampling frequency ?
How do you fill the chart ?
Do you use the remove RemovePointData(Index) method ?
50-100 point per second
Your regular example of DynamicLines1.
Only this from your example:

If DynamicLines1.NbPoints = ReadingsToShow Then
DynamicLines1.RemovePointData(0)
End If

ReadingsToShow is calculated dynamically.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
How correct RemovePointData is to be used ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Latest change is here:

B4X:
Sub DrawDynamicLinePoints
MinVisibleInterval = 100    'sec
....
    If others.AutoRefresh Then
        ReadingsToShow = 50
    Else
        ReadingsToShow = MinVisibleInterval / (others.RefreshInterval / 1000)
    End If
    'Log("ReadingsToShow1= " & ReadingsToShow)
    If ReadingsToShow > 300 Then
        Dim MaxTargetPointsOnScreen As Int = 100
        Dim PointsPerLine As Int = MaxTargetPointsOnScreen / selection.Size
        ReadingsToShow = PointsPerLine
    End If
    'Log("ReadingsToShow2 = " & ReadingsToShow)

 
    If ReadingsToShow > 50 Then
        DynamicLines1.DrawVerticalGridLines = False
    Else
        DynamicLines1.DrawVerticalGridLines = True
    End If
 
    If DynamicLines1.NbPoints = ReadingsToShow Then
        DynamicLines1.RemovePointData(0)
    End If
    Dim x As Float = others.ticker/1000
    Private ElapsedTime As String = NumberFormat2(x, 2, 2, 2, False)
    DynamicLines1.AddLineMultiplePoints(ElapsedTime, Values, True)
    DynamicLines1.DrawChart
 
End Sub

But before it was 1000 pcs and it was freezing, if to read data from SQlite.
If to chart 40 lines of RND values - no any freezing at your example.

And if to try to see 100 seconds with 50 points\per second.... freezing :), but it's the requirement to see.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
But before it was 1000 pcs and it was freezing, if to read data from SQlite.
If to chart 40 lines of RND values - no any freezing at your example.

Sorry, I still do not understand.
Without your concrete program it is impossible to give a concrete advice.
I do not understand what you are trying to do in your code snippet.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
OK, so - it needs to show 100 seconds of the recorded points, but it's always being added 100 pcs per second (into SQLite) = 10000 points if directly on the screen each second.
I see that not all points are to be selected, but .... it's DynamicLines...how to update...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You want to display 10000 points on the screen !?
On a screen with less than 2000 pixel ?
with an update rate of 100 per second
And this with an update rate of 100 per second ?
What is the concrete application to show that amount of data with such a big update rate ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
:) i see that it's stupid, so it was the topic question how to show dynamically such amount filtered so that no flooding by the data and freezing pc.
It means that ReadingsToShow is to be fixed into some qty, say, 100. And calculate all other scales, some how...
 
Upvote 0
Top