All Projects → oss-bandb → GraphView

oss-bandb / GraphView

Licence: Apache-2.0 License
Android GraphView is used to display data in graph structures.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to GraphView

Graphview
Android GraphView is used to display data in graph structures.
Stars: ✭ 918 (-3.57%)
Mutual labels:  view, tree-structure, treeview
Bosket
Collection of tree view components for front-end frameworks. 🌳
Stars: ✭ 457 (-52%)
Mutual labels:  tree-structure, treeview
Treeview
An android tree structure view with high performance and rich features
Stars: ✭ 429 (-54.94%)
Mutual labels:  tree-structure, treeview
Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (-84.03%)
Mutual labels:  tree-structure, treeview
Ete
Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
Stars: ✭ 506 (-46.85%)
Mutual labels:  tree-structure, treeview
Bstreeview
Bootstrap Treeview, A very simple plugin to build a basic and elegant Treeview with bootstrap 4. See the demo:
Stars: ✭ 308 (-67.65%)
Mutual labels:  tree-structure, treeview
Pbtreeview
An UITreeView implementation from UITableView that Apple missed in its UIKit framework. And it is in pure Swift.
Stars: ✭ 128 (-86.55%)
Mutual labels:  tree-structure, treeview
Vue Draggable Nested Tree
Please use the he-tree-vue, vue-draggable-nested-tree will no longer be maintained.
Stars: ✭ 302 (-68.28%)
Mutual labels:  tree-structure, treeview
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-98.11%)
Mutual labels:  tree-structure, treeview
Unity-IMGUI-TreeView
Simple Tree View implementation for IMGUI (Editor GUI) in Unity. Includes a special type for working with asset paths, but base data structure and view can be easily extended to support anything.
Stars: ✭ 73 (-92.33%)
Mutual labels:  tree-structure, treeview
Perfect-Server-Side-Swift iOS-App
A family tree API server implementation with iOS client. Server has been implemented with Perfect: Server-Side Swift And iOS client is in pure Swift.
Stars: ✭ 15 (-98.42%)
Mutual labels:  tree-structure, treeview
react-folder-tree
A versatile react treeview library that supports custom icons and event handlers
Stars: ✭ 56 (-94.12%)
Mutual labels:  tree-structure, treeview
react-tree
Hierarchical tree component for React in Typescript
Stars: ✭ 174 (-81.72%)
Mutual labels:  tree-structure, treeview
react-treefold
A renderless tree component for your hierarchical React views
Stars: ✭ 37 (-96.11%)
Mutual labels:  tree-structure, treeview
KoHighlights
KOHighlights is a utility for viewing KOReader's highlights and/or export them to simple text, csv or html files.
Stars: ✭ 62 (-93.49%)
Mutual labels:  view
SlideNavigation
🐢 类似‘今日头条顶部导航栏跟手势滑动’效果
Stars: ✭ 18 (-98.11%)
Mutual labels:  view
react-super-treeview
👏 Finally, a React Treeview component which is customizable on every level
Stars: ✭ 98 (-89.71%)
Mutual labels:  treeview
RoundProgressBar
一个自定义的圆形可颜色渐变的ProgressBar
Stars: ✭ 32 (-96.64%)
Mutual labels:  view
MultiStateToggleButton
Android's ToggleButton offers only two states, MultiStateToggleButton fixes this by offering as many states depending on the number of drawable resources passed in.
Stars: ✭ 20 (-97.9%)
Mutual labels:  view
RegulatorView
Intelligent furniture remote control
Stars: ✭ 20 (-97.9%)
Mutual labels:  view

GraphView

Android GraphView is used to display data in graph structures.

alt Logo

Overview

The library can be used within RecyclerView and currently works with small graphs only.

This project is currently experimental and the API subject to breaking changes without notice.

Download

The library is only available on MavenCentral. Please add this code to your build.gradle file on project level:

allprojects {
  repositories {
    ...
    mavenCentral()
  }
}

And add the dependency to the build.gradle file within the app module:

dependencies {
    implementation 'dev.bandb.graphview:graphview:0.8.1'
}

Layouts

Tree

Uses Walker's algorithm with Buchheim's runtime improvements (BuchheimWalkerLayoutManager class). Currently only the TreeEdgeDecoration can be used to draw the edges. Supports different orientations. All you have to do is using the BuchheimWalkerConfiguration.Builder.setOrientation(int) with either ORIENTATION_LEFT_RIGHT, ORIENTATION_RIGHT_LEFT, ORIENTATION_TOP_BOTTOM and ORIENTATION_BOTTOM_TOP (default). Furthermore parameters like sibling-, level-, subtree separation can be set.

Directed graph

Directed graph drawing by simulating attraction/repulsion forces. For this the algorithm by Fruchterman and Reingold (FruchtermanReingoldLayoutManager class) was implemented. To draw the edges you can use ArrowEdgeDecoration or StraightEdgeDecoration.

Layered graph

Algorithm from Sugiyama et al. for drawing multilayer graphs, taking advantage of the hierarchical structure of the graph (SugiyamaLayoutManager class). Currently only the SugiyamaArrowEdgeDecoration can be used to draw the edges. You can also set the parameters for node and level separation using the SugiyamaConfiguration.Builder.

Usage

GraphView must be integrated with RecyclerView. For this you’ll need to add a RecyclerView to your layout and create an item layout like usually when working with RecyclerView.

<com.otaliastudios.zoom.ZoomLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:hasClickableChildren="true">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</com.otaliastudios.zoom.ZoomLayout>

Currently GraphView must be used together with a Zoom Engine like ZoomLayout. To change the zoom values just use the different attributes described in the ZoomLayout project site.

To create a graph, we need to instantiate the Graph class. Next submit your graph to your Adapter, for that you must extend from the AbstractGraphAdapter class.

private void setupGraphView {
    val recycler = findViewById(R.id.recycler)

    // 1. Set a layout manager of the ones described above that the RecyclerView will use.
    val configuration = BuchheimWalkerConfiguration.Builder()
                    .setSiblingSeparation(100)
                    .setLevelSeparation(100)
                    .setSubtreeSeparation(100)
                    .setOrientation(BuchheimWalkerConfiguration.ORIENTATION_TOP_BOTTOM)
                    .build()
    recycler.layoutManager = BuchheimWalkerLayoutManager(context, configuration)

    // 2. Attach item decorations to draw edges
    recycler.addItemDecoration(TreeEdgeDecoration())

    // 3. Build your graph
    val graph = Graph()
    val node1 = Node("Parent")
    val node2 = Node("Child 1")
    val node3 = Node("Child 2")

    graph.addEdge(node1, node2)
    graph.addEdge(node1, node3)

    // 4. You will need a simple Adapter/ViewHolder.
    // 4.1 Your Adapter class should extend from `AbstractGraphAdapter`
    adapter = object : AbstractGraphAdapter<NodeViewHolder>() {

        // 4.2 ViewHolder should extend from `RecyclerView.ViewHolder`
        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NodeViewHolder {
            val view = LayoutInflater.from(parent.context)
                    .inflate(R.layout.node, parent, false)
            return NodeViewHolder(view)
        }

        override fun onBindViewHolder(holder: NodeViewHolder, position: Int) {
            holder.textView.text = getNodeData(position).toString()
        }
    }.apply {
        // 4.3 Submit the graph
        this.submitGraph(graph)
        recycler.adapter = this
    }
}

Customization

You can change the edge design by supplying your custom paint object to your edge decorator.

    val edgeStyle = Paint(Paint.ANTI_ALIAS_FLAG).apply {
        strokeWidth = 5f
        color = Color.BLACK
        style = Paint.Style.STROKE
        strokeJoin = Paint.Join.ROUND
        pathEffect = CornerPathEffect(10f) 
    }
    
    recyclerView.addItemDecoration(TreeEdgeDecoration(edgeStyle))

If you want that your nodes are all the same size you can set useMaxSize to true. The biggest node defines the size for all the other nodes.

    recyclerView.layoutManager = BuchheimWalkerLayoutManager(this, configuration).apply { 
        useMaxSize = true
    }

Examples

Rooted Tree

alt Example

Directed Graph

alt Example

Layered Graph

alt Example

License

Copyright 2019 - 2021 Block & Block

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].