echarts-gl
echarts-gl copied to clipboard
关于3D散点图中散点的 mouseout 事件响应不及时的bug
问题描述
3D散点图中散点的 mouseout 事件响应不及时
bug重现
官方demo: https://echarts.apache.org/examples/zh/editor.html?c=scatter3D-dataset&gl=1 替换如下代码
$.get(ROOT_PATH + '/data/asset/data/life-expectancy-table.json', function (data) {
var symbolSize = 6.5;
option = {
grid3D: {},
xAxis3D: {
type: 'category'
},
yAxis3D: {},
zAxis3D: {},
dataset: {
dimensions: [
'Income',
'Life Expectancy',
'Population',
'Country',
{name: 'Year', type: 'ordinal'}
],
source: data
},
series: [
{
type: 'scatter3D',
symbolSize: symbolSize,
encode: {
x: 'Country',
y: 'Life Expectancy',
z: 'Income',
tooltip: [0, 1, 2, 3, 4]
}
}
]
};
myChart.setOption(option);
myChart.on('mouseout', console.log); // 重点
});
问题排查
如下位置的判断有误,dataIndex
值是undefined
,但在JS中undefined
和null
是相等的,因此导致事件未抛出!
https://github.com/ecomfe/echarts-gl/blob/dfede597d062b75648065b59d465168d377eadc1/src/core/LayerGL.js#L622