【发布时间】:2018-05-18 13:01:43
【问题描述】:
我在 android 中使用 compile 'com.github.PhilJay:MPAndroidChart:v3.0.0' 作为饼图,但无法查看所有标签
还显示了一个标签,但颜色不匹配。
private void drawMap()
{
ArrayList<PieEntry> yvalues = new ArrayList<PieEntry>();
yvalues.add(new PieEntry(8f, "JAN"));
yvalues.add(new PieEntry(15f, "FEB"));
yvalues.add(new PieEntry(12f, "MAR"));
yvalues.add(new PieEntry(25f, "APR"));
yvalues.add(new PieEntry(23f, "MAY"));
yvalues.add(new PieEntry(17f, "JUNE"));
PieDataSet dataSet = new PieDataSet(yvalues, "Election Results");
PieData data = new PieData();
data.addDataSet(dataSet);
data.setValueFormatter(new PercentFormatter());
pcVehicle.setData(data);
dataSet.setColors(ColorTemplate.VORDIPLOM_COLORS);
}<com.github.mikephil.charting.charts.PieChart
android:padding="@dimen/padding_12"
android:layout_margin="@dimen/margin_08"
android:id="@+id/pcVehicle"
android:layout_width="match_parent"
android:layout_height="match_parent" />
【问题讨论】:
-
有解决这个问题的办法吗?