/Forcelayout

Forcelayout is library for android. You can drawing graph with spring-like attractive forces.

Primary LanguageJavaApache License 2.0Apache-2.0

Force layout

Android Arsenal License Download

Forcelayout is an Android library for visualizing data. You can drawing graph with spring-like attractive forces.

Demo

image

image

Usage

1. Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'jp.kai:forcelayout:1.0.3'
}

2. Definitions of nodes

HashMap<String, Integer> nodes = new HashMap<>();

nodes.put("labelname_1",R.drawable.example1);
nodes.put("labelname_2",R.drawable.example2);

3. Definitions of links

List<String> links = new ArrayList<String>();

links.put("labelname_1-labelname_2");

4. Set nodes and links

You can set node's size and linkstrength, and so on.

Forcelayout.with(this)
	.nodesize(200)
	.linkStrength(0.1)
	.distance(200)
	.gravity(0.04)
	.nodes(nodes)
	.links(links);

Thanks

Inspired by force layout in D3.js.

##License

Copyright 2016 kai0masanari

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.