Search code examples
androidprogress-barpie-chartandroid-progressbar

Creating Pie chart / progressbar like arc in andorid


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.

the pie chart I want to achieve


Solution

  • 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

    enter image description here