Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar Graph is not updating (Graph is not dynamic) #54

Open
akshatbhuhagal opened this issue Aug 28, 2023 · 1 comment
Open

Bar Graph is not updating (Graph is not dynamic) #54

akshatbhuhagal opened this issue Aug 28, 2023 · 1 comment

Comments

@akshatbhuhagal
Copy link

Hey Suyash,

If i try to change bar graph value second time then it's not updating, Initially it's creating graph and perfectly showing graph but when i try to update or change the value then it's not updating. For ex.

Initial Graph

BarGraph barGraph = findViewById(R.id.barGraph);
ArrayList<DataPoint> points = new ArrayList<>();

points.add(new DataPoint("Jan", 10, getResources().getColor(R.color.brown)));
points.add(new DataPoint("Feb", 5, getResources().getColor(R.color.brown)));

barGraph.setPoints(points);

While Updating Graph on click of button (which is not working)

BarGraph barGraph = findViewById(R.id.barGraph);
ArrayList<DataPoint> points = new ArrayList<>();

points.add(new DataPoint("Jan", 0, getResources().getColor(R.color.brown)));
points.add(new DataPoint("Feb", 3, getResources().getColor(R.color.brown)));

barGraph.setPoints(points);

Assign this issue to me so i can create pull request as i already fixed this issue

@akshatbhuhagal
Copy link
Author

Answer :-

In BarGraph.java file there is function called onDraw() and inside that function you have to change the value of initflg from initflg = true; to initflg = false; then Graph will update everytime it gets data from API response or any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant