I've been looking all over stackoverflow for something to help me implement an AreaChart. The problem is that I have something like this.
var items = new Array();
if ($(result).find('dato').length > 0 ) {
items = ["Date", "Kg Emitted", "Kg Reduced"];
$(result).find('dato').each(
function (i) {
var item = new Array();
var date = $(this).find("fecha").first().text();
var kge = parseInt($(this).find("emitido").first().text());
var kgr = parseInt($(this).find("reducido").first().text());
item = [date,kge,kgr];
items.push.apply(items, item)
}
);
};
The problem is that I need it in a format like:
items = ["Date","Kg Emitted", "Kg reduced"], [2013-01-01, 3, 4], [2013-01-02, 1, 3], etc
I would appreciate any help on how to format this nested array, because so far I've tried items.push.apply(items, item)
, but it doesn't seem to work.