Efficient data migration
I took some time to look at your code and rewrite it a little bit.

My first advice is, try to make your code a little bit more verbose. It will be only written once and read over and over. It's very important that the code communicates what it's supposed to do, either through variable naming or comments.
The Art Of Readable Code is a great book on this topic, thoroughly covered by "Implementation Patterns" as well.

So...you can try this out:

function newAlgorithm(data){
    // Intial row needs data for headers
    var newData = [['price', 'bid', 'ask']],
    // Optimizes for loops
    entriesCount = data.bids.length,
    // Will be calculcated later on
    bidAmountSum = 0,
    askAmountSum = 0,
    // Will contain all entries that should be pushed into the final array
    bidEntries = [],
    askEntries = [];

    // Calculate bid and ask sums
    for(var i = 0; i &lt; entriesCount; i++){
        bidAmountSum += data.bids[i][1];
        askAmountSum += data.asks[i][1];
    }

    // Create bid and ask entries for each one in one pass, since their count is the same
    for(var i = 0; i &lt; entriesCount; i++){
        // Pid price is iterated in reverse
        // Bid amount sum is cumulative sum of previous bids for each point in iteration
        bidEntries.push([data.bids[data.bids.length-1 - i][0], bidAmountSum, null]);
        bidAmountSum -= data.bids[i][1];

        // Price is iterated in forward order
        // Ask amount sum is cumulative sum of previous asks for each point in iteration
        askEntries.push([data.asks[i][0], null, askAmountSum]);
        askAmountSum -= data.asks[i][1];
    }

    return newData.concat(bidEntries).concat(askEntries.reverse());
}


I tested how it performs when tested with NodeJS runtime. I increased the dataset from 100 entries through 2,000,000.



I also made in-browser test here: http://jsperf.com/chart-data-repacking

I hope this helps.