Java 找不到MPAndroidChart错误类ValueFormatter
将项目中的MPAndroidChart库从'com.github.PhilJay:MPAndroidChart:v2.25更新到'com.github.PhilJay:MPAndroidChart:v3.0.2后,出现一个错误,表明找不到类ValueFormatter。在进一步的研究中,似乎有人在maven repository artefact index上犯了一个错误,因为v2.2.5似乎是最新版本,而v3.0.2不是最新更新的版本我目前正在一个工作项目中使用此版本Java 找不到MPAndroidChart错误类ValueFormatter,java,android,android-studio,Java,Android,Android Studio,将项目中的MPAndroidChart库从'com.github.PhilJay:MPAndroidChart:v2.25更新到'com.github.PhilJay:MPAndroidChart:v3.0.2后,出现一个错误,表明找不到类ValueFormatter。在进一步的研究中,似乎有人在maven repository artefact index上犯了一个错误,因为v2.2.5似乎是最新版本,而v3.0.2不是最新更新的版本我目前正在一个工作项目中使用此版本 implementati
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
对于X和Y的格式,我使用以下导入
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.formatter.IValueFormatter;
实现看起来像这样
public class MyValueFormatter implements IValueFormatter {
private DecimalFormat mFormat;
public MyValueFormatter() {
mFormat = new DecimalFormat("###,###,##0"); // use one decimal
}
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
// write your logic here
return mFormat.format(value) + ""; // e.g. append a dollar-sign
}
}
我目前正在工作项目中使用此版本
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
对于X和Y的格式,我使用以下导入
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.formatter.IValueFormatter;
实现看起来像这样
public class MyValueFormatter implements IValueFormatter {
private DecimalFormat mFormat;
public MyValueFormatter() {
mFormat = new DecimalFormat("###,###,##0"); // use one decimal
}
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
// write your logic here
return mFormat.format(value) + ""; // e.g. append a dollar-sign
}
}