我正在使用 GraphView 库,当我更新系列(或用新系列替换系列)时,我无法让图形自行重绘。当我触摸屏幕时,它似乎只会重新绘制自己。这是我的更新功能。
private void updateGraph(Animal a)
{
Toast.makeText(getApplicationContext(), "Updating Graph", Toast.LENGTH_SHORT).show();
GraphViewData[] newData = new GraphViewData[2];
newData[0] = new GraphViewData(0,a.getAvg());
newData[1] = new GraphViewData(1,0.2);
GraphViewSeries newSeries = new GraphViewSeries(a.getName(),dStyle,newData);
graph.removeSeries(exampleSeries);
graph.addSeries(newSeries);
//update horizontal value
//graph.setHorizontalLabels(new String[]{a.getName()});
}