lib/index.js
function CliGraph(options) {

    // Initialize variables
    var self = this
      , settings = self.options = Ul.deepMerge(options, CliGraph.defaults)
      , i = 0
      , character = null
      , str = ""
      ;

    self.graph = [];
    settings.width *= settings.aRatio;

    // Set the center of the graph
    settings.center = Ul.merge(settings.center, {
        x: settings.width  / 2
      , y: settings.height / 2
    });

    settings.center.x = Math.round(settings.center.x);
    settings.center.y = Math.round(settings.center.y);

    // Background
    for (i = 0; i < settings.height; ++i) {
        self.graph[i] = new Array(settings.width).join(settings.marks.background).split("");
    }

    // Center
    self.graph[settings.center.y][settings.center.x] = settings.marks.center;

    // Ox axis
    for (i = 0; i < settings.width; ++i) {
        character = settings.marks.hAxis;
        if (i === settings.center.x) {
            character = settings.marks.center;
        } else if (i === settings.width - 1) {
            character = settings.marks.rightArrow;
        }

        self.graph[settings.center.y][i] = character;
    }

    // Oy asis
    for (i = 0; i < settings.height; ++i) {
        character = settings.marks.vAxis;
        if (i === settings.center.y) {
            character = settings.marks.center;
        } else if (i === 0) {
            character = settings.marks.topArrow;
        }

        self.graph[i][settings.center.x] = character;
    }

}
function CliGraph(options) {

    // Initialize variables
    var self = this
      , settings = self.options = Ul.deepMerge(options, CliGraph.defaults)
      , i = 0
      , character = null
      , str = ""
      ;

    self.graph = [];
    settings.width *= settings.aRatio;

    // Set the center of the graph
    settings.center = Ul.merge(settings.center, {
        x: settings.width  / 2
      , y: settings.height / 2
    });

    settings.center.x = Math.round(settings.center.x);
    settings.center.y = Math.round(settings.center.y);

    // Background
    for (i = 0; i < settings.height; ++i) {
        self.graph[i] = new Array(settings.width).join(settings.marks.background).split("");
    }

    // Center
    self.graph[settings.center.y][settings.center.x] = settings.marks.center;

    // Ox axis
    for (i = 0; i < settings.width; ++i) {
        character = settings.marks.hAxis;
        if (i === settings.center.x) {
            character = settings.marks.center;
        } else if (i === settings.width - 1) {
            character = settings.marks.rightArrow;
        }

        self.graph[settings.center.y][i] = character;
    }

    // Oy asis
    for (i = 0; i < settings.height; ++i) {
        character = settings.marks.vAxis;
        if (i === settings.center.y) {
            character = settings.marks.center;
        } else if (i === 0) {
            character = settings.marks.topArrow;
        }

        self.graph[i][settings.center.x] = character;
    }

}
function CliGraph ( options ) { // Initialize variables var self = this , settings = self . options = Ul . deepMerge ( options , CliGraph . defaults ) , i = 0 , character = null , str = "" ; self . graph = [ ] ; settings . width *= settings . aRatio ; // Set the center of the graph settings . center = Ul . merge ( settings . center , { x : settings . width / 2 , y : settings . height / 2 } ) ; settings . center . x = Math . round ( settings . center . x ) ; settings . center . y = Math . round ( settings . center . y ) ; // Background for ( i = 0 ; i < settings . height ; ++ i ) { self . graph [ i ] = new Array ( settings . width ) . join ( settings . marks . background ) . split ( "" ) ; } // Center self . graph [ settings . center . y ] [ settings . center . x ] = settings . marks . center ; // Ox axis for ( i = 0 ; i < settings . width ; ++ i ) { character = settings . marks . hAxis ; if ( i === settings . center . x ) { character = settings . marks . center ; } else if ( i === settings . width - 1 ) { character = settings . marks . rightArrow ; } self . graph [ settings . center . y ] [ i ] = character ; } // Oy asis for ( i = 0 ; i < settings . height ; ++ i ) { character = settings . marks . vAxis ; if ( i === settings . center . y ) { character = settings . marks . center ; } else if ( i === 0 ) { character = settings . marks . topArrow ; } self . graph [ i ] [ settings . center . x ] = character ; } }
CliGraph
Creates a new CliGraph instance.

Example:

```js
var g = new CliGraph();
```

@name CliGraph
@function
@param {Object} options An object containing the following fields:

- `height` (Number): The graph height (default: `40`).
- `width` (Number): The graph width (default: `60`).
- `aRatio` (Number): The horizontal aspect ratio (default: `2`).
- `center` (Object): An object containing:
- `x` (Number): The `x` origin (default: `width / 2`)
- `y` (Number): The `y` origin (default: `height / 2`)
- `marks` (Object): An object containing:
- `hAxis` (String): The character for drawing horizontal axis (default `"─"`).
- `vAxis` (String): The character for drawing vertical axis (default "│").
- `center` (String): The character for axis intersection (default `"┼"`).
- `point` (String): The character for drawing points (default `"•"`).
- `rightArrow` (String): The character for drawing the right arrow (default `"▶"`).
- `topArrow` (String): The character for drawing the top arrow (default `"▲"`).
- `background` (String): The background character (default `" "`).

@return {CliGraph} The CliGraph instance.
CliGraph Creates a new CliGraph instance .