Open usernameistolong opened 2 years ago
如果有一类横轴数据,悬浮到横轴上时,悬浮显示的数据错乱。 这是配置: let option = { tooltip: {}, xAxis3D: { type: 'category', data: [0,1,2,3], }, yAxis3D: { type: 'category', data: ['2021-01-01','2021-01-02'], }, zAxis3D: { }, grid3D: { }, series: [ { type: 'line3D', name: '2021-01-01', data: [[0,'2021-01-01',0.5],[1,'2021-01-01',0.2],[2,'2021-01-01',0.8]] }, { type: 'line3D', name: '2021-01-02', data: [[0,'2021-01-02',0.1],[1,'2021-01-02',0.3],[2,'2021-01-02',-0.1]] }, { type: 'line3D', name: '峰值', data: [[3,'2021-01-01',0.1],[3,'2021-01-02',0.3]] }, ] } let echartsInstance = echarts.init(document.getElementById('tu')) echartsInstance.setOption(option, true) 这是效果图:
@nwind @pedrolamas @leeight @cnberg 我是个菜鸡,有没有大佬指点一下o(╥﹏╥)o
The problem is on this line
data: [[3,'2021-01-01',0.1], [3,'2021-01-02',0.3]]
both points have the same name '3', this is why you get the hover auto-display going to the first point only. By giving a new name('4') to the second point, problem is fixed. Demo Code
如果有一类横轴数据,悬浮到横轴上时,悬浮显示的数据错乱。 这是配置: let option = { tooltip: {}, xAxis3D: { type: 'category', data: [0,1,2,3], }, yAxis3D: { type: 'category', data: ['2021-01-01','2021-01-02'], }, zAxis3D: { }, grid3D: { }, series: [ { type: 'line3D', name: '2021-01-01', data: [[0,'2021-01-01',0.5],[1,'2021-01-01',0.2],[2,'2021-01-01',0.8]] }, { type: 'line3D', name: '2021-01-02', data: [[0,'2021-01-02',0.1],[1,'2021-01-02',0.3],[2,'2021-01-02',-0.1]] }, { type: 'line3D', name: '峰值', data: [[3,'2021-01-01',0.1],[3,'2021-01-02',0.3]] }, ] } let echartsInstance = echarts.init(document.getElementById('tu')) echartsInstance.setOption(option, true) 这是效果图: