Created
August 31, 2015 16:27
-
-
Save sharish/52ec6ad79e9c3774d052 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final PieChart pie = (PieChart) this.findViewById(R.id.pie_chart); | |
float[] marks = {0.35f, 0.3f, 0.2f,0.15f}; | |
String[] subjects = { "Physics", "Maths", "Chemistry", "CS"}; | |
int[] colors = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW}; | |
for (int i = 0; i < marks.length; i++) { | |
int color = colors[i % colors.length]; | |
pie.addItem(subjects[i], marks[i], color); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment