We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
###求四分位数错误
var data = echarts.dataTool.prepareBoxplotData([ [5.61,5.28,5.12,5.06,4.96,4.65,3.74,3.28,3.22,2.63,2.58,1.36,1.34,1.29,1.22,1.04,1,0.95,0.94,0.82,0.67,0.52,0.44,0.43,0.43,0.35,0.33,0.29,0.2,0.19,0.17,0.13,0.12,0.1,0.01,0.01], [6.61,6.27,5.44,5.37,5.26,5.23,4.62,3.76,2.1,1.83,1.66,1.59,1.44,1.36,1.32,1.25,1.22,1.09,0.76,0.73] ]);
生成的箱线图如下,为何会存在负值,而且最大值和最小值都不对。
option = { title: [ { text: 'Michelson-Morley Experiment', left: 'center', }, { text: 'upper: Q3 + 1.5 * IRQ \nlower: Q1 - 1.5 * IRQ', borderColor: '#999', borderWidth: 1, textStyle: { fontSize: 14 }, left: '10%', top: '90%' } ], tooltip: { trigger: 'item', axisPointer: { type: 'shadow' } }, grid: { left: '10%', right: '10%', bottom: '15%' }, xAxis: { type: 'category', data: data.axisData, boundaryGap: true, nameGap: 30, splitArea: { show: false }, axisLabel: { formatter: 'expr {value}' }, splitLine: { show: false } }, yAxis: { type: 'value', name: 'km/s minus 299,000', splitArea: { show: true } }, series: [ { name: 'boxplot', type: 'boxplot', data: data.boxData, tooltip: { formatter: function (param) { return [ 'Experiment ' + param.name + ': ', 'upper: ' + param.data[4], 'Q3: ' + param.data[3], 'median: ' + param.data[2], 'Q1: ' + param.data[1], 'lower: ' + param.data[0] ].join('<br/>') } } }, { name: 'outlier', type: 'scatter', data: data.outliers } ] }
The text was updated successfully, but these errors were encountered:
prepareBoxplotData 这个工具方法参考了:https://en.wikipedia.org/wiki/Box_plot,其中, boxplot 的 两个『须』的端点有几个可能的定义,比如,
prepareBoxplotData
可以是 Q1 - 1.5 * IQR 和 Q3 + 1.5 * IQR prepareBoxplotData 默认情况下,采用这种定义,也就是说,echarts.dataTool.prepareBoxplotData([ ... ]) 可能出现负值。
Q1 - 1.5 * IQR
Q3 + 1.5 * IQR
echarts.dataTool.prepareBoxplotData([ ... ])
可以是『最大最小值』 echarts.dataTool.prepareBoxplotData([ ... ], {boundIQR: 'none'}) 则使用这种定义,不会出现负值。
echarts.dataTool.prepareBoxplotData([ ... ], {boundIQR: 'none'})
Sorry, something went wrong.
@100pah 之后我看了源码默认是这样算的,我还以为源码那边判断写反了呢。没想到箱线图还有多种算法,学习了,谢谢🙏!
No branches or pull requests
###求四分位数错误
生成的箱线图如下,为何会存在负值,而且最大值和最小值都不对。

Version & Environment [版本及环境]
Expected behaviour [期望结果]
ECharts option [ECharts配置项]
Other comments [其他信息]
The text was updated successfully, but these errors were encountered: