I two have arrays
let arr1 = [1, 2, 3, 4, 5];
let arr2 = [6, 7, 8, 9, 0];
i created an object from them using .map
let labels = arr1.map(value => ({'y': value}));
let series = arr2.map(value => ({'x': value}));
and merged object using _.merge from lodash
let mergeData = _.merge({}, series2, labels2);
result looks similar to this:
{x: 1, y: 25},
{x: 2, y: 38},
{x: 3, y: 24},
{x: 4, y: 60},
{x: 5, y: 22}
Now what i would like to display is an array of objects (in this case it will display just one object inside array) which looks like one below:
graphs: [
{
label: 'area 1',
values: [
{x: 1, y: 25},
{x: 2, y: 38},
{x: 3, y: 24},
{x: 4, y: 60},
{x: 5, y: 22}
]
},
]
any ideas?
object['values']field?