I am trying to get max value from all 'value' property. Following code giving max value as 8, where as max value in data is 60.
How to get correct maximum value for the following data?
data = [
{ type: "type1", value: "60" },
{ type: "type2", value: "38" },
{ type: "type3", value: "4" },
{ type: "type4", value: "5" },
{ type: "type5", value: "8" },
{ type: "type6", value: "2" },
];
console.log(
d3.max(data, (d) => {
return d.value;
})
);// expecting 60 but getting 8
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>