Android Tutorial [B4X] Corona Cases - Cross platform Example

klaus

Expert
Licensed User
Longtime User
Hopefully, all the properties available now for the left Yaxis will also be available for the right Yaxis such as text color . . .
I answered in the xChart thread, because this discussion is not really related to this thread.
Are you sure you are 75 years old and not pulling our legs?
The body yes, and fortunately I am in good health and in a good shape.
In the mind and brain I feel younger, hopefully it's not only illusion.
 
Last edited:

skyracer90

Member
Licensed User
Longtime User
B4A 9.8
Hi Erel,
i have Download your Example ans the XChart Lib, but i dont Understand this Error....
Logger verbunden mit: 9DCDUxxxxxxxxxxxxxxx
--------- beginning of system
--------- beginning of main
Copying updated assets files (3)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Read countries data
Error occurred on line: 505 (B4XTable)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:70)
at anywheresoftware.b4a.objects.B4XViewWrapper.getTag(B4XViewWrapper.java:557)
at b4a.example.b4xtable._setpagelabelstate(b4xtable.java:2010)
at b4a.example.b4xtable._clearnavigationstate(b4xtable.java:1936)
at b4a.example.b4xtable$ResumableSub_Clear.resume(b4xtable.java:532)
at b4a.example.b4xtable._clear(b4xtable.java:395)
at b4a.example.sharedmain._preparetable(sharedmain.java:555)
at b4a.example.sharedmain._loaddata(sharedmain.java:412)
at b4a.example.sharedmain._initialize(sharedmain.java:88)
at b4a.example.main._activity_create(main.java:391)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
** Activity (main) Resume **
 

semar

Active Member
Licensed User
Longtime User
Hi,
I get this by compiling:
B4X:
B4A Version: 9.80
Java Version: 11
Parsing code.    (0.20s)
Building folders structure.    (0.03s)
Running custom action.    Error
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robustes Dateikopieren fr Windows                             
-------------------------------------------------------------------------------
  Gestartet: Freitag, 27. M„rz 2020 12:28:58
   Quelle : C:\sergio\B4A\examples\co\Shared Files\
     Ziel : C:\sergio\B4A\examples\co\B4A\Files\
    Dateien : *.*
        
  Optionen: *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2020/03/27 12:28:58 FEHLER 2 (0x00000002) Zugriff auf Quellverzeichnis C:\sergio\B4A\examples\co\Shared Files\
Das System kann die angegebene Datei nicht finden.
 

Jorge M A

Well-Known Member
Licensed User
Longtime User
Comment or delete to the line for ROBOCOPY command and copy the file "full_data.csv" into the files folder of your project.
 

Mahares

Expert
Licensed User
Longtime User
In the Corona example by Erel on the first post, I tried the new feature from xChart 4.90: chart.DifferentScales=True (added by klaus) to use the 'Deaths' in the 2nd Yaxis (right) since the values are a lot smaller than the cases, but everywhere I put it in the code it hangs up the program. Where exactly does that line of code go?
Thank you
 

Jorge M A

Well-Known Member
Licensed User
Longtime User
B4X:
Sub B4XTable1_DataUpdated
    For i = 0 To B4XTable1.VisibleRowIds.Size - 1
        Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
        Dim pnl As B4XView = GraphColumn.CellsLayouts.Get(i + 1) '+1 because of header layout
        Dim ChartParent As B4XView = pnl.GetView(1)
        If RowId > 0 Then
            ChartParent.SetLayoutAnimated(0, 0, 0, pnl.Width, pnl.Height)
            ChartParent.Visible = True
            Dim Chart As xChart = ChartParent.Tag
            
            Chart.DifferentScales=True '<-------
            
            'this is only needed in B4A as the Base_Resize event will be raised automatically in B4J and B4i.
            If xui.IsB4A Then Chart.Base_Resize(ChartParent.Width, ChartParent.Height)

            Chart.ClearData
            Chart.AddLine("Cases", xui.Color_Blue)
            Chart.AddLine("Deaths", xui.Color_Red)
            Dim Country As String = B4XTable1.GetRow(RowId).Get(CountryColumn.Id)
            AddPointsToChart(CountriesData.Get(Country), Chart)
            Chart.DrawChart
        Else
            ChartParent.Visible = False
        End If
    Next
End Sub
 

Mahares

Expert
Licensed User
Longtime User
Chart.DifferentScales=True '<-------
Did it work for you where you placed it. Because I have already tried it there on a 10 inch tablet, the app locked up. I tried it on a Galaxy S6 phone, it showed the first page and locked up. Then I tried it on a Galaxy S10e phone, it showed the first page and then it locked up. Please check it out again.
 

klaus

Expert
Licensed User
Longtime User
The xChart library has been updated to version 5.0.
There was a problem when the min and max values of a line were the same.
You should set these two properties in the Designer, no need to do it in the code:

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…