Creating Pie chart / progressbar like arc in andorid

馋奶兔 提交于 2021-02-08 07:32:08

问题


I am working on a project where I want to show a pie chart like the image added. Already have searched google and other posts in stackoverflow, but could not find a solution. any solution is appreciated.

Note: suggestions of third-party library are also welcome. Also please do not suggest MPAndroidChart as I think my query can be implemented using simpler method.


回答1:


You can use the library https://github.com/PhilJay/MPAndroidChart to achieve this.

Add below in xml:

 <com.github.mikephil.charting.charts.PieChart
    android:id="@+id/chart"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

In java code:

PieChart chart = (Piechart) findViewById(R.id.chart);

Example code:

https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PieChartActivity.java

There are lot of variances available.

Another library to consider is:

https://github.com/lecho/hellocharts-android




回答2:


You can also use this library - https://github.com/lzyzsd/CircleProgress

I found it be much simpler to use and easier to customise in comparison to the more complex chart libraries like MPChart.



来源:https://stackoverflow.com/questions/34824653/creating-pie-chart-progressbar-like-arc-in-andorid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!