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
Você pode usar o xChartLite ou a biblioteca xChart, dependendo das opções necessárias.
xChartMini não suporta gráficos de pizza.
Eu sugiro que você comece com xChartLite.
No programa de demonstração, você tem este código de exemplo:
[CÓDIGO=b4x] Sub CreatePieData
PieChart1.ClearData

Privado i, Valores(4) Como Int

Para i = 0 a 3
Valores(i) = Rnd(50, 501)
Próximo

' inicializar os dados do gráfico de pizza
PieChart1.AddPie("Fatia #1", Values(0), xui. Color_Blue) '0 = cor aleatória
PieChart1.AddPie("Fatia #2", Values(1), xui. Color_Red)
PieChart1.AddPie("Fatia #3", Values(2), xui. Color_Yellow)
PieChart1.AddPie("Fatia #4", Values(3), xui. Color_Cyan)

PieChart1.DrawChart
Fim do Sub[/CÓDIGO]
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
    charts.png
    141.9 KB · Views: 60
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
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.
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
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.
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
xCharts infelizmente não tem um gráfico de rosquinha (não foi o último que usei o gráfico de pizza) que faz (em teoria) facilitar a leitura de gráficos redondos. Tive um cliente que insistiu em ter gráficos de rosquinhas em seu projeto. Na época, o xCharts não fazia gráficos de rosquinhas, então eu só uso um gráfico de pizza e desenhei um círculo branco no centro dele. Meus clientes não foram os mais sábios e extremamente felizes com os resultados finais.

Desfr


These are b4xlibs. The XML file is not needed. It was generated to help developers using help tools that rely on the XML file.
Now it is clear about the xml file. Is it just a help file? If so, how to open it?
 
Upvote 0
Top