function computeBaseline(data) {
    var layerNum = data.length;
    var pointNum = data[0].length;
    var sums = [];
    var y0 = [];
    var max = 0;
    var temp;
    var base = {};

    for (var i = 0; i < pointNum; ++i) {
        for (var j = 0, temp = 0; j < layerNum; ++j) {
            temp += data[j][i][1];
        }
        if (temp > max) {
            max = temp;
        }
        sums.push(temp);
    }

    for (var k = 0; k < pointNum; ++k) {
        y0[k] = (max - sums[k]) / 2;
    }
    max = 0;

    for (var l = 0; l < pointNum; ++l) {
        var sum = sums[l] + y0[l];
        if (sum > max) {
            max = sum;
        }
    }
    base.y0 = y0;
    base.max = max;

    return base;
}
function computeBaseline(data) {
    var layerNum = data.length;
    var pointNum = data[0].length;
    var sums = [];
    var y0 = [];
    var max = 0;
    var temp;
    var base = {};

    for (var i = 0; i < pointNum; ++i) {
        for (var j = 0, temp = 0; j < layerNum; ++j) {
            temp += data[j][i][1];
        }
        if (temp > max) {
            max = temp;
        }
        sums.push(temp);
    }

    for (var k = 0; k < pointNum; ++k) {
        y0[k] = (max - sums[k]) / 2;
    }
    max = 0;

    for (var l = 0; l < pointNum; ++l) {
        var sum = sums[l] + y0[l];
        if (sum > max) {
            max = sum;
        }
    }
    base.y0 = y0;
    base.max = max;

    return base;
}
function computeBaseline ( data ) { var layerNum = data . length ; var pointNum = data [ 0 ] . length ; var sums = [ ] ; var y0 = [ ] ; var max = 0 ; var temp ; var base = { } ; for ( var i = 0 ; i < pointNum ; ++ i ) { for ( var j = 0 , temp = 0 ; j < layerNum ; ++ j ) { temp += data [ j ] [ i ] [ 1 ] ; } if ( temp > max ) { max = temp ; } sums . push ( temp ) ; } for ( var k = 0 ; k < pointNum ; ++ k ) { y0 [ k ] = ( max - sums [ k ] ) / 2 ; } max = 0 ; for ( var l = 0 ; l < pointNum ; ++ l ) { var sum = sums [ l ] + y0 [ l ] ; if ( sum > max ) { max = sum ; } } base . y0 = y0 ; base . max = max ; return base ; }
Compute the baseLine of the rawdata
Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics

@param  {Array.<Array>} data  the points in each layer
@return {Object}
Compute the baseLine of the rawdata Inspired by Lee Byron s paper Stacked Graphs - Geometry & Aesthetics
Computes the baseline of the given data