HI.. I have used https://github.com/PhilJay/MPAndroidChart to display piechart in my application. I want to hide portion displayed in white square in image.
I have used following code..
mChart.setDescription("");
mChart.setDrawCenterText(true);
mChart.setDrawHoleEnabled(false);
mChart.setRotationAngle(90);
mChart.setRotationEnabled(false);
mChart.setTouchEnabled(false);
mChart.setCenterText(PTGConstantMethod.getNumberInTwoDigit((float) total));
mChart.setCenterTextTypeface(fontBold);
mChart.setCenterTextSize(getResources().getDimension(R.dimen.text_rate_circle_size));
mChart.setDrawHoleEnabled(true);
mChart.setDrawSliceText(false);
setChartData(aryVals, total);
mChart.animateXY(1000, 1000);
mChart.getLegend().setEnabled(false);
And my method to set data is..
private void setChartData(float[] values,double total) {
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < values.length; i++) {
yVals.add(new Entry(values[i], i));
}
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < values.length; i++) {
xVals.add("");
}
PieDataSet set1 = new PieDataSet(yVals, "");
set1.setSliceSpace(0);
ArrayList<Integer> colors = new ArrayList<Integer>();
colors.add(Color.parseColor("#d9534f"));
colors.add(Color.parseColor("#009a20"));
colors.add(Color.parseColor("#5bc0de"));
set1.setColors(colors);
PieData data = new PieData(xVals,set1);
mChart.setData(data);
mChart.highlightValues(null);
mChart.invalidate();
}
Anyone can help me to hide these value? Thanks for your help.
pieChart.setDrawSliceText(false)
can remove the xVals
pieChart.getData().setDrawValues(false)
can remove the yVals
To remove the slice text (coming from the x-values array), call:
pieChart.setDrawSliceText(false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With