ChatChart

From The Math Club

(Redirected from ASCII Graph Layout in Ruby)
Jump to: navigation, search

Contents

About

ChatChart is an ASCII Graph Layout and Drawing package of various crappy ruby code which generally revolves around ASCII drawing, graph layout, and some physics simulation. It is packaged up as a Ruby Gem. It does various layout methods similar to that of GraphViz. Currently Random Layout and a Molecular/Physics model are supported.

This is basically GraphViz for ASCII!

There are also demos of simple layout and graphics rendering, animated layout optimization and a physics particle field demo.

Video

Here's a video of the animated graph layout found on youtube:

ASCII Graph Layout Video

Graphics

Here's some output graphics

         d
         |
         |
         |
         |
         |------c
         a
         |
         |
         |
         |
        b+           +--name1
e-------+------q     |
        |            |
        |            |
        |            |
        |          +-institute
        w          |         C-I
                   |         |
                   |         |
                   |         |
                   S-I       |
                   |    code----course-name0
                   |       |
                   |       |
                   |       |
            grade  |       |
            +--+---+studentS-C
               |       |
               |       |
               |       |
               name2   |
                       number

Diatribe

What I find interesting about drawing in ASCII is that it is somewhat like drawing normal raster graphics, in that its somewhat similar to the R^2 space, but the concept of the pythagorean L2 norm is somewhat non-existant, in that the shortest path between two points in ASCII is not realy a straight line because, when limited to drawing lines in ASCII, you're stuck with |, -, \ and / and therefore a line of arbitrary slope isnt exactly possible. So you're stuck with alernative toplogies emited by either L1 norms or what I call the hockeystick norm, which is a path between two points composed of 45 degree angles made from slashes and straight lines from pipes and dashes.

Download

chatchart-1.0.0.tar.gz
chatchart-1.0.0.gem

or via Gem

gem install chatchart

Install

If you don't install via gem, then untar the archive and then type:

rake gem
cd pkg
install chatchart-1.0.0.gem


Examples

I'll include some basics here in a while. In the meantime, check out the demos at http://www.the-mathclub.net/site/code/chatchart-1.0.0/demos/ after you install the gem.

Personal tools