-
Notifications
You must be signed in to change notification settings - Fork 310
Description
var datas = [98, 97.69, 98.95, 98.15, 96.79, 99.8, 98.45, 91.72, 92.46, 98.68, 97.8, 97.71, 98.23, 99.28, 98.73, 99.18, 99.84, 99.47, 87.2, 98.89, 98.46, 97.69, 99.22, 98.4, 99.37, 96.53, 94.86, 78.02, 99.67, 71.25, 92.27, 100, 97.49, 99.25, 95.14, 96.81, 92.03, 95.63, 96.98, 91.72, 47.66, 99.97, 99.8, 99.97, 99.84, 99.57, 99.7, 99.78, 99.93, 97.89, 96.56, 66.1, 91.14, 81.42, 94.84, 98.61, 84.32, 40.2, 98.64, 97.06, 95.9, 90.66, 86.47, 92.71, 98.13, 34.19, 53.47, 56.97, 73.09, 60.07, 85.26, 38.63, 54.93, 91.78, 84.35, 94.58, 91.32, 87.14, 68.9, 37.53, 45.07, 89.61]
// 这个是百分数,里面有一个通过率是100%
var bins = ecStat.histogram(datas);
/*结果
0: (2) [33, 1]
1: (2) [38, 2]
2: (2) [43, 1]
3: (2) [48, 2]
4: (2) [53, 2]
5: (2) [58, 1]
6: (2) [63, 1]
7: (2) [68, 2]
8: (2) [73, 2]
9: (2) [78, 1]
10: (2) [83, 3]
11: (2) [88, 5]
12: (2) [93, 13]
13: (2) [98, 45]
14: (2) [103, 1] 《==== 这个就尴尬了 , 柱状图上会出现一个超过100%的存在 Orz
*/
var myChart = echarts.init(window.document.getElementById('chart'));
var option = {
title: {
text: '',
left: 'center',
top: 5
},
color: ['rgb(25, 183, 207)'],
grid: {
left: '1.5%',
right: '1.5%',
bottom: '01.5%',
containLabel: true
},
xAxis: [{
type: 'value',
scale: true,
}],
yAxis: [{
type: 'value',
}],
series: [{
name: 'height',
type: 'bar',
barWidth: '99.3%',
label: {
normal: {
show: true,
position: 'insideTop',
formatter: function (params) {
return params.value[1];
}
}
},
data: bins.data
}]
};
myChart.setOption(option);
})
// 而且最终的图表按示例绘制后,x轴还是有一定概率出现对不齐的现象。。
// 求大佬看一下