As a Java & Android beginner I find it still hard to understand most documentations, but I think this can be solved easily by someone who knows what they are doing:
I'm using Graph View for Android Studio to build a simple graph. This is working good so far, but what I want to achieve is to set the last variable of my data array +1 or -1 by the push of a button.
So I generate a fixed dataset when the app starts:
private LineGraphSeries<DataPoint> mSeries1 = new LineGraphSeries<DataPoint>(new DataPoint[] {
new DataPoint(1, 1),
new DataPoint(2, 5),
new DataPoint(3, 3),
new DataPoint(4, 2),
new DataPoint(5, mCigCount)
});
where mCigCount is the variable I spoke of. It gets +1 or -1 by a button push, which does work already fine.
The problem is, how do I update my Graph so that the new value for mCigCount will be rendered correctly after the button push?
This tutorial does it in a complicated way with some random numbers and updates every second, which is still way too confusing for me. It also mentions the methods resetData and appendData on which I fail to use correctly, because I dont understand what I have to put inside the (...):
mSeries1.resetData(...);
mSeries1.appendData(...);
How can I adress my last data point and update the mCigCount in it?