Android Question Looking for Dynamic Bar Graph library

morphe2011

Member
Licensed User
Longtime User
Good day everyone. I am looking for a dynamic bar graph library (2 or 3D) that can handle a dataset up to 400 items. I know there have been an number developed over the last 15 years but none that I can see that can graph (could use a scrolling panel) this quantity of items. Happy to pay for a licensed one.
 

klaus

Expert
Licensed User
Longtime User
If i understand well, you have a dataset of up to 400 values and you want to display only a part of them and scroll horizontally to move over the whole dataset.
This can be done with the xChart library, attached a small project.
The scrolling is done with a scrollbar and not by swiping the chart.
The upper image shows what you see when you touch the screen, the x and y values.
The bottom image shows another part of the dataset.

1791113680686.png


And the code:

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    
    Private xChart1 As xChart
End Sub

Public Sub Initialize

End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    InitBarData
End Sub

Private Sub InitBarData
    Private i As Int
    xChart1.AddBar("Voltage", xui.Color_Red)    'adds a bar to the chart
    
    For i = 0 To 400
        xChart1.AddBarPointData(i, Rnd(0, 100))    'adds values to the chart
    Next
    xChart1.SetZoomIndexes(0, 40)    'this means that 41 values are shown
    xChart1.SetZoomSteps(1, 20)        'set the values for the small and big steps of the scrollbar
    
    xChart1.DrawChart                'draws the chart
End Sub

What exactly do mean with dynamic ?
 

Attachments

  • ZoomBarChart.zip
    16.8 KB · Views: 4
Upvote 0
Top