我将mpchart库用于android stadio中的饼图。图表标签有不同数量的重叠部分。请帮助我。
ArrayList<PieEntry> entries = new ArrayList<>();
for (int i = 0; i < headerTitle.getContent().size(); i++) {
ReportParameterModel.Data.ReportTypes.Content content = headerTitle.getContent().get(i);
String s = content.getReportValue().toString().replace("-", "");
entries.add(new PieEntry(Float.parseFloat(s), content.getReportDesc()));
}
PieDataSet pieDataSet = new PieDataSet(entries, "");
PieData data = new PieData(pieDataSet);
data.setValueFormatter(new PercentFormatter());
pieDataSet.setDrawValues(true);
pieDataSet.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
pieDataSet.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
data.setValueTextColor(G.context.getResources().getColor(R.color.title_color_dark));
pieDataSet.setValueLinePart1Length(0.4f);
pieDataSet.setValueLinePart2Length(0.3f);
pieDataSet.setValueTextSize(12f);
pieDataSet.setValueTextColor(G.context.getResources().getColor(R.color.title_color_dark));/* this line not working */
pieDataSet.setValueTypeface(G.getFont());
pieDataSet.setColors(getColors(headerTitle.getContent().size()));
pieChart.setData(data);
Description description = new Description();
description.setText("");
pieChart.setDescription(description);