In my data, I have 2 sets of nested arrays:
var values = [[100, 87.5, 87.5, 87.5, 100, 100],
[87.5, 100, 100, 100, 87.5, 87.5],
[75, 75, 75, 75, 75, 75],
[50, 50, 50, 62.5, 62.5, 62.5],
[62.5, 62.5, 62.5, 50, 37.5, 50],
[0, 0, 0, 0, 0, 0]];
var date = [["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"]];
My goal is to combine each array in Values and Date like this:
Extract: [100, 87.5, 87.5, 87.5, 100, 100]
Extract: ["2015", "2004", "2015", "2015", "2015", "2015"]
Then merge them into one combined array as shown below:
[{y: 100, d: 2015},{y: 87.5, d: 2004},{y: 87.5, d: 2015},{y: 87.5, d: 2015},{y: 100, d: 2015},{y: 100, d: 2015}]
An example can be found here: https://jsfiddle.net/zidski/5808pgs4/3/
var result = values.map(function (n, i) {
return ({ y: n, d: values[i] });
});
However, the entire array ends up being added together.