i have two array
the first one is
lineChart = [{type : 'line' , data : arrdata }] ;
second one is
mina = [{type : 'area' , data : [[1326844575000,10] ,[1326845955000,10]], color : 'H33FF00'},
{type : 'area' , data : [[1326846575000,10] ,[1326848065000,10]], color : 'H33FF00'},
{type : 'area' , data : [[1326848390000,10] ,[1326849755000,10]], color : 'H33FF00'} ];
when i push them together like :
mychart.push(lineChart);
mychart.push(mina);
console.log(JSON.stringify(mychart)) ;
this is what i get
[{"type":"line","data":[]},[{"type":"area","data":[[1326844575000,10],[1326845955000,10]],"color":"H33FF00"},{"type":"area","data":[[1326846575000,10],[1326848065000,10]],"color":"H33FF00"},{"type":"area","data":[[1326848390000,10],[1326849755000,10]],"color":"H33FF00"}]]
My question is: How to make this result array as one array like this?
[{"type":"line","data":[]},{"type":"area","data":[[1326844575000,10],[1326845955000,10]],"color":"H33FF00"},{"type":"area","data":[[1326846575000,10],[1326848065000,10]],"color":"H33FF00"},{"type":"area","data":[[1326848390000,10],[1326849755000,10]],"color":"H33FF00"}]
Just push the first object into the array.
mina.push(linechart);Also, if you specifically want the linechart at the beginning use
mina.unshift(linechart);http://jsfiddle.net/E2WT8/