Displaying a graph (not charts) in an android app
Asked Answered
D

1

6

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 ;)

Dayflower answered 4/12, 2012 at 16:33 Comment(2)
Can you add a little description here about the differences you need between a chart and a graph?Virile
You may refer to GraphViz, which is ope source for ideas on graph layout.Mantoman
D
3

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!

Dayflower answered 1/2, 2013 at 14:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.