سؤال

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

هل كانت مفيدة؟

المحلول

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!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top