MPAndroidChart 删除图例
MPAndroidChart remove legend
我正在使用 MPAndroidChart 库,我想删除 PieChart
右上角的值,我该怎么做?
尝试pieChart.setDrawSliceText(false)
您所说的值属于Legend。
要禁用它们(阻止它们显示),请调用
Legend l = chart.getLegend();
l.setEnabled(false);
你可以这样设置
linechart.setData();
...
linechert.getLegend().setEnable(false);
gone Legend 应该在 setData() 的后面
将此代码添加到 xml 文件中:
<com.github.mikephil.charting.charts.PieChart
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pie_chart">
</com.github.mikephil.charting.charts.PieChart>
将其写入 .java 文件:
pieChart = findViewById(R.id.pie_chart);
Legend l = pieChart.getLegend();
l.setEnabled(false);
我正在使用 MPAndroidChart 库,我想删除 PieChart
右上角的值,我该怎么做?
尝试pieChart.setDrawSliceText(false)
您所说的值属于Legend。
要禁用它们(阻止它们显示),请调用
Legend l = chart.getLegend();
l.setEnabled(false);
你可以这样设置
linechart.setData();
...
linechert.getLegend().setEnable(false);
gone Legend 应该在 setData() 的后面
将此代码添加到 xml 文件中:
<com.github.mikephil.charting.charts.PieChart
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pie_chart">
</com.github.mikephil.charting.charts.PieChart>
将其写入 .java 文件:
pieChart = findViewById(R.id.pie_chart);
Legend l = pieChart.getLegend();
l.setEnabled(false);