Code Monkey home page Code Monkey logo

arrows's Introduction

Arrows - graph diagram library

JavaScript library for drawing diagrams of small graphs, using D3 to generate SVG. Useful for explaining Neo4j graph modelling concepts in presentations and blogs.

How do I use it?

Write HTML markup to express graph content and structure, then ask the library to render an SVG picture of the graph. Control geometry and styling by applying CSS to the markup.

The library you need is graph-diagram.js. It depends on D3, so you'll need that too.

Markup looks like this, enclosed in a <figure> tag:

<figure class="graph-diagram">
  <ul class="graph-diagram-markup">
    <li class="node" data-node-id="0" data-x="0" data-y="0">
      <span class="caption">A</span>
    </li>
    <li class="node" data-node-id="1" data-x="50" data-y="0">
      <span class="caption">B</span>
    </li>
    <li class="relationship" data-from="0" data-to="1">
      <span class="type">R</span>
    </li>
  </ul>
</figure>

See tests.html for examples of what you can do with markup and styling.

At the end of your page, or in a suitable event handler, call a bit of framework code:

<script type="text/javascript">
  d3.selectAll( "figure.graph-diagram" )
          .call( gd.figure() );
</script>

There's also a complete working example in example.html.

How do I draw a graph?

What? You can't hold x/y coordinates in your head and type the markup straight in? Don't worry, there's a graphical editor. It's in index.html. This whole repository is hosted by GitHub Pages, so you'll find the editor hosted at http://www.apcjones.com/arrows/.

Are there any limitations?

Yes, lots. Consider the current version experimental at best. There hasn't been any work on browser compatibility, so I'd be surprised if it works properly outside WebKit.

arrows's People

Watchers

 avatar  avatar

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.