处理数组数据
//array var array=[3,2,11,7,6,4,10,8,15];
最小值最大值d3.min(array)
d3.select("#min").text(d3.min(array));
d3.select("#max").text(d3.max(array));
中值与均值d3.median/mean
d3.select("#median").text(d3.median(array)); d3.select("#mean").text(d3.mean(array));
范围与求和d3.extent/sum
d3.select("#extent").text(d3.extent(array)); d3.select("#sum").text(d3.sum(array));
排序
d3.select("#asc").text(array.sort(d3.ascending)); d3.select("#dsc").text(array.sort(d3.descending));
时间: 2024-10-16 03:12:26