B4A Library MPAndroidCharts - Various type of graphs / charts (Latest library V1.22 in post #1)

JonRubin

Member
Licensed User
Longtime User
Hi Johan.... I was actually trying this out as I saw your response.... I'll let you how how it works out... Thanks... Jon
 

AmoUser

New Member
Licensed User
It seems that everytime I try to do something with this lib I get error message:

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2485)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:4217)
at android.content.res.Resources.getLayout(Resources.java:2301)
at android.view.LayoutInflater.inflate(LayoutInflater.java:413)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.github.mikephil.charting.components.MarkerView.setupLayoutResource(MarkerView.java:39)
at com.github.mikephil.charting.components.MarkerView.<init>(MarkerView.java:29)
at com.github.mikephil.charting.components.MyMarkerView.<init>(MyMarkerView.java:27)
at mpandroidchartwrapper.barChartWrapper.setBarData(barChartWrapper.java:250)
at b4a.example.main._activity_create(main.java:580)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

I get this message even with examples. Only working example is in post 93.
 

Johan Schoeman

Expert
Licensed User
Longtime User


See my answer here - I think you have the same problem. You are missing files in your project

https://www.b4x.com/android/forum/t...y-files-in-post-188.58017/page-10#post-446408
 

AmoUser

New Member
Licensed User
It seems that these missing files from layout and drawable folders caused the problems.

Is there anyway to set BarChart bar width and spacing between bars?
 
Last edited:

Cenny

Active Member
Licensed User
Longtime User
 

Cenny

Active Member
Licensed User
Longtime User
Hi,
I downloaded the the example files to have a look, but the program crashed on line 91.
' mlc1.LineData = 73 'this number must be the same as the number of elements in the above arrays '
android.content.res.Resources$NotFoundException: Resource ID #0x0

Cenny
 

Johan Schoeman

Expert
Licensed User
Longtime User

Cenny

Active Member
Licensed User
Longtime User
I have looked at it but cannot figure out what files would be missing...
I simply downloaded the project.
 

Johan Schoeman

Expert
Licensed User
Longtime User
I have looked at it but cannot figure out what files would be missing...
I simply downloaded the project.

Extract the attached zip folder and then copy it to the B4A project's /Objects folder. In your B4A project folder structure you should have

Objects
res
drawable
icon.png
marker1.png
marker2.png
marker3.png
marker4.png
layout
custom_marker_view_1.xml
custom_marker_view_2.xml
custom_marker_view_3.xml
custom_marker_view_4.xml
Files

Make sure that the property of all the files highlighted in RED above are set to READ ONLY
 

Attachments

  • res.zip
    24.3 KB · Views: 402

Cenny

Active Member
Licensed User
Longtime User
Is there a way I can extract info out of the crosshairs position?
 

Johan Schoeman

Expert
Licensed User
Longtime User
linechart
Attached new library files (V1.02). It will raise an event in the B4A project when a point on the graph is touched (index of the x-axis and value of the y-axis). Use it as follows:

B4X:
Sub mlc1_value_selected(index As Int, value As Float)
   
    Log("index = " & index)
    Log("value = " & value)
   
End Sub

Have added the event to Linechart and MultiLineChart
 

Attachments

  • mpChartLib_V1_02.zip
    355 KB · Views: 300

Cenny

Active Member
Licensed User
Longtime User
Thanks very much Johan.
This is exactly what I was looking for.
 

Cenny

Active Member
Licensed User
Longtime User
Thanks very much Johan.
This is exactly what I was looking for.

Hi Johan,
I have noticed that when the linegraph is zoomed, it is not possible to move the crosshair anymore, because then the graph is moving.
Is there aworkaround for this ?
 

Alex_Puz

Member
Licensed User
Longtime User
Hi, It seems to me Chart "Pi" always fail after it was published at the library in post #12, also can you add touch events at Radar and Pi, thank you so much.
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Hi, It seems to me Chart "Pi" always fail after it was published at the library in post #12, also can you add touch events at Radar and Pi, thank you so much.
See post #209. It should solve your problem.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…