src/datab-data.js
function( matrix )
{

    // default to empty 2d array
    if ( typeof( matrix ) == "undefined" )
	var matrix = [];	// zero rows

    // store rows for O(n) retrieval after initial
    // operation. sacrifices memory efficiency
    this.__rows = matrix;
    this.__cols = d3.transpose(matrix);

    // get the default index of an array of rows or cols
    var index_arr = function(arr){

	// otherwise, return an array of integers (as strings)
	return d3.range(arr.length)
	    .map(function(a){
		return String(a);
	    });
    }

    // create the default indexes
    this.__index = {
	"row" : index_arr(this.__rows),
	"col" : index_arr(this.__cols)
    };

    this.rows = function() { return this.__rows; };
    this.cols = function() { return this.__cols; };
    
    return this;
}
function( matrix )
{

    // default to empty 2d array
    if ( typeof( matrix ) == "undefined" )
	var matrix = [];	// zero rows

    // store rows for O(n) retrieval after initial
    // operation. sacrifices memory efficiency
    this.__rows = matrix;
    this.__cols = d3.transpose(matrix);

    // get the default index of an array of rows or cols
    var index_arr = function(arr){

	// otherwise, return an array of integers (as strings)
	return d3.range(arr.length)
	    .map(function(a){
		return String(a);
	    });
    }

    // create the default indexes
    this.__index = {
	"row" : index_arr(this.__rows),
	"col" : index_arr(this.__cols)
    };

    this.rows = function() { return this.__rows; };
    this.cols = function() { return this.__cols; };
    
    return this;
}
function ( matrix ) { // default to empty 2d array if ( typeof ( matrix ) == "undefined" ) var matrix = [ ] ; // zero rows // store rows for O(n) retrieval after initial // operation. sacrifices memory efficiency this . __rows = matrix ; this . __cols = d3 . transpose ( matrix ) ; // get the default index of an array of rows or cols var index_arr = function ( arr ) { // otherwise, return an array of integers (as strings) return d3 . range ( arr . length ) . map ( function ( a ) { return String ( a ) ; } ) ; } // create the default indexes this . __index = { "row" : index_arr ( this . __rows ) , "col" : index_arr ( this . __cols ) } ; this . rows = function ( ) { return this . __rows ; } ; this . cols = function ( ) { return this . __cols ; } ; return this ; }
create a data object from a two-dimensional array
@constructor
@arg matrix - a matrix (2d-array) of the table
create a data object from a two - dimensional array