I'm working on an app that uses GraphView. Users can scale the graph (zoom in, zoom out), and they can use a 'reset zoom' button to reset to the default view they get when they open the graph. I got it working, but the graph doesn't update when I press the button. Only if I press the button THEN scroll the graph will it reset to the default zoom. I was looking for redraw() or refresh() methods to fix it, but nothing's worked so far. Here's my code:
resett.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//set manual X bounds
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(-10);
graph.getViewport().setMaxX(10);
// set manual Y bounds
graph.getViewport().setYAxisBoundsManual(true);
graph.getViewport().setMinY(-15);
graph.getViewport().setMaxY(15);
graph.refreshDrawableState();
}
});
Any leads?