【发布时间】:2019-01-22 16:36:55
【问题描述】:
【问题讨论】:
-
您的链接,页面几行,有一个
IAxisValueFormatter示例。这应该会有所帮助
【问题讨论】:
IAxisValueFormatter 示例。这应该会有所帮助
像这样使用 IAxisValueFormatter:
public class MyYAxisValueFormatter implements IAxisValueFormatter {
private SimpleDateFormat mFormat;
public MyAxisValueFormatter() {
// format values to 1 decimal digit
mFormat = new SimpleDateFormat("MMM dd");
}
@Override
public String getFormattedValue(float value, AxisBase axis) {
// "value" represents the position of the label on the axis (x or y)
return mFormat.format(value);
}
/** this is only needed if numbers are returned, else return 0 */
@Override
public int getDecimalDigits() { return 0; }
}
【讨论】: