GithubHelp home page GithubHelp logo

kidtrainee / react-native-d3-tree-graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codesinghanoop/react-native-d3-tree-graph

0.0 1.0 1.0 510 KB

An implementation of d3 graph to construct flow chart(d3 topological graph(tree)).

License: MIT License

JavaScript 62.97% Python 8.41% Java 7.15% Objective-C 21.47%

react-native-d3-tree-graph's Introduction

react-native-d3-tree-graph

An implementation of d3 graph to construct flow chart(d3 topological graph(tree)).

Latest version Release note

  • Now images can be added in place of rectangles in all nodes.
  • Annoying issue with the previous version was collision between react-native-svg versions and it's resolved now.
  • New props are available to style node which will be included along with node object like below.
             name: "J",
             id: 12,
             imageUrl: { href: { uri: "https://facebook.github.io/react-native/docs/assets/favicon.png"}}, //new prop
             nodeImageStyle: { imageHeight: 60 , imageWidth: 60, opacity: 1 }, //new prop
             nodeTextStyle: { fontSize: 12 } //new prop
    }```
    
  • Example is upgraded to latest version of react native i.e 0.59.9 and react-native-svg i.e 9.5.1

A big thanks to SUI for giving me this idea of upgrading library to show images

**Try the example app

Getting Started

  • Step 1- npm install react-native-d3-tree-graph --save
  • Step 2 - npm install react-native-svg --save
  • Step 3- react-native link react-native-svg
  • Step 4- Build the project and watch the beauty.

Usage Note: For proper understanding see the example

import AwesomeHierarchyGraph from 'react-native-d3-tree-graph'

var root = {
    name: "",
    id: 1,
    hidden: true,
    children: [ {
            name: "Q",
            id: 16,
            no_parent: true
        }]
    }

var siblings = [{
    source: {
        id: 3,
        name: "C"
    },
    target: {
        id: 11,
        name: "K"
    }
 }]
 
export default class example extends Component {
  render() {
    return (
        <View style={styles.container}>
        <AwesomeHierarchyGraph
         root = {root}
         siblings = {siblings}
        />
       </View>
    );
  }

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

Properties

Name Type
root PropTypes.object
siblings propTypes.array

Todo list:-

  • Callbacks.

  • Add animation to the graph

  • Add test


Author

Anoop Singh (codesingh)
Email: [email protected]
Stack Overflow: codesingh(username)

License

MIT

react-native-d3-tree-graph's People

Contributors

codesinghanoop avatar

Watchers

 avatar

Forkers

mrekinox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.