邏輯:(點擊柱形圖的某個實例(注意:三個柱子表示的是一個實例))
參考鏈接:http://echarts.baidu.com/doc/example/event.html
{ name: 'cunchu', type: 'bar', data: [], rawdate: [] //添加了rawdate參數(自定義的) },
function eConsole(param) { var cloudid; var mes = '【' + param.type + '】'; if (typeof param.seriesIndex != 'undefined') { mes += ' seriesIndex : ' + param.seriesIndex; mes += ' dataIndex : ' + param.dataIndex; //alert(option.series[param.dataIndex].rawdate); cloudid = option.series[param.seriesIndex].rawdate[param.dataIndex]; Tiaozhuan(cloudid); } if (param.type == 'hover') { document.getElementById('hover-console').innerHTML = 'Event Console : ' + mes; } else { document.getElementById('console').innerHTML = mes; } console.log(param); }
將你的自定義的參數,弄成數組,傳值給rawdate,然后,可以通過option ,在根據下標,就可以獲取自定義的參數:
option.series[param.seriesIndex].rawdate[param.dataIndex]