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
如下图,当x轴 dataZoom 的左端在“周三”位置时(数据序列索引为2),鼠标移动到“周四”位置触发showTip事件中的 e.dataIndex 值不是3,而是1,即 e.dataIndex 实际是(3 - dataZoom左端在数据序列中的偏移值 2)这么一个间接的值。
这个可能不太合理,在根据 e.dataIndex 索引数据时会很不方便。
类似的,该事件对应的action.tooltip.showTip方法是否也存在该 dataIndex 的问题?
dataIndex 是数据序列的绝对索引,而不是dataZoom相关联的相对索引。 如果确实有相对索引的必要,应该另设一个成员变量,例如OffsetIndex,来指示相对索引。
var myChart = echarts.init(document.getElementById('main')); myChart.on('showTip',onshowTip); function onshowTip(e) { console.log('onShowTip: seriesIndex: ' + e.seriesIndex + ', dataIndex: ' + e.dataIndex); } // 指定图表的配置项和数据 var option = { title: { text: '未来一周气温变化', subtext: '纯属虚构' }, tooltip: { trigger: 'axis' }, legend: { data:['最高气温','最低气温'] }, toolbox: { show: true, feature: { dataZoom: {}, dataView: {readOnly: false}, magicType: {type: ['line', 'bar']}, restore: {}, saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, data: ['周一','周二','周三','周四','周五','周六','周日'] }, yAxis: { type: 'value', axisLabel: { formatter: '{value} °C' } }, dataZoom: [{ type: 'inside', start: 0, end: 50 }, { start: 0, end: 50 }, { show: true, yAxisIndex: 0, filterMode: 'empty', width: 12, handleSize: 8, showDataShadow: false, left: '93%' }], series: [ { name:'最高气温', type:'line', data:[11, 11, 15, 13, 12, 13, 10], markPoint: { data: [ {type: 'max', name: '最大值'}, {type: 'min', name: '最小值'} ] }, markLine: { name: '平均值', animation:false, symbolSize:0, lineStyle:{normal:{color:'#268'}}, data:[ [{value:8,coord:[2,8]},{value:4,coord:[5,4]}] ] } }, { name:'最低气温', type:'line', data:[1, -2, 2, 5, 3, 2, 0], markPoint: { data: [ {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5} ] }, markLine : { name: '平均值', animation:false, symbolSize:0, lineStyle:{normal:{color:'#268'}}, data:[ [{value:'8',coord:[2,8]},{value:'4',coord:[5,4]}] ] } } ] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option);
The text was updated successfully, but these errors were encountered:
这个2.0版本里面可以通过chart.getSeries();获取当前显示的数据的series.data再来获取dataIndex,3.0的改版了不清楚了
Sorry, something went wrong.
e20e448
No branches or pull requests
问题简述 (One-line summary)
如下图,当x轴 dataZoom 的左端在“周三”位置时(数据序列索引为2),鼠标移动到“周四”位置触发showTip事件中的 e.dataIndex 值不是3,而是1,即 e.dataIndex 实际是(3 - dataZoom左端在数据序列中的偏移值 2)这么一个间接的值。
这个可能不太合理,在根据 e.dataIndex 索引数据时会很不方便。
类似的,该事件对应的action.tooltip.showTip方法是否也存在该 dataIndex 的问题?
版本及环境 (Version & Environment)
重现步骤 (Steps to reproduce)
2.
期望结果 (Expected behaviour)
dataIndex 是数据序列的绝对索引,而不是dataZoom相关联的相对索引。
如果确实有相对索引的必要,应该另设一个成员变量,例如OffsetIndex,来指示相对索引。
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
其他信息 (Other comments)
The text was updated successfully, but these errors were encountered: