我尝试实现setValueFormatter方法,但该方法始终为红色“无法解析symboll”错误
mChart.setValueFormatter(new myFormAT())
答案 0 :(得分:2)
ValueFormatter
can be set for DataSet
and not for Chart object.
Example:
ValueFormatter formatter = new ValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
return ((int) value) + " " + currency;
}
};
dataSet.setValueFormatter(formatter);
答案 1 :(得分:0)
PieDataSet dataSet = new PieDataSet(entries, "");
dataSet.setValueFormatter(new IValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
return String.valueOf((int) value);
}
})