1.4.1 • Published 6 years ago

graph-viewer v1.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

graph-viewer

An interactive player/viewer of graphs (mind maps)

Alt Text

NPM JavaScript Style Guide

Install

npm install --save graph-viewer
yarn add graph-viewer

Usage

import React, { Component } from 'react'

import GraphViewer from 'graph-viewer'

export default class App extends Component {
  render () { 
    const graph = {
            align: { h: "left", v: "top" },
            edges: [[0, 1], [1, 2]],
            nodes: [
              { content: "Unveil", x: 30, y: 20 },
              { content: "the", x: 160, y: 45 },
              { content: "unseen", x: 50, y: 80 }
            ]
          };
    
    return <GraphViewer graph={graph} />    
  }
}

or

import React, { Component } from 'react'

import GraphViewer from 'graph-viewer'

export default class App extends Component {
  render () {
    const graph = {
            align: { h: "left", v: "top" },
            edges: [[0, 1], [1, 2]],
            nodes: [
              { content: "Unveil", x: 30, y: 20 },
              { content: "the", x: 160, y: 45 },
              { content: "unseen", x: 50, y: 80 }
            ]
          };
       
    return (
      <GraphViewer graph={graph}>
        {(viewer) => {
          const { frame, replay } = viewer;
          return (
            <Fragment>
              { frame === 0 && <p>Tap or scroll to reveal the graph!</p> }
              <button onClick={replay}>Replay</button>
            </Fragment>
          )
        }}
      </GraphViewer>
    )
  }
}

License

MIT © optimista

1.4.1

6 years ago

1.4.0

6 years ago

1.3.12

6 years ago

1.3.11

6 years ago

1.3.10

6 years ago

1.3.9

6 years ago

1.3.8

6 years ago

1.3.7

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago