Android Question what b4x lib recomended for charts ?

which b4x library recommended for charts?, I saw several posts on the forum, I downloaded xchartmini and xchartlite, but it says the .jar file is missing

I need example for pie chart.

thank´s
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

These are b4xlibs. The XML file is not needed. It was generated to help developers using help tools that rely on the XML file.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could use either the xChartLite or the xChart library depending on the options you need.
xChartMini does not support Pie charts.
I would suggest you to begin with xChartLite.
In the demo program you have this example code:
B4X:
Sub CreatePieData
    PieChart1.ClearData
    
    Private i, Values(4) As Int
    
    For i = 0 To 3
        Values(i) = Rnd(50, 501)
    Next

    ' initialize the pie chart data
    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
 
Upvote 1
Klaus, I took an example, but when installing the library, the message that the .jar file is missing, what is the correct download link?, I will use little, but I would like a pie chart, which shows the values in parts of the pie. It is possible ?, Like these in the attached image.
 

Attachments

  • charts.png
    141.9 KB · Views: 46
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
How and where did you install the library ?
xChartLite is a b4xlib library.
You should copy the xChartLite.b4xlib file into the AdditionalLibraries\B4X folder.
You should not copy the xChartLite.xml file.
You find the advised AdditionalLibraries folder structure HERE.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
xCharts sadly does not have a donut chart (it didn't the last I used the pie chart) which does (in theory) make reading round charts easier. I had a client insist on having donut charts in their bespoke application. At the time xCharts didn't have a donut chart, so I just used a pie chart and I drew a white circle in the centre of it. My client was none the wiser and extremely happy with the end results.


Enjoy...
 
Last edited:
Upvote 0
Yes, Klaus, the library went to the additional folder, I removed the xml file and it resolved it. What is the xml file for? I've already managed to generate the graph, now I'm going to do tests to get to know the lib better. Thank you very much.
 
Upvote 0

Now it is clear about the xml file. Is it just a help file? If so, how to open it?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…