Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying a graph (not charts) in an android app

I want to display a small (n < 50) undirected graph (not a chart) in an Activity. I did a bit of research and it looks like their are a couple of libraries to display charts, but none to display real graphs. So it looks like I need to roll out my own solution. My very rough plan looks like this:

  • create and in memory representation of the graph
  • layout the graph nodes and edges so it looks nice
  • write a view that implements pinch and zoom
  • draw the graph

Are their any libraries I could use to help in some of these steps (maybe except the first one, this is really simple). Especially the "layout" part is something I would like to avoid. The "looks nice" requirement is mostly optional as long as the graph is displayed somehow readable. but since I'm part time perfectionist I would love to have it in ;)

like image 728
Martin Thurau Avatar asked Dec 04 '12 16:12

Martin Thurau


1 Answers

I solved it eventually by using a WebView that displays a HTML page, that uses the Dracula Graph Library. I transfer the data to the WebView by a Java function that was called from Javascript (on page load) that encoded the data as JSON. Not fancy, but it worked!

like image 160
Martin Thurau Avatar answered Nov 11 '22 22:11

Martin Thurau