Android MPAndroid图表文本与饼图重叠
Android MPAndroidChart Text Overlapping with PieChart
我正在使用 MPAndroidChart
来显示 PieChart
中的值。
我参考了 但仍然不清楚如何修复 PieChart
中的文本重叠
结果如下图。
橙色值包含3,显示在底部,但绿色值包含2,显示不正确。解决方案需要绿色价值。
chart.setUsePercentValues(false);
chart.getDescription().setEnabled(false);
chart.getDescription().setTextSize(25f);
chart.setExtraOffsets(5, 5, 5, 5);
chart.getLegend().setEnabled(false);
chart.setDragDecelerationFrictionCoef(0.95f);
chart.setCenterTextTypeface(tfLight);
chart.setCenterTextColor(getResources().getColor(R.color.white));
chart.setDrawHoleEnabled(true);
chart.setHoleColor(getResources().getColor(R.color.toolBar));
chart.setTransparentCircleColor(R.color.toolBar);
chart.setTransparentCircleAlpha(110);
chart.setHoleRadius(35f);
// chart.setTransparentCircleRadius(61f);
chart.getXAxis().setTextColor(Color.WHITE);
chart.setDrawCenterText(true);
chart.setRotationAngle(0);
// enable rotation of the chart by touch
chart.setRotationEnabled(false);
chart.setHighlightPerTapEnabled(true);
任何人都可以帮助我解决这个问题,我的代码哪里出错了?
提前致谢。
最后我通过添加下面的行来避免与 pieChart
、
重叠的文本得到解决方案
PieData data = new PieData(dataSet);
dataSet.setValueLinePart1OffsetPercentage(90.f);
dataSet.setValueLinePart1Length(.10f);
dataSet.setValueLinePart2Length(.50f);
得到如下结果,
我正在使用 MPAndroidChart
来显示 PieChart
中的值。
我参考了 PieChart
中的文本重叠
结果如下图。
橙色值包含3,显示在底部,但绿色值包含2,显示不正确。解决方案需要绿色价值。
chart.setUsePercentValues(false);
chart.getDescription().setEnabled(false);
chart.getDescription().setTextSize(25f);
chart.setExtraOffsets(5, 5, 5, 5);
chart.getLegend().setEnabled(false);
chart.setDragDecelerationFrictionCoef(0.95f);
chart.setCenterTextTypeface(tfLight);
chart.setCenterTextColor(getResources().getColor(R.color.white));
chart.setDrawHoleEnabled(true);
chart.setHoleColor(getResources().getColor(R.color.toolBar));
chart.setTransparentCircleColor(R.color.toolBar);
chart.setTransparentCircleAlpha(110);
chart.setHoleRadius(35f);
// chart.setTransparentCircleRadius(61f);
chart.getXAxis().setTextColor(Color.WHITE);
chart.setDrawCenterText(true);
chart.setRotationAngle(0);
// enable rotation of the chart by touch
chart.setRotationEnabled(false);
chart.setHighlightPerTapEnabled(true);
任何人都可以帮助我解决这个问题,我的代码哪里出错了?
提前致谢。
最后我通过添加下面的行来避免与 pieChart
、
PieData data = new PieData(dataSet);
dataSet.setValueLinePart1OffsetPercentage(90.f);
dataSet.setValueLinePart1Length(.10f);
dataSet.setValueLinePart2Length(.50f);
得到如下结果,