我在显示myTable.java中的数据时收到此错误。 显示不兼容的类型
BarChart chart = (BarChart) findViewById(R.id.datachart);
ArrayList<String> BarEntry = new ArrayList<>();
BarEntry.add(myTable.getPopulation_1980());
ArrayList<String> labels = new ArrayList<>();
labels.add("1980");
labels.add("1985");
labels.add("1990");
BarDataSet bardataset = new BarDataSet(BarEntry, "Cells");
BarData data = new BarData(labels, bardataset);
chart.setData(data);
但它在Bardataset bardataset = new Bardadtaset(BarEntry, "cells")
请给我任何建议
答案 0 :(得分:1)
不兼容的类型:String无法转换为List in mpandroidchart
BarDataSet bardataset = new BarDataSet(BarEntry, "Cells");
BarData的构造函数在v3.0.0中已更改
阅读Setting Data
。
public BarDataSet(List<BarEntry> yVals, String label) {
super(yVals, label);
......
}