0

How do I use data I got from an API in a GraphView?

I don't need an API example, just show this data, for example

new DataPoint(0, 3)
new DataPoint(1, 3)
new DataPoint(2, 6)
new DataPoint(3, 2)
new DataPoint(4, 5)

And how do store/retrieve the data from a database?

Anyone have any examples of GraphView?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Zi Liang
  • 1
  • 1
  • What library for GraphView are you using? Asking for links to examples is off topic for StackOverflow. Please provide a [mcve] of the problem – OneCricketeer Jul 31 '16 at 15:03
  • This? http://www.android-graphview.org/documentation/how-to-create-a-simple-graph – OneCricketeer Jul 31 '16 at 15:04
  • thank for reply...i use the library jjoe64 like what u mention.i gt create a array call graphview_data in the API.and my value just like 5 top total score student only.at x-axis is student and y-axis is the total score. You got any similar example for this type of coding or any link can let me to refer? @cricket_007 – Zi Liang Jul 31 '16 at 15:11
  • I don't have a link, and I trust your ability to search the Internet and find examples. As the answer below states. You need some arraylist of data points to store your data. Once you have that, you can plot them – OneCricketeer Jul 31 '16 at 15:13

1 Answers1

0

Well First You understand the Data consumer and producer Entities. In Your case one is database (which has data to plotted ) - Producer and the other one is consumer(Graph Engine).

Now Your job is to write mediator between the Database and Graph Engine. The mediator should read all the values data base and create Array of data points, set it to give it Graph Engine to render. Unfortunately there is no other way, You should have to populate all the data points from the values that you have read from the DB.

Sush
  • 3,864
  • 2
  • 17
  • 35
  • sush... i gt create a array call graphview_data in the API.and my value just like 5 top total score student only.at x-axis is student and y-axis is the total score. You got any similar example for this type of coding or any link can let me to refer? sush – Zi Liang Jul 31 '16 at 15:00
  • http://www.survivingwithandroid.com/2014/06/android-chart-tutorial-achartengine.html... You need Create data points with your values – Sush Jul 31 '16 at 15:03