Dynamically plot line graphs based on user input change in B4A

444 Views Asked by At

Is there a way to plot line graphs in B4A dynamically? What I mean is, taking inputs of two editbox where the first edit box would represent x axis value and the second edit box would represent y axis value, and with a button event the graph replots with the new values. And when the app starts it would always be a blank graph with no plots. I wrote a program in python using matplotlib which allows us to do such things, but here I could not find any example of how to proceed with the problem.

I get the part where we can plot a graph when the activity starts (MPAndroid Charts etc), but it seems to be static, I cannot understand how to redraw or insert new data (x/y values) to the existing graph when someone adds new values in an editbox and clicks a button.

Do we have any example code from where I can take reference from?

1

There are 1 best solutions below

0
Muhammad Saad Rafique On

It can be done in mpAndroidCharts. All you need to do is on button click you need to provide new values to dataset and after that you need to refresh your chart. For that you have to do as follow:

chart.notifyDataSetChanged();
chart.invalidate();