生成图表可以用 echarts 之类的
单纯计算的话就是遍历呗,看上去你把 key 向下取整,然后 value 取最大值,赋值保存即可
[
[1.1,2],
[1.1,3],
[1.1,4],
[1.1,5],
[1.1,4],
[1.9,1],
[1.3,2],
[1.3,3],
[1.3,4],
[1.3,5],
[1.3,4],
[1.3,1],
[1.3,2],
[1.3,3],
[3.3,4],
[1.3,5],
[5.3,4],
[1.3,1],
[9.9,1]
].reduce((s, v)=>{
key = v[0]>>0;
s[key] = Math.max(s[key] || 0, v[1])
return s
},{})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…