我在Android项目中使用Android MPChart库.我想在饼图上仅显示数据值的位置.
我试过了
chart.setUsePercentValues(false);
Run Code Online (Sandbox Code Playgroud)
但它用%符号显示实际值.我想删除该%符号.如何删除%符号?
如果可能的话,我想在图例中显示数据.
饼图代码
chart.setUsePercentValues(false);
chart.setHoleColorTransparent(true);
chart.setHoleRadius(60f);
chart.setDrawHoleEnabled(true);
chart.setRotationAngle(0);
chart.setRotationEnabled(true);
chart.setDescription("");
chart.setDrawSliceText(false);
PieDataSet dataSet = new PieDataSet(yVals, "");
dataSet.setSliceSpace(3f);
dataSet.setColors(colors);
/**Set data to piechart */
PieData data = new PieData(xVals, dataSet);
data.setValueFormatter(new PercentFormatter());
data.setValueTextSize(10f);
data.setValueTextColor(Color.WHITE);
chart.setData(data);
chart.setDescription("");
chart.highlightValues(null);
chart.animateXY(1500, 1500, AnimationEasing.EasingOption.EaseOutBack);
chart.setTouchEnabled(true);
Legend l = chart.getLegend();
l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
chart.invalidate();
Run Code Online (Sandbox Code Playgroud) 我在我的android项目中使用MPChart libarary.我有Json,它包含饼图生成的标签,值和颜色.我想从json到piechart元素设置相同的颜色.我按照MPChart文档,但没有找到饼图颜色设置的任何解决方案.