I would like to get the hightest value of array (only the 'y'), how can I do that?
I'm getting only the value of array setting into[]
like values[0]
data = [
{
values: [
{ x:'2017-01', y: 1.2 },
{ x:'2017-02', y: 1.3 },
{ x:'2017-03', y: 1.5 },
{ x:'2017-04', y: 1.6 },
{ x:'2017-05', y: 1.8 },
{ x:'2017-06', y: 1.9 },
{ x:'2017-07', y: 1.5 },
{ x:'2017-08', y: 1.7 },
{ x:'2017-09', y: 1.5 },
{ x:'2017-10', y: 0 }
]
}
];
data.forEach(function(d) {
console.log(Math.max(d.values[0].y));
});