Android Question I need a chart component for B4I and B4A

ThePuiu

Active Member
Licensed User
Longtime User
I need a B4X component with which I can draw graphs for at least one variable.
The attached image represents an idea of what I would need. Google Chart is a variant but I would prefer something more customizable.
 

Attachments

  • IMG_2312.PNG
    IMG_2312.PNG
    205.9 KB · Views: 245

ThePuiu

Active Member
Licensed User
Longtime User
I tried to use the library you specified in a simple B4I program. I included the library in the additional folder and included it in the project. I have included in the page layout the xChart component and I have copied the example given.
B4X:
PieChart1.ClearData
    Private i, Values(4) As Int
   
    For i = 0 To 3
        Values(i) = Rnd(50, 501)
    Next

    PieChart1.AddPie("Slice #1", Values(0), xui.Color_Blue) '0 = random color
    PieChart1.AddPie("Slice #2", Values(1), xui.Color_Red)
    PieChart1.AddPie("Slice #3", Values(2), xui.Color_Yellow)
    PieChart1.AddPie("Slice #4", Values(3), xui.Color_Cyan)
   
    PieChart1.DrawChart

When I run the program I get the following error:
B4X:
Application_Start
Application_Active
SignalHandler 11
Error occurred on line: 724 (xChart)
Signal - 11
Stack Trace: (
    "0   xBeam                 SignalHandler + 120",
    "1   libsystem_platform.dylib            0x000000019e741884 09A51269-D3C5-3ECE-87B7-F32C096AF8E7 + 34948",
    "2   xBeam                 -[b4i_xchart _initchart:] + 416",
    "3   xBeam                 -[b4i_xchart _drawchart:] + 400",
    "4   xBeam                 -[b4i_charts _show] + 3448",
    "5   xBeam                 -[b4i_main _buttonlogin_click] + 668",
    "6   CoreFoundation       DA838E75-6B30-360E-9661-C4800A7E1BF6 + 1252752",
    "7   CoreFoundation       DA838E75-6B30-360E-9661-C4800A7E1BF6 + 7120",
    "8   xBeam                 +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608",
    "9   xBeam                 -[B4IShell runMethod:] + 448"
)

What am I not doing well?
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
Yes, I made the change with the pie.
Very strange ... if I move all the code on the first page of the application it works, in none of the other NO!

In Main I have:
B4X:
Sub Button1_Click
Charts.Show
End Sub

where Charts is a second page.

B4X:
Public Sub Show
    If pg.IsInitialized = False Then
        pg.Initialize("pg")
        pg.RootPanel.LoadLayout("ChartLayout")
        pg.HideBackButton = True 
    End If

    Main.NavControl.ShowPage(pg)
    Main.NavControl.ToolBarVisible = False
    
    DateTime.DateFormat = "dd/MM/yyyy"
     
    PieChart1.ClearData
    Private i, Values(4) As Int
    
    For i = 0 To 3
        Values(i) = Rnd(50, 501)
    Next

    PieChart1.AddPie("Slice #1", Values(0), xui.Color_Blue) '0 = random color
    PieChart1.AddPie("Slice #2", Values(1), xui.Color_Red)
    PieChart1.AddPie("Slice #3", Values(2), xui.Color_Yellow)
    PieChart1.AddPie("Slice #4", Values(3), xui.Color_Cyan)
    
    PieChart1.DrawChart    
End Sub
I use B4I last version and the included libraries are in the attached pictures.
 

Attachments

  • libs.png
    libs.png
    5.9 KB · Views: 180
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
My page was named Chart...after I change the name in something else, everything go normally!
Thanks for your patience and for the library!
 
Upvote 0
Top