我使用 GraphView 库来绘制图形是 android。它工作正常。滚动和缩放部分也可以工作。但是,我在 X 轴上使用了时间标签。我可以使用 CustomLabelFormatter 显示日期,但想进一步改进它。最初,应仅沿 X 轴显示日期。进一步放大显示小时,进一步放大显示分钟。我还想控制缩放,即在特定点之后不放大。这就是我现在所拥有的:
graphView.setCustomLabelFormatter(new CustomLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX) {
// TODO Auto-generated method stub
if (isValueX) {
Date d = new Date((long) value);
return (dateFormat.format(d));
}
return null;
}
});
标签格式为:May 08 09:20