如何從BarChat刪除圖例。 我有一些代碼。如何刪除BarChart圖例
float[] yData = { (float)Math.abs(item._Lent),(float) Math.abs(item._Barrow)};
String[] xData = { "salary", "Spends" };
ArrayList<BarEntry> entries = new ArrayList<>();
for (int i = 0; i < yData.length; i++)
entries.add(new BarEntry(yData[i], i));
BarDataSet dataset = new BarDataSet(entries, "");
ArrayList<String> labels = new ArrayList<String>();
for (int i = 0; i < xData.length; i++)
labels.add(xData[i]);
BarData data = new BarData(labels, dataset);
mChart.setData(data); // set the data and list of lables into chart
BarChart barchart = mChart;
Legend legend = barchart.getLegend();
legend.setEnabled(false);
YAxis topAxis = barchart.getAxisLeft();
topAxis.setDrawLabels(false);
YAxis bottomAxis = barchart.getAxisRight();
bottomAxis.setDrawLabels(false);
XAxis rightAxis = barchart.getXAxis();
rightAxis.setDrawLabels(false);
bottomAxis.setDrawLabels(false);
`
此代碼不能正常工作。我讓我跟進。
並獲得你想要的輸出? –